From 7cc53c6f4ddcd2df388a85d19e7cc044f778ce94 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 3 Apr 2024 13:37:06 +0200 Subject: [PATCH] Add a function to convert markdown files to org --- .../modules/programs/emacs/emacs.d/lib/az_org.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home-manager/modules/programs/emacs/emacs.d/lib/az_org.el b/home-manager/modules/programs/emacs/emacs.d/lib/az_org.el index a397124..86678c1 100644 --- a/home-manager/modules/programs/emacs/emacs.d/lib/az_org.el +++ b/home-manager/modules/programs/emacs/emacs.d/lib/az_org.el @@ -183,3 +183,12 @@ (turn-off-auto-fill) (flyspell-mode))) (add-hook 'org-after-todo-statistics-hook 'org-summary-todo))) + + +;; https://emacs.stackexchange.com/a/41619 +(defun az-markdown-convert-buffer-to-org () + "Convert the current buffer's content from markdown to orgmode format and save it with the current buffer's file name but with .org extension." + (interactive) + (shell-command-on-region (point-min) (point-max) + (format "pandoc -f markdown -t org -o %s" + (concat (file-name-sans-extension (buffer-file-name)) ".org"))))