>From 3e76a9fc447f0c6e6f7f53f4808590354ea6d63d Mon Sep 17 00:00:00 2001 From: Marco Wahl Date: Thu, 11 Jul 2019 12:16:35 +0200 Subject: [PATCH 3/4] Make show-branches applicable to whole file * lisp/org.el (org-kill-note-or-show-branches): Extend and refactor. --- lisp/org.el | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e6117dcdf..fecfc451c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17928,17 +17928,15 @@ Move point to the beginning of first heading or end of buffer." (goto-char (point-min))) (defun org-kill-note-or-show-branches () - "Abort storing current note, or call `outline-show-branches'." + "Abort storing current note, or show just branches." (interactive) - (if (not org-finish-function) - (save-excursion - (save-restriction - (org-narrow-to-subtree) - (org-flag-subtree t) - (call-interactively 'outline-show-branches) - (org-hide-archived-subtrees (point-min) (point-max)))) - (let ((org-note-abort t)) - (funcall org-finish-function)))) + (if org-finish-function + (let ((org-note-abort t)) + (funcall org-finish-function)) + (if (org-before-first-heading-p) + (org-show-branches-buffer) + (outline-hide-subtree) + (outline-show-branches)))) (defun org-delete-indentation (&optional arg) "Join current line to previous and fix whitespace at join. -- 2.22.0