소스 검색

Fix `org-paste-subtree' when called at the end of a headline

* lisp/org.el (org-paste-subtree): Fix `org-paste-subtree' when called
  at the end of a headline.

Reported-by: Dale Sedivec <dale@codefu.org>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00050.html>
Nicolas Goaziou 6 년 전
부모
커밋
2ada40b796
1개의 변경된 파일4개의 추가작업 그리고 6개의 파일을 삭제
  1. 4 6
      lisp/org.el

+ 4 - 6
lisp/org.el

@@ -8363,12 +8363,10 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
 	  (force-level
 	   (cond
 	    (level (prefix-numeric-value level))
-	    ;; When point is right after the stars in an otherwise
-	    ;; empty headline, use stars as the forced level.
-	    ((and (looking-at-p "[ \t]*$")
-		  (string-match-p "^\\*+ *"
-				  (buffer-substring (line-beginning-position)
-						    (point))))
+	    ;; When point is after the stars in an otherwise empty
+	    ;; headline, use the number of stars as the forced level.
+	    ((and (org-match-line "^\\*+[ \t]*$")
+		  (not (eq ?* (char-after))))
 	     (org-outline-level))
 	    ((looking-at-p org-outline-regexp-bol) (org-outline-level))))
 	  (previous-level