summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-12-31 10:06:55 (GMT)
committer Bastien Guerry <bzg@altern.org>2012-12-31 10:06:55 (GMT)
commit61993bc4bf86769ef37573c5b7db40feebb34d53 (patch)
tree0fa6aa7eacb6094b1ccab421146bba1808b83eeb
parenta62beff06dedc8075b0753ace670a26102d224ba (diff)
downloadorg-mode-61993bc4bf86769ef37573c5b7db40feebb34d53.zip
org-mode-61993bc4bf86769ef37573c5b7db40feebb34d53.tar.gz
org.el (org-cycle-internal-local): Don't run hooks when cycling a plain list before first headline
* org.el (org-cycle-internal-local): Don't run hooks when cycling a plain list before first headline.
-rw-r--r--lisp/org.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 2139c52..a780fa3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6285,7 +6285,8 @@ in special contexts.
(cond
((= eos eoh)
;; Nothing is hidden behind this heading
- (run-hook-with-args 'org-pre-cycle-hook 'empty)
+ (unless (org-before-first-heading-p)
+ (run-hook-with-args 'org-pre-cycle-hook 'empty))
(message "EMPTY ENTRY")
(setq org-cycle-subtree-status nil)
(save-excursion
@@ -6298,7 +6299,8 @@ in special contexts.
(not (setq children-skipped
org-cycle-skip-children-state-if-no-children))))
;; Entire subtree is hidden in one line: children view
- (run-hook-with-args 'org-pre-cycle-hook 'children)
+ (unless (org-before-first-heading-p)
+ (run-hook-with-args 'org-pre-cycle-hook 'children))
(if (org-at-item-p)
(org-list-set-item-visibility (point-at-bol) struct 'children)
(org-show-entry)
@@ -6326,24 +6328,28 @@ in special contexts.
(outline-next-heading)
(if (outline-invisible-p) (org-flag-heading nil)))
(setq org-cycle-subtree-status 'children)
- (run-hook-with-args 'org-cycle-hook 'children))
+ (unless (org-before-first-heading-p)
+ (run-hook-with-args 'org-cycle-hook 'children)))
((or children-skipped
(and (eq last-command this-command)
(eq org-cycle-subtree-status 'children)))
;; We just showed the children, or no children are there,
;; now show everything.
- (run-hook-with-args 'org-pre-cycle-hook 'subtree)
+ (unless (org-before-first-heading-p)
+ (run-hook-with-args 'org-pre-cycle-hook 'subtree))
(outline-flag-region eoh eos nil)
(message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE"))
(setq org-cycle-subtree-status 'subtree)
- (run-hook-with-args 'org-cycle-hook 'subtree))
+ (unless (org-before-first-heading-p)
+ (run-hook-with-args 'org-cycle-hook 'subtree)))
(t
;; Default action: hide the subtree.
(run-hook-with-args 'org-pre-cycle-hook 'folded)
(outline-flag-region eoh eos t)
(message "FOLDED")
(setq org-cycle-subtree-status 'folded)
- (run-hook-with-args 'org-cycle-hook 'folded)))))
+ (unless (org-before-first-heading-p)
+ (run-hook-with-args 'org-cycle-hook 'folded))))))
;;;###autoload
(defun org-global-cycle (&optional arg)