ソースを参照

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")))