diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2013-02-18 09:28:05 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2013-02-18 09:28:05 +0100 |
commit | 65b404427e1e49c251c45ab4f3587c5f97358436 (patch) | |
tree | fb290c127b39f9651b48bc3a26ec6d917426b0c7 | |
parent | 1f8c8dc6d6b0f6c9900be44519c00497f8ed89ff (diff) | |
download | org-mode-65b404427e1e49c251c45ab4f3587c5f97358436.tar.gz |
Improve spacing when inserting new headline after end of subtree
When using C-RET to insert a new headline, the new headline was
inserted after arbitrary amounts of whitespace at the end of the
subtree. This whitespace is now shrunk, to avoid unnatural spacing.
* lisp/org.el (org-insert-heading): Shrink whitespace at end of
subtree when `org-insert-heading-respect-content' is on.
-rw-r--r-- | lisp/org.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index 461cdf0..f0d3c61 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7331,7 +7331,12 @@ This is important for non-interactive uses of the command." (cond (org-insert-heading-respect-content (if (not (equal force-heading '(16))) - (org-end-of-subtree nil t) + (progn + (org-end-of-subtree nil t) + (and (looking-at "^\\*") (backward-char 1)) + (while (and (not (bobp)) + (member (char-before) '(?\ ?\t ?\n))) + (backward-delete-char 1))) (org-up-heading-safe) (org-end-of-subtree nil t)) (when (featurep 'org-inlinetask) |