Small refactoring

* lisp/org.el (org-kill-note-or-show-branches): Prefer `org' functions
over `outline' ones.  Use `cond' instead of nested `if'.
This commit is contained in:
Nicolas Goaziou 2019-12-31 16:55:48 +01:00
parent 524ccf3adb
commit f37ae5e56a
1 changed files with 11 additions and 13 deletions

View File

@ -18008,16 +18008,14 @@ Move point to the beginning of first heading or end of buffer."
(defun org-kill-note-or-show-branches () (defun org-kill-note-or-show-branches ()
"Abort storing current note, or show just branches." "Abort storing current note, or show just branches."
(interactive) (interactive)
(if org-finish-function (cond (org-finish-function
(let ((org-note-abort t)) (let ((org-note-abort t)) (funcall org-finish-function)))
(funcall org-finish-function)) ((org-before-first-heading-p)
(if (org-before-first-heading-p)
(progn
(org-show-branches-buffer) (org-show-branches-buffer)
(org-hide-archived-subtrees (point-min) (point-max))) (org-hide-archived-subtrees (point-min) (point-max)))
(let ((beg (progn (outline-back-to-heading) (point))) (t
(end (progn (outline-end-of-subtree) (point)))) (let ((beg (progn (org-back-to-heading) (point)))
(goto-char beg) (end (save-excursion (org-end-of-subtree t t) (point))))
(outline-hide-subtree) (outline-hide-subtree)
(outline-show-branches) (outline-show-branches)
(org-hide-archived-subtrees beg end))))) (org-hide-archived-subtrees beg end)))))