Catch before-first-headline when inserting a headline

Reported by David Maus.
This commit is contained in:
Carsten Dominik 2009-11-23 09:34:22 +01:00
parent d92b46f6e5
commit d60d003980
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2009-11-23 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-insert-heading): Catch before-first-headline when
inserting a headline.
2009-11-22 Carsten Dominik <carsten.dominik@gmail.com> 2009-11-22 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-format-image): Indent figure * org-latex.el (org-export-latex-format-image): Indent figure

View File

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