diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1a999fe13..edcea7461 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-11-23 Carsten Dominik + + * org.el (org-insert-heading): Catch before-first-headline when + inserting a headline. + 2009-11-22 Carsten Dominik * org-latex.el (org-export-latex-format-image): Indent figure diff --git a/lisp/org.el b/lisp/org.el index 092923563..831848f2f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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, but create the new headline after the current line." (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* ") (when (or force-heading (not (org-insert-item))) (let* ((empty-line-p nil)