瀏覽代碼

Fix inserting headlines at the end of the buffer.

When the cursor is at the end of the buffer but not at the beginning
of a line,  inserting a new headline with C-RET did insert the stars
into the last line, without adding the needed newline.  The new line
is now added.
Carsten Dominik 16 年之前
父節點
當前提交
7d1e644715
共有 2 個文件被更改,包括 4 次插入0 次删除
  1. 3 0
      lisp/ChangeLog
  2. 1 0
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2008-11-03  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org.el (org-insert-heading): If buffer does not end with a
+	newline, add one if necessary to insert headline correctly.
+
 	* org-exp.el (org-export-as-html): Make sure that <hr/> is between
 	paragraphs, not inside.
 

+ 1 - 0
lisp/org.el

@@ -4648,6 +4648,7 @@ but create the new headline after the current line."
 	    (cond
 	     (org-insert-heading-respect-content
 	      (org-end-of-subtree nil t)
+	      (or (bolp) (newline))
 	      (open-line 1))
 	     ((org-on-heading-p)
 	      (when hide-previous