summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-10-04 22:50:09 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-10-04 22:50:09 +0200
commit2ada40b796f3f0c855f5a6ae61973b9fdd939c4e (patch)
tree0371985aae2241bab60b1d77dfc10a8243ea8ad0
parent5abfdeeb8f72dfc2db324e8e731f4e16f2b54bea (diff)
downloadorg-mode-2ada40b796f3f0c855f5a6ae61973b9fdd939c4e.tar.gz
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>
-rw-r--r--lisp/org.el10
1 files changed, 4 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index a65b079..ef2528d 100644
--- a/lisp/org.el
+++ b/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