From fc2bdd8cf163936d58ecdcf60a79e50d8694afcd Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 23 Mar 2010 08:44:13 +0100 Subject: [PATCH] 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. --- lisp/ChangeLog | 3 +++ lisp/org.el | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b128ae46e..94586b063 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-03-23 Carsten Dominik + * 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 diff --git a/lisp/org.el b/lisp/org.el index 60191f5a2..84bec4c48 100644 --- a/lisp/org.el +++ b/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 -- 2.11.4.GIT