diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-06-11 13:32:26 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-06-11 13:33:50 +0200 |
commit | 819cdb3a0974b0d39bd66373cab23df49198447f (patch) | |
tree | c42963ed7a86da6be3e43fe0133273847feb62ef | |
parent | c07175bfaa058d7351075b6b4de150ee2a4256b5 (diff) | |
download | org-mode-819cdb3a0974b0d39bd66373cab23df49198447f.tar.gz |
Preserve list visibility when inserting a new item
* lisp/org.el (org-insert-heading): Do not reveal gratuitously too much
context before inserting an item.
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
Reported-by: Steinar Bang <sb@dod.no>
<http://permalink.gmane.org/gmane.emacs.orgmode/107665>
-rw-r--r-- | lisp/org.el | 1 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index bd18b29..b2d3809 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7753,7 +7753,6 @@ command. When optional argument TOP-LEVEL is non-nil, insert a level 1 heading, unconditionally." (interactive "P") - (if (org-called-interactively-p 'any) (org-reveal)) (let ((itemp (and (not top-level) (org-in-item-p))) (may-split (org-get-alist-option org-M-RET-may-split-line 'headline)) (respect-content (or org-insert-heading-respect-content diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 5f37ce5..42a051d 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -1100,6 +1100,18 @@ (goto-char (point-max)) (let ((org-insert-heading-respect-content nil)) (org-insert-heading)) (buffer-string)))) + ;; Preserve list visibility when inserting an item. + (should + (equal + '(outline outline) + (org-test-with-temp-text "- A\n - B\n- C\n - D" + (let ((org-cycle-include-plain-lists t)) + (org-cycle) + (forward-line 2) + (org-cycle) + (let ((org-insert-heading-respect-content nil)) (org-insert-heading)) + (list (get-char-property (line-beginning-position 0) 'invisible) + (get-char-property (line-end-position 2) 'invisible)))))) ;; When called with two universal arguments, insert a new headline ;; at the end of the grandparent subtree. (should |