Преглед изворни кода

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 пре 11 година
родитељ
комит
cf6e54e90b
1 измењених фајлова са 3 додато и 0 уклоњено
  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")))