summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-04-02 00:06:49 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-04-02 00:06:49 +0200
commit03e81f0d240271d072fd155d41e59b6b353abaa9 (patch)
tree898f783fdd99df6919a500681d023836b970db23
parent5574e005d6e206341bd47e6f8647204ea75b7eea (diff)
downloadorg-mode-03e81f0d240271d072fd155d41e59b6b353abaa9.tar.gz
Fix cycling ARCHIVE trees with inline tasks loaded
* lisp/org-inlinetask.el (org-inlinetask-hide-tasks): New function. * lisp/org.el (org-cycle-hide-inline-tasks): Remove function. (org-cycle-hook): Apply removal. Reported-by: "Francesco Pizzolante" <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> <http://permalink.gmane.org/gmane.emacs.orgmode/89563>
-rw-r--r--lisp/org-inlinetask.el21
-rwxr-xr-xlisp/org.el16
2 files changed, 19 insertions, 18 deletions
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 9e0aadb..887f75e 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -319,14 +319,31 @@ If the task has an end part, also demote it."
(org-cycle-hide-drawers 'children))
(t (outline-flag-region start end t)))))
+(defun org-inlinetask-hide-tasks (state)
+ "Hide inline tasks in buffer when STATE is `contents' or `children'.
+This function is meant to be used in `org-cycle-hook'."
+ (case state
+ (contents
+ (let ((regexp (org-inlinetask-outline-regexp)))
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (org-inlinetask-toggle-visibility)
+ (org-inlinetask-goto-end)))))
+ (children
+ (save-excursion
+ (while (and (outline-next-heading) (org-inlinetask-at-task-p))
+ (org-inlinetask-toggle-visibility)
+ (org-inlinetask-goto-end))))))
+
(defun org-inlinetask-remove-END-maybe ()
"Remove an END line when present."
(when (looking-at (format "\\([ \t]*\n\\)*\\*\\{%d,\\}[ \t]+END[ \t]*$"
org-inlinetask-min-level))
(replace-match "")))
-(eval-after-load "org"
- '(add-hook 'org-font-lock-hook 'org-inlinetask-fontify))
+(add-hook 'org-font-lock-hook 'org-inlinetask-fontify)
+(add-hook 'org-cycle-hook 'org-inlinetask-hide-tasks)
(provide 'org-inlinetask)
diff --git a/lisp/org.el b/lisp/org.el
index 6bb0ddf..d3f7d85 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1420,7 +1420,6 @@ the values `folded', `children', or `subtree'."
(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers
- org-cycle-hide-inline-tasks
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
"Hook that is run after `org-cycle' has changed the buffer visibility.
@@ -7217,21 +7216,6 @@ specifying which drawers should not be hidden."
;; `org-drawer-regexp'.
(goto-char (org-element-property :end drawer))))))))))
-(defun org-cycle-hide-inline-tasks (state)
- "Re-hide inline tasks when switching to 'contents or 'children
-visibility state."
- (case state
- (contents
- (when (org-bound-and-true-p org-inlinetask-min-level)
- (hide-sublevels (1- org-inlinetask-min-level))))
- (children
- (when (featurep 'org-inlinetask)
- (save-excursion
- (while (and (outline-next-heading)
- (org-inlinetask-at-task-p))
- (org-inlinetask-toggle-visibility)
- (org-inlinetask-goto-end)))))))
-
(defun org-flag-drawer (flag &optional element)
"When FLAG is non-nil, hide the drawer we are at.
Otherwise make it visible. When optional argument ELEMENT is