Fix issue with M-RET not inserting an item before the first headline

Ian Barton writes:

> I am not sure if this is intended behaviour or not.
> If I start a new document with no headings and type:
>
> - item 1
>
> then press M_Ret, I get:
>
> - item 1
> *
>
> If my document is like:
>
> * Heading
> - item 1
>
> M-Ret works as expected.
This commit is contained in:
Carsten Dominik 2009-11-26 08:38:40 +01:00
parent 68cf2588b4
commit 8acb7a3d59
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2009-11-26 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-insert-heading): Also check for item before assuming
before-first-heading condition.
* org-latex.el (org-latex-to-pdf-process): Fix typo in group tag.
(org-export-pdf-logfiles): New option.
(org-export-as-pdf): Use `org-export-pdf-logfiles'.

View File

@ -5973,8 +5973,9 @@ current headline. If point is not at the beginning, do not split the line,
but create the new headline after the current line."
(interactive "P")
(if (or (= (buffer-size) 0)
(not (save-excursion (and (ignore-errors (org-back-to-heading))
(org-on-heading-p)))))
(and (not (save-excursion (and (ignore-errors (org-back-to-heading))
(org-on-heading-p))))
(not (org-in-item-p))))
(insert "\n* ")
(when (or force-heading (not (org-insert-item)))
(let* ((empty-line-p nil)