1

It is well known that one can narrow a subtree with Ctrl-xns.

Is it possible to narrow two consecutive trees? How?

1
  • 2
    One could certainly build a function or macro to do that, based on narrow-to-region.
    – JeanPierre
    Apr 12 '17 at 14:44
6

If you have org speed commands setup, you can put your cursor at the beginning of a headline, press C-spc to start a mark, then press n to select subsequent headlines, and then C-x nn to narrow to the region.

You can do the same without speed commands, just use C-c C-n or C-c C-f to move to the next headline after setting mark. You can also give these commands a prefix argument, e.g. C-4 C-c C-n if you wanted to mark the next 4 headlines.

4
  • 5
    org-mark-element (bound to M-h by default) can select entire elements (for instance headlines.) This command might be useful if someone doesn't have anything set up to navigate org documents quickly.
    – user12563
    Apr 12 '17 at 15:01
  • True, but to select multiple headlines you would have to type M-h C-x C-x to swap point and mark so you can keep moving the point down to following headlines. Or you have to mark the bottom one with M-h and then move the point up. Apr 12 '17 at 15:51
  • 2
    @JohnKitchin Hmm, I can just hit M-h repeatedly to mark many headlines (subtrees) in a row, then narrow. Might be that I have transient-mark-mode on and you do not, though.
    – glucas
    Apr 12 '17 at 16:39
  • 1
    you are right! Interestingly point stays at the top. I had tried it on a large heading that went off screen so I didn't notice that. Apr 12 '17 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.