forked from mirrors/org-mode
Deprecate `org-cycle-hide-drawers'
* lisp/org.el (org-hide-drawer-all): New function. (org-cycle-hide-drawers): move... * lisp/org-compat.el (org-cycle-hide-drawers): ... here. * lisp/org-agenda.el (org-agenda-show-1): Remove use of `org-cycle-hide-drawers'.
This commit is contained in:
parent
1027e02569
commit
074ea1629c
|
@ -323,6 +323,11 @@ Functions in this hook are run after ~org-agenda-filter~ is called.
|
|||
** Removed or renamed functions and variables
|
||||
*** Deprecated ~org-flag-dawer~ function
|
||||
Use ~org-hide-drawer-toggle~ instead.
|
||||
*** Deprecated ~org-cycle-hide-drawers~ function
|
||||
|
||||
Use new function ~org-hide-drawer-all~ instead. Note there is also
|
||||
a new ~org-cycle-hide-property-drawers~ function.
|
||||
|
||||
*** Deprecated ~org-hide-block-toggle-maybe~ function
|
||||
Use ~org-hide-block-toggle~ instead.
|
||||
*** Deprecated ~org-hide-block-toggle-all~ function
|
||||
|
|
|
@ -9117,8 +9117,7 @@ The prefix arg selects the amount of information to display:
|
|||
1 just show the entry according to defaults.
|
||||
2 show the children view
|
||||
3 show the subtree view
|
||||
4 show the entire subtree and any LOGBOOK drawers
|
||||
5 show the entire subtree and any drawers
|
||||
4 show the entire subtree and any drawers
|
||||
With prefix argument FULL-ENTRY, make the entire entry visible
|
||||
if it was hidden in the outline."
|
||||
(interactive "p")
|
||||
|
@ -9148,13 +9147,7 @@ if it was hidden in the outline."
|
|||
(org-back-to-heading)
|
||||
(run-hook-with-args 'org-cycle-hook 'subtree))
|
||||
(message "Remote: SUBTREE"))
|
||||
((= more 4)
|
||||
(outline-show-subtree)
|
||||
(save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-cycle-hide-drawers 'subtree '("LOGBOOK")))
|
||||
(message "Remote: SUBTREE AND LOGBOOK"))
|
||||
((> more 4)
|
||||
((> more 3)
|
||||
(outline-show-subtree)
|
||||
(message "Remote: SUBTREE AND ALL DRAWERS")))
|
||||
(select-window win)))
|
||||
|
|
|
@ -663,6 +663,25 @@ region as a drawer without further ado."
|
|||
(when (invisible-p (max (1- (point)) (point-min)))
|
||||
(goto-char post)))))))
|
||||
|
||||
(defun org-cycle-hide-drawers (state &optional exceptions)
|
||||
"Re-hide all drawers after a visibility state change.
|
||||
STATE should be one of the symbols listed in the docstring of
|
||||
`org-cycle-hook'. When non-nil, optional argument EXCEPTIONS is
|
||||
a list of strings specifying which drawers should not be hidden."
|
||||
(declare (obsolete "use `org-hide-drawer' instead." "Org 9.4"))
|
||||
(when (and (derived-mode-p 'org-mode)
|
||||
(not (memq state '(overview folded contents))))
|
||||
(save-excursion
|
||||
(let* ((globalp (eq state 'all))
|
||||
(beg (if globalp (point-min) (point)))
|
||||
(end (if globalp (point-max)
|
||||
(if (eq state 'children)
|
||||
(save-excursion (outline-next-heading) (point))
|
||||
(org-end-of-subtree t)))))
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(org-hide-drawer-all))))))
|
||||
|
||||
(defun org-hide-block-toggle-maybe ()
|
||||
"Toggle visibility of block at point.
|
||||
Unlike to `org-hide-block-toggle', this function does not throw
|
||||
|
|
39
lisp/org.el
39
lisp/org.el
|
@ -6116,6 +6116,20 @@ Return a non-nil value when toggling is successful."
|
|||
(org-show-all '(blocks))
|
||||
(org-block-map 'org-hide-block-toggle))
|
||||
|
||||
(defun org-hide-drawer-all ()
|
||||
"Fold all drawers in the current buffer."
|
||||
(org-show-all '(drawers))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward org-drawer-regexp nil t)
|
||||
(let ((drawer (org-element-at-point)))
|
||||
(when (memq (org-element-type drawer) '(drawer property-drawer))
|
||||
(org-hide-drawer-toggle t nil 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-property-drawers (state)
|
||||
"Re-hide all drawers after a visibility state change.
|
||||
STATE should be one of the symbols listed in the docstring of
|
||||
|
@ -6136,31 +6150,6 @@ STATE should be one of the symbols listed in the docstring of
|
|||
;; they can be swallowed once we hide the outline.
|
||||
(org-flag-region start end t 'outline)))))))))
|
||||
|
||||
(defun org-cycle-hide-drawers (state &optional exceptions)
|
||||
"Re-hide all drawers after a visibility state change.
|
||||
STATE should be one of the symbols listed in the docstring of
|
||||
`org-cycle-hook'. When non-nil, optional argument EXCEPTIONS is
|
||||
a list of strings specifying which drawers should not be hidden."
|
||||
(when (and (derived-mode-p 'org-mode)
|
||||
(not (memq state '(overview folded contents))))
|
||||
(save-excursion
|
||||
(let* ((globalp (eq state 'all))
|
||||
(beg (if globalp (point-min) (point)))
|
||||
(end (if globalp (point-max)
|
||||
(if (eq state 'children)
|
||||
(save-excursion (outline-next-heading) (point))
|
||||
(org-end-of-subtree t)))))
|
||||
(goto-char beg)
|
||||
(while (re-search-forward org-drawer-regexp (max end (point)) t)
|
||||
(unless (member-ignore-case (match-string 1) exceptions)
|
||||
(let ((drawer (org-element-at-point)))
|
||||
(when (memq (org-element-type drawer) '(drawer property-drawer))
|
||||
(org-hide-drawer-toggle t nil 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))))))))))
|
||||
|
||||
;;;; Visibility cycling
|
||||
|
||||
(defvar-local org-cycle-global-status nil)
|
||||
|
|
Loading…
Reference in New Issue