Optimize hiding all drawers in a buffer

* lisp/org.el (org-cycle-hide-drawers): Make sure each drawer is only
  flagged once.
This commit is contained in:
Nicolas Goaziou 2013-11-22 22:11:44 +01:00
parent 402c310f00
commit e8bafdd04f
1 changed files with 7 additions and 1 deletions

View File

@ -7101,7 +7101,13 @@ specifying which drawers should not be hidden."
(goto-char beg) (goto-char beg)
(while (re-search-forward org-drawer-regexp end t) (while (re-search-forward org-drawer-regexp end t)
(unless (member-ignore-case (match-string 1) exceptions) (unless (member-ignore-case (match-string 1) exceptions)
(org-flag-drawer t))))))) (let ((drawer (org-element-at-point)))
(when (memq (org-element-type drawer) '(drawer property-drawer))
(org-flag-drawer t drawer)
;; Make sure to skip drawer entirely or we might flag
;; it another time when matching its ending line with
;; `org-drawer-regexp'.
(goto-char (org-element-property :end drawer))))))))))
(defun org-cycle-hide-inline-tasks (state) (defun org-cycle-hide-inline-tasks (state)
"Re-hide inline tasks when switching to 'contents or 'children "Re-hide inline tasks when switching to 'contents or 'children