Skip to content

Instantly share code, notes, and snippets.

@loochao
Last active July 5, 2021 15:06
Show Gist options
  • Save loochao/78366deac66000784b0be807c5a06b4f to your computer and use it in GitHub Desktop.
Save loochao/78366deac66000784b0be807c5a06b4f to your computer and use it in GitHub Desktop.
Convert dired marked files to md or pdf
;; https://stackoverflow.com/questions/22072773/batch-export-of-org-mode-files-from-the-command-line
(defun dired-org-to-pdf ()
(interactive)
(let ((files
(if (eq major-mode 'dired-mode)
(dired-get-marked-files)
(let ((default-directory (read-directory-name "dir: ")))
(mapcar #'expand-file-name
(file-expand-wildcards "*.org"))))))
(mapc
(lambda (f)
(with-current-buffer
(find-file-noselect f)
(org-latex-export-to-pdf)))
files)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment