2

I tried org-mode, and I'm impressed. My org-file for notes is organized like this:

Header 1

Sub header 1

  Foo [ cursor here] 

  Bar

Sub header 2

Currently I use the function org-cycle a lot. It toggles (close or open) the header or the sub header.

But when the cursor is on the text foo, then when I call org-cycle with a key, the subheader will not close. Only when I move the cursor to the sub header 1.

I tried to figure out how I could come with a function, that org-cycle will also work in the text fields under a subheader/header. But I couldn't wrap my head around it...

Any suggestions? It will be appreciated!

  • <kbd> Shift Tab </kbd> will close / open all subheadings. Is that similar to what you're looking for? – user2699 Apr 18 '15 at 23:42
  • Thanks for your suggestion. But it closes the subheaders too, and jumps to the header. I'm looking for the org-cycle which also works on the text fields under sub headers. But thanks for the suggestion anyway, it's always appreciated. – ReneFroger Apr 18 '15 at 23:48
  • You could use org-backward-heading-same-level, passing in an argument of 0 to move to the heading for the text you're in, then call org-cycle. – user2699 Apr 19 '15 at 0:04
1

This functionality is already built in to org mode. You just need to set the following option in your init file:

(setq org-cycle-emulate-tab nil)

With that setting the TAB key should always call org-cycle on the current subtree, wherever your cursor happens to be. There are other possible values for this variable, which give more fine-grained control over when to cycle and when not. See the docs for details.

  • Sir, you deserve an upvote! My problem is solved, now the text behaves like a subheader, and I can toggle them now. Many, many thanks for your answer! – ReneFroger Apr 20 '15 at 9:32
1

Org-mode is built on top of Outline-mode, so you can use all of the latter's functionality at no additional cost. The functions you want specifically are hide-entry and show-entry.

  • Thanks for the clarifity, but I would have one keybinding for when it's a (sub)heading or a text, to toggle them down. Hide-entry and show-entry are only suitable for text fields, not for headers. So that's why I'm thinking about how wrap this into a function. – ReneFroger Apr 19 '15 at 11:16

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.