瀏覽代碼

Fix problem when inserting a new headline

Ryan Thompson writes:

> I have found a bug. When the point is at the end of an empty headline
> and you press M-RET (or C-RET) to make a new headline, it deletes all
> the whitespace at the end of the empty headline first, which causes
> the headline to break. I'm not sure if the correct behavior is to
> leave an empty headline, or maybe just do nothing and leave the point
> at the end of the empty headline without creating a new one, but the
> correct thing is definitely *not* to break the headline.
Carsten Dominik 15 年之前
父節點
當前提交
fc2bdd8cf1
共有 2 個文件被更改,包括 6 次插入0 次删除
  1. 3 0
      lisp/ChangeLog
  2. 3 0
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2010-03-23  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-insert-heading): Do not remove all spaces if the
+	headline is empty.
+
 	* org-indent.el (org-indent): Fix group name.
 
 2010-03-21  Carsten Dominik  <carsten.dominik@gmail.com>

+ 3 - 0
lisp/org.el

@@ -6189,6 +6189,9 @@ This is important for non-interactive uses of the command."
 	      (setq pos (point-at-bol))
 	      (or split (end-of-line 1))
 	      (delete-horizontal-space)
+	      (if (string-match "\\`\\*+\\'"
+				(buffer-substring (point-at-bol) (point)))
+		  (insert " "))
 	      (newline (if blank 2 1))
 	      (when tags
 		(save-excursion