Fix: (--select) Don't iterate over every heading with preamble
Oops, using "when" instead of "while" did outline-next-heading even when re-search-forward found no more matches. That unnecessarily slowed down some searches, negating almost all of the gains.
This commit is contained in:
parent
81ef7adbca
commit
b5ccc3294e
1 changed files with 5 additions and 4 deletions
|
|
@ -404,10 +404,11 @@ If NARROW is non-nil, buffer will not be widened."
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(when (org-before-first-heading-p)
|
(when (org-before-first-heading-p)
|
||||||
(outline-next-heading))
|
(outline-next-heading))
|
||||||
(cond (preamble-re (cl-loop when (and (when (re-search-forward preamble-re nil t)
|
;; `cl-loop' makes this double-while much clearer than the expanded form.
|
||||||
(outline-back-to-heading 'invisible-ok)
|
(cond (preamble-re (cl-loop while (and (when (re-search-forward preamble-re nil t)
|
||||||
t)
|
(outline-back-to-heading 'invisible-ok)
|
||||||
(funcall predicate))
|
t)
|
||||||
|
(funcall predicate))
|
||||||
collect (funcall action)
|
collect (funcall action)
|
||||||
while (outline-next-heading)))
|
while (outline-next-heading)))
|
||||||
(t (cl-loop when (funcall predicate)
|
(t (cl-loop when (funcall predicate)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue