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.
This commit is contained in:
Carsten Dominik 2010-03-23 08:44:13 +01:00
parent 04f0654a57
commit fc2bdd8cf1
2 changed files with 6 additions and 0 deletions

View File

@ -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>

View File

@ -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