From 94c2c8d9298b9e268ac7bd3d885faf7114c8f324 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 24 Jun 2023 15:05:12 +0300 Subject: [PATCH] Inhibit error when saving bookmarks with `debug-on-error' set to non-nil * lisp/org-capture.el (org-capture-store-last-position): * lisp/org-refile.el (org-refile): Use `condition-case' instead of `with-demoted-errors' when saving bookmarks. We intent to suppress errors completely here (116c09053), even when `debug-on-error' is set. `with-demoted-errors' does trigger error in such scenario, unlike explicit `condition-case' clause. Reported-by: No Wayman Link: https://orgmode.org/list/875y7d7jlr.fsf@gmail.com --- lisp/org-capture.el | 7 +++++-- lisp/org-refile.el | 12 ++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 40a7f78f1..252527574 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1504,8 +1504,11 @@ Of course, if exact position has been required, just put it there." (org-with-point-at pos (when org-capture-bookmark (let ((bookmark (plist-get org-bookmark-names-plist :last-capture))) - (when bookmark (with-demoted-errors "Bookmark set error: %S" - (bookmark-set bookmark))))) + (when bookmark + (condition-case err + (bookmark-set bookmark) + (error + (message (format "Bookmark set error: %S" err))))))) (move-marker org-capture-last-stored-marker (point)))))) (defun org-capture-narrow (beg end) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 600953fd6..30480e5da 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -589,16 +589,20 @@ prefix argument (`C-u C-u C-u C-c C-w')." (let ((bookmark-name (plist-get org-bookmark-names-plist :last-refile))) (when bookmark-name - (with-demoted-errors "Bookmark set error: %S" - (bookmark-set bookmark-name)))) + (condition-case err + (bookmark-set bookmark) + (error + (message (format "Bookmark set error: %S" err)))))) ;; If we are refiling for capture, make sure that the ;; last-capture pointers point here (when (bound-and-true-p org-capture-is-refiling) (let ((bookmark-name (plist-get org-bookmark-names-plist :last-capture-marker))) (when bookmark-name - (with-demoted-errors "Bookmark set error: %S" - (bookmark-set bookmark-name)))) + (condition-case err + (bookmark-set bookmark) + (error + (message (format "Bookmark set error: %S" err)))))) (move-marker org-capture-last-stored-marker (point))) (deactivate-mark) (run-hooks 'org-after-refile-insert-hook)))