org-fold-subtree: Hide blank lines at the end as well

* lisp/org-fold.el (org-fold-subtree): Hide blank lines before the
next subtree as well.  Add docstring.

Reported-by: Alexandros Prekates <aprekates@posteo.net>
Link: https://orgmode.org/list/20221114020008.03f40695@enous
This commit is contained in:
Ihor Radchenko 2022-11-14 12:22:03 +08:00
parent 4260f5a8d7
commit 4f88116e52
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -332,11 +332,12 @@ When ENTRY is non-nil, show the entire entry."
'outline))))
(defun org-fold-subtree (flag)
"Hide (when FLAG) or reveal subtree at point."
(save-excursion
(org-back-to-heading t)
(org-fold-region
(line-end-position)
(progn (org-end-of-subtree t) (point))
(progn (org-end-of-subtree t t) (if (eobp) (point) (1- (point))))
flag
'outline)))