浏览代码

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

+ 5 - 4
lisp/org-capture.el

@@ -1147,10 +1147,11 @@ may have been stored before."
      (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))))
+                   (if (or (org-at-heading-p)
+                           (ignore-errors
+			     (save-excursion (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