diff options
author | Jonas Bernoulli <jonas@bernoul.li> | 2018-11-03 20:22:28 +0100 |
---|---|---|
committer | Jonas Bernoulli <jonas@bernoul.li> | 2018-11-03 20:22:28 +0100 |
commit | 46a7b5136338d8fc7af4f6eb3ade2b8a990b7760 (patch) | |
tree | 50354f3877ab80ffec9772d9a3e61c120af4a826 | |
parent | db11c10b8ca981f00d9fc7f8e0669a6c15710502 (diff) |
with-editor-{finish,cancel}-hook: No longer ignore global value
-rw-r--r-- | with-editor.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/with-editor.el b/with-editor.el index bf79dd6..e5445b1 100644 --- a/with-editor.el +++ b/with-editor.el @@ -331,14 +331,15 @@ And some tools that do not handle $EDITOR properly also break." (interactive "P") (when (run-hook-with-args-until-failure 'with-editor-finish-query-functions force) - (let ((with-editor-post-finish-hook-1 - (ignore-errors (delq t with-editor-post-finish-hook))) + (let ((post-finish-hook with-editor-post-finish-hook) (dir default-directory)) (run-hooks 'with-editor-pre-finish-hook) (with-editor-return nil) (accept-process-output nil 0.1) - (let ((default-directory dir)) - (run-hooks 'with-editor-post-finish-hook-1))))) + (with-temp-buffer + (setq default-directory dir) + (setq-local with-editor-post-finish-hook post-finish-hook) + (run-hooks 'with-editor-post-finish-hook))))) (defun with-editor-cancel (force) "Cancel the current edit session." @@ -348,15 +349,16 @@ And some tools that do not handle $EDITOR properly also break." (let ((message with-editor-cancel-message)) (when (functionp message) (setq message (funcall message))) - (let ((with-editor-post-cancel-hook-1 - (ignore-errors (delq t with-editor-post-cancel-hook))) + (let ((post-cancel-hook with-editor-post-cancel-hook) (with-editor-cancel-alist nil) (dir default-directory)) (run-hooks 'with-editor-pre-cancel-hook) (with-editor-return t) (accept-process-output nil 0.1) - (let ((default-directory dir)) - (run-hooks 'with-editor-post-cancel-hook-1))) + (with-temp-buffer + (setq default-directory dir) + (setq-local with-editor-post-cancel-hook post-cancel-hook) + (run-hooks 'with-editor-post-cancel-hook))) (message (or message "Canceled by user"))))) (defun with-editor-return (cancel) |