diff options
author | Bastien Guerry <bzg@altern.org> | 2014-05-20 23:28:06 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2014-05-20 23:28:06 +0200 |
commit | 03acfe44b69a0c48b2806db3c49536df75d6499c (patch) | |
tree | 0a313964f78bb6c016e78a5dd859da3c6540ed72 | |
parent | 1811b37f4d01290112ac375e6d36c2a1030ad80d (diff) | |
download | org-mode-03acfe44b69a0c48b2806db3c49536df75d6499c.tar.gz |
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.
-rw-r--r-- | lisp/org.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index d2a0b7c..6692974 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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 "")) |