Skip to content

Commit

Permalink
org-fold-core-regions: Avoid multiple evaluation of argument
Browse files Browse the repository at this point in the history
* lisp/org-fold-core.el (org-fold-core-regions): Evaluate RELATIVE
once.
  • Loading branch information
yantar92 committed Sep 20, 2022
1 parent 0057cc2 commit f1a1974
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lisp/org-fold-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -1036,9 +1036,10 @@ from that position."
`(org-with-wide-buffer
(when ,override (org-fold-core-region (point-min) (point-max) nil))
(pcase-dolist (`(,beg ,end ,spec) (delq nil ,regions))
(if ,relative
(org-fold-core-region (+ ,relative beg) (+ ,relative end) t spec)
(org-fold-core-region beg end t spec))
(let ((rel ,relative))
(if rel
(org-fold-core-region (+ rel beg) (+ rel end) t spec)
(org-fold-core-region beg end t spec)))
(when ,clean-markers
(when (markerp beg) (set-marker beg nil))
(when (markerp end) (set-marker end nil))))))
Expand Down

0 comments on commit f1a1974

Please sign in to comment.