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 <iarchivedmywholelife@gmail.com>
Link: https://orgmode.org/list/875y7d7jlr.fsf@gmail.com
This commit is contained in:
Ihor Radchenko 2023-06-24 15:05:12 +03:00
parent 5b3a1a634c
commit 94c2c8d929
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 13 additions and 6 deletions

View File

@ -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)

View File

@ -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)))