diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-04-07 01:39:10 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-04-07 01:39:10 +0200 |
commit | edeb7fd8e17733cc516fbb6620a21092bac0d765 (patch) | |
tree | 142e3f26302cf78ab61ac2268d2f1514facddc7e | |
parent | 033847070e16cd0271209a8070229f5d28625fc0 (diff) | |
download | org-mode-edeb7fd8e17733cc516fbb6620a21092bac0d765.tar.gz |
Fix visibility issue when inserting a heading
* lisp/org.el (org-insert-heading): Fix visibility issue. Remove
unused binding.
Reported-by: Daniel E. Doherty <ded-law@ddoherty.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/96732>
-rwxr-xr-x | lisp/org.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el index 10bd7a5..744d443 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -7748,8 +7748,7 @@ heading, unconditionally." (may-split (org-get-alist-option org-M-RET-may-split-line 'headline)) (respect-content (or org-insert-heading-respect-content (equal arg '(4)))) - (initial-content "") - (adjust-empty-lines t)) + (initial-content "")) (cond @@ -7873,7 +7872,7 @@ heading, unconditionally." ;; Otherwise, after it. (cond ((and (bolp) (looking-at "[ \t]*$"))) - ((bolp) (open-line 1)) + ((bolp) (save-excursion (insert "\n"))) (t (end-of-line) (insert "\n"))) @@ -7881,9 +7880,15 @@ heading, unconditionally." (insert stars) (just-one-space) (insert initial-content) - (when (and adjust-empty-lines - (not (and blank (org-previous-line-empty-p)))) + (unless (and blank (org-previous-line-empty-p)) (org-N-empty-lines-before-current (if blank 1 0))) + ;; Adjust visibility, which may be messed up if we removed + ;; blank lines while previous entry was hidden. + (let ((bol (line-beginning-position))) + (dolist (o (overlays-at (1- bol))) + (when (and (eq (overlay-get o 'invisible) 'outline) + (eq (overlay-end o) bol)) + (move-overlay o (overlay-start o) (1- bol))))) (run-hooks 'org-insert-heading-hook))))))) (defun org-N-empty-lines-before-current (N) |