Bläddra i källkod

Improve behvior of org-insert-heading to end of subtree

* lisp/org.el (org-insert-heading): Improve whitespace behavior at
end of subtree.

In a subtree with lots of empty space at the end, until now the new
entry would be inserted after all that whitespace.  Now, it is
inserted closer to the existing text, and the whitespace remains after
the new headline.
Carsten Dominik 12 år sedan
förälder
incheckning
cf6e54e90b
1 ändrade filer med 3 tillägg och 0 borttagningar
  1. 3 0
      lisp/org.el

+ 3 - 0
lisp/org.el

@@ -7629,6 +7629,9 @@ This is important for non-interactive uses of the command."
 	  ;; If we insert after content, move there and clean up whitespace
 	  (when respect-content
 	    (org-end-of-subtree nil t)
+	    (skip-chars-backward " \r\n")
+	    (and (looking-at "[ \t]+") (replace-match ""))
+	    (forward-char 1)
 	    (when (looking-at "^\\*")
 	      (backward-char 1)
 	      (insert "\n")))