org-capture.el: Fix heading's position when inserting a template "here"

* lisp/org-capture.el (org-capture-place-entry): Fix heading's
position when inserting a template "here" with C-0 M-x org-capture.

Reported-by: david wen riccardi-zhu <dwrz@dwrz.net>
Ref: https://orgmode.org/list/877dscaila.fsf@dwrz.net/
This commit is contained in:
Nicholas Vollmer 2020-10-02 14:01:35 -04:00 committed by Kyle Meyer
parent 84bfc688d6
commit 8d3610df08
1 changed files with 5 additions and 4 deletions

View File

@ -1148,7 +1148,8 @@ may have been stored before."
;; FIXME: level should probably set directly within (let ...). ;; FIXME: level should probably set directly within (let ...).
(setq level (org-get-valid-level (setq level (org-get-valid-level
(if (or (org-at-heading-p) (if (or (org-at-heading-p)
(ignore-errors (org-back-to-heading t))) (ignore-errors
(save-excursion (org-back-to-heading t))))
(org-outline-level) (org-outline-level)
1)))) 1))))
;; Insert as a child of the current entry. ;; Insert as a child of the current entry.