1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-23 07:18:53 +00:00

org.el (org-insert-heading): Fix bug

* org.el (org-insert-heading): Fix bug when trying to insert a
heading when point is before the first headline and not at the
beginning of a line.
This commit is contained in:
Bastien Guerry 2014-05-20 23:28:06 +02:00
parent 1811b37f4d
commit 03acfe44b6

View File

@ -7655,7 +7655,10 @@ command."
;; If we insert after content, move there and clean up whitespace
(when (and respect-content
(not (org-looking-at-p org-outline-regexp-bol)))
(org-end-of-subtree nil t)
(if (not (org-before-first-heading-p))
(org-end-of-subtree nil t)
(re-search-forward org-outline-regexp-bol)
(beginning-of-line 0))
(skip-chars-backward " \r\n")
(and (not (looking-back "^\*+"))
(looking-at "[ \t]+") (replace-match ""))