Skip to content

Commit

Permalink
me-with-org-parent-heading: make sure we widen also in case of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ag91 committed Sep 3, 2024
1 parent cc52a1e commit 42dfd50
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions moldable-emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,15 @@ so with keyword entries, into a org table with headings.
"Execute BODY with narrowing on the upmost parent heading if it exists."
`(save-excursion
(while (org-up-heading-safe))
(ignore-errors (org-narrow-to-subtree))
(let ((r__ (progn ,@body)))
(widen)
r__)))
(with-demoted-errors (org-narrow-to-subtree))
(condition-case err
(let ((r__ (progn ,@body)))
(widen)
r__)
(error
(widen)
(error err)))
))

(defun me-first-org-table (&optional buffer)
"Find first org table. Optionally in BUFFER."
Expand Down

0 comments on commit 42dfd50

Please sign in to comment.