4

When I copy an outline into an org-mode buffer, Emacs automatically unfolds it. How can I prevent it from doing so?

I always want the outlines I paste in to be fully folded.

Here's an example:

If my org-mode buffer looks like:

* A
** AA
*** AAA
** AB
*** ABA
* B
** BA
*** BAA
** BB
*** BBA
* C
** CA
*** CAA
** CB
*** CBA

and I fold all those outlines up, so that org shows them as:

* A...
* B...
* C...

Then I cut (or kill) the * A... outline, so I'm just left with:

* B...
* C...

Normally, by default, when I paste (or yank) the previously cut (killed) * A... outline, org inserts it and unfolds it so that it looks like:

* B...
* A
** AA
*** AAA
** AB
*** ABA
* C...

Instead, when I paste it in, I'd like it to be fully folded, so that it looks like:

* B...
* A...
* C...
izkon
  • 1,798
  • 10
  • 23
  • Can you clarify what you mean with "fully folded"? If you paste an org outline with a single root heading do you only want to see that heading? Do you want to see all subheadings? Do you want to see folded property drawers or just the headings? – ebpa Sep 28 '17 at 22:21
  • 1
    There is a configuration value `org-yank-folded-subtrees` that may accomplish what you desire, but seems to require that you use `org-cut-special` (`C-c C-x C-w`) to kill the subtree and yank with `org-paste-special` (`C-c C-x C-y`). – ebpa Sep 28 '17 at 22:26
  • 1
    ebpa: I just provided an example of what I mean above. `org-cut-special` and `org-paste-special` do indeed do what I need. I just have to make sure to use those when I'm cutting and pasting in outlines. – izkon Sep 29 '17 at 00:08
  • @ebpa it looks like izkon found you comment useful! Please post your answer! – Melioratus Sep 30 '17 at 19:21
  • 1
    @Melioratus done :-) – ebpa Sep 30 '17 at 19:28

1 Answers1

3

There is a configuration value org-yank-folded-subtrees that accomplishes this, but you need to use:

  1. org-cut-special (C-c C-x C-w) to kill the subtree initially and then
  2. org-paste-special (C-c C-x C-y) to yank that subtree
Melioratus
  • 4,504
  • 1
  • 25
  • 43
ebpa
  • 7,319
  • 26
  • 53