From f9a677427e480be5b89ea5072ee1148ee1f6ba1f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 11 May 2020 03:08:37 -0400 Subject: [PATCH] Replace save-after-refile advice with hook A hook is better than an advice, which could break with an update. Also, reformat org-mks advice. --- modules/lang/org/config.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 8e37a6116..be195e05f 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -319,11 +319,17 @@ I like: (after! org-capture (org-capture-put :kill-buffer t)) + ;; Fix #462: when refiling from org-capture, Emacs prompts to kill the + ;; underlying, modified buffer. This fixes that. + (add-hook 'org-after-refile-insert-hook #'save-buffer) + ;; HACK Doom doesn't support `customize'. Best not to advertise it as an ;; option in `org-capture's menu. (defadvice! +org--remove-customize-option-a (orig-fn table title &optional prompt specials) :around #'org-mks - (funcall orig-fn table title prompt (remove '("C" "Customize org-capture-templates") specials))) + (funcall orig-fn table title prompt + (remove '("C" "Customize org-capture-templates") + specials))) (defadvice! +org--capture-expand-variable-file-a (file) "If a variable is used for a file path in `org-capture-template', it is used @@ -334,13 +340,6 @@ relative to `org-directory', unless it is an absolute path." (expand-file-name (symbol-value file) org-directory) file)) - (defadvice! +org--prevent-save-prompts-when-refiling-a (&rest _) - "Fix #462: when refiling from org-capture, Emacs prompts to kill the -underlying, modified buffer. This fixes that." - :after #'org-refile - (when (bound-and-true-p org-capture-is-refiling) - (org-save-all-org-buffers))) - (add-hook! 'org-capture-mode-hook (defun +org-show-target-in-capture-header-h () (setq header-line-format