diff options
author | Bastien Guerry <bastien.guerry@data.gouv.fr> | 2020-09-09 11:34:04 +0200 |
---|---|---|
committer | Bastien Guerry <bastien.guerry@data.gouv.fr> | 2020-09-09 11:34:04 +0200 |
commit | f5573e6a00ba649f8da390e280374d172dc7dd77 (patch) | |
tree | 81c51f2977bb6ebd1f529017f63f4d85019429f1 | |
parent | b79fef1da771f129a74e73b3474e527b29e37967 (diff) | |
download | org-mode-f5573e6a00ba649f8da390e280374d172dc7dd77.tar.gz |
org-capture.el: Fix heading's level when inserting a template "here"
* lisp/org-capture.el (org-capture-place-entry): Fix heading's
level when inserting a template "here" with C-0 M-x org-capture.
Reported-by: Nick Dokos <ndokos@gmail.com>
See <https://orgmode.org/list/87lfiuxqze.fsf@alphaville.usersys.redhat.com/>
-rw-r--r-- | lisp/org-capture.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index b74978c..d9c8472 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1144,7 +1144,13 @@ may have been stored before." (when exact-position (goto-char exact-position)) (cond ;; Force insertion at point. - ((org-capture-get :insert-here) nil) + (insert-here? + ;; FIXME: level should probably set directly within (let ...). + (setq level (org-get-valid-level + (if (or (org-at-heading-p) + (ignore-errors (org-back-to-heading t))) + (org-outline-level) + 1)))) ;; Insert as a child of the current entry. ((org-capture-get :target-entry-p) (setq level (org-get-valid-level |