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>
This commit is contained in:
parent
5574e005d6
commit
03e81f0d24
|
@ -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)
|
||||
|
||||
|
|
16
lisp/org.el
16
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
|
||||
|
|
Loading…
Reference in New Issue