branch: externals/org commit 1517ead2aa828f45f95f31d8d08b66f40fead544 Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
org-cycle-show-empty-lines: Always show empty lines at the end of file * lisp/org-cycle.el (org-cycle-show-empty-lines): Fix revealing trailing blank lines after the last heading in buffer. When heading is non-empty reveal the lines as well. Update the docstring documenting the behavior. Reported-by: Ilya Konovalov <arag...@gmail.com> Link: https://orgmode.org/list/87ed0vmcsn....@gmail.com --- lisp/org-cycle.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el index 6f00a82641..c61aa47ec8 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -749,7 +749,9 @@ symbols `content', `all', `folded', `children', or `subtree'." The region to be covered depends on STATE when called through `org-cycle-hook'. Lisp program can use t for STATE to get the entire buffer covered. Note that an empty line is only shown if there -are at least `org-cycle-separator-lines' empty lines before the headline." +are at least `org-cycle-separator-lines' empty lines before the headline. + +Always show empty lines at the end of file." (when (/= org-cycle-separator-lines 0) (save-excursion (let* ((n (abs org-cycle-separator-lines)) @@ -782,11 +784,8 @@ are at least `org-cycle-separator-lines' empty lines before the headline." ;; Never hide empty lines at the end of the file. (save-excursion (goto-char (point-max)) - (outline-previous-heading) - (outline-end-of-heading) - (when (and (looking-at "[ \t\n]+") - (= (match-end 0) (point-max))) - (org-fold-region (point) (match-end 0) nil 'outline)))) + (skip-chars-backward "[ \t\n]") + (org-fold-region (point) (point-max) nil 'outline))) (defun org-cycle-hide-archived-subtrees (state) "Re-hide all archived subtrees after a visibility state change.