浏览代码

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/>
Bastien Guerry 4 年之前
父节点
当前提交
f5573e6a00
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      lisp/org-capture.el

+ 7 - 1
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