1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-24 07:20:29 +00:00

org-fold-show-entry: Do not fold drawers unless requested

* lisp/org-fold.el (org-fold-show-entry): Do not fold drawers in the
unfolded entry unless the new optional argument is non-nil.  Folding
the drawers was introduced in 1027e02569, but does not follow the
function docstring.  Moreover, folding drawers creates unexpected
behaviour in some cases.  See
https://orgmode.org/list/m2a6bl4mmr.fsf@andrew.cmu.edu

* etc/ORG-NEWS (~org-fold-show-entry~ does not fold drawers by default
anymore): Document the change.

* lisp/org-agenda.el (org-agenda-show):
(org-agenda-show-and-scroll-up):
(org-agenda-show-1):
* lisp/org-compat.el (outline-toggle-children):
* lisp/org.el (org-move-subtree-down):
(org-return): Explicitly request folding drawers inside the revealed
entry in the places where it appears to make sense.

* lisp/org-timer.el (org-timer--get-timer-title): Do not unfold entry
at all.  This is a noninteractive function.
This commit is contained in:
Ihor Radchenko 2022-05-13 21:30:46 +08:00
parent a753d0dd26
commit 785f003de5
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
6 changed files with 15 additions and 9 deletions

View File

@ -252,6 +252,13 @@ instance,
includes all available items in the printed bibliography.
** New functions and changes in function arguments
*** ~org-fold-show-entry~ does not fold drawers by default anymore
~org-fold-show-entry~ now accepts an optional argument HIDE-DRAWERS.
When the argument is non-nil, the function folds all the drawers
inside entry. This was the default previously.
Now, ~org-fold-show-entry~ does not fold drawers by default.
*** New function ~org-element-cache-map~ for quick mapping across Org elements

View File

@ -9753,7 +9753,7 @@ if it was hidden in the outline."
(interactive "P")
(let ((win (selected-window)))
(org-agenda-goto t)
(when full-entry (org-fold-show-entry))
(when full-entry (org-fold-show-entry 'hide-drawers))
(select-window win)))
(defvar org-agenda-show-window nil)
@ -9772,7 +9772,7 @@ fold drawers."
(select-window org-agenda-show-window)
(ignore-errors (scroll-up)))
(org-agenda-goto t)
(org-fold-show-entry)
(org-fold-show-entry 'hide-drawers)
(if arg (org-cycle-hide-drawers 'children)
(org-with-wide-buffer
(narrow-to-region (org-entry-beginning-position)
@ -9816,7 +9816,7 @@ if it was hidden in the outline."
((and (called-interactively-p 'any) (= more 1))
(message "Remote: show with default settings"))
((= more 2)
(org-fold-show-entry)
(org-fold-show-entry 'hide-drawers)
(org-fold-show-children)
(save-excursion
(org-back-to-heading)

View File

@ -1517,7 +1517,7 @@ key."
(if (not (org-fold-folded-p (line-end-position)))
(org-fold-hide-subtree)
(org-fold-show-children)
(org-fold-show-entry))))
(org-fold-show-entry 'hide-drawers))))
ad-do-it))
;; TODO: outline-headers-as-kill

View File

@ -519,7 +519,7 @@ of the current heading, or to 1 if the current line is not a heading."
(if (and (bolp) (not (bobp)) (outline-invisible-p (1- (point))))
(org-fold-region (max (point-min) (1- (point))) (point) nil)))))
(defun org-fold-show-entry ()
(defun org-fold-show-entry (&optional hide-drawers)
"Show the body directly following its heading.
Show the heading too, if it is currently invisible."
(interactive)
@ -534,7 +534,7 @@ Show the heading too, if it is currently invisible."
(point-max)))
nil
'outline)
(org-cycle-hide-drawers 'children)))
(when hide-drawers (org-cycle-hide-drawers 'children))))
(defalias 'org-fold-show-hidden-entry #'org-fold-show-entry
"Show an entry where even the heading is hidden.")

View File

@ -478,7 +478,6 @@ Try to use an Org header, otherwise use the buffer name."
(with-current-buffer (marker-buffer marker)
(org-with-wide-buffer
(goto-char hdmarker)
(org-fold-show-entry)
(or (ignore-errors (org-get-heading))
(buffer-name (buffer-base-buffer))))))))
((derived-mode-p 'org-mode)

View File

@ -6911,7 +6911,7 @@ case."
(move-marker ins-point nil)
(if folded
(org-fold-subtree t)
(org-fold-show-entry)
(org-fold-show-entry 'hide-drawers)
(org-fold-show-children))
(org-clean-visibility-after-subtree-move)
;; move back to the initial column we were at
@ -17447,7 +17447,7 @@ object (e.g., within a comment). In these case, you need to use
(org-auto-align-tags (org-align-tags))
(t (org--align-tags-here tags-column))) ;preserve tags column
(end-of-line)
(org-fold-show-entry)
(org-fold-show-entry 'hide-drawers)
(org--newline indent arg interactive)
(when string (save-excursion (insert (org-trim string))))))
;; In a list, make sure indenting keeps trailing text within.