org-export somewhere else!

This commit is contained in:
2026-03-28 21:08:39 +02:00
parent 593d9a3bcd
commit 7acc42826c

View File

@@ -692,3 +692,21 @@
) )
;; slight caveat with emacs gui mode ;; slight caveat with emacs gui mode
(define-key key-translation-map (kbd "ESC") (kbd "C-g")) (define-key key-translation-map (kbd "ESC") (kbd "C-g"))
;; Add advice to let me set a different directory for the exported
;; files. Usually I do this with a directory-local variable for a
;; project, like this:
;; ((org-mode . ((my/org-export-directory . "~/org/exports"))))
(defun my/set-org-export-directory (orig-fun extension
&optional subtreep pub-dir)
"Advice function to set export directory for `org-export-output-file-name'.
Set `my/org-export-dir' to specify the desired export directory."
(let ((pub-dir (or pub-dir
(and (boundp 'my/org-export-dir)
my/org-export-dir))))
(funcall orig-fun extension subtreep pub-dir)))
(after! ox
(advice-add 'org-export-output-file-name
:around #'my/set-org-export-directory))