Last active
August 8, 2025 23:15
-
-
Save preetpalS/ee2cc0a2bcd2755e20befb4d82f62119 to your computer and use it in GitHub Desktop.
Emacs Lisp convert files to Org mode files using pandoc for viewing purposes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun init-pandoc-convert-to-org-file-and-view (fname) | |
"Enables support for viewing files (such as docx or epub files) | |
via conversions using pandoc (by converting them to org files)" | |
(interactive "fEnter name of file to be converted to org file for viewing: ") | |
;; (print (concat "fname: " fname)) | |
(let* ((base-file-name (file-name-base fname)) | |
(output-file-name (concat (make-temp-file base-file-name t) "/" base-file-name ".org")) | |
(pandoc-conversion-command (concat "pandoc \"" | |
fname | |
"\" -t org -o \"" | |
output-file-name "\""))) | |
;; (print (concat "base-file-name: " base-file-name)) | |
;; (print (concat "output-file-name: " output-file-name)) | |
;; (print (concat "pandoc-conversion-command: " pandoc-conversion-command)) | |
(shell-command pandoc-conversion-command) | |
(find-file output-file-name))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment