diff --git a/private_dot_config/doom/config.el b/private_dot_config/doom/config.el index 9576017..6468922 100644 --- a/private_dot_config/doom/config.el +++ b/private_dot_config/doom/config.el @@ -692,3 +692,21 @@ ) ;; slight caveat with emacs gui mode (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))