9

My drawers don't seem to collapse with TAB. I've even tried the canonical example:

* This is a headline
  Still outside the drawer
  :DRAWERNAME:
  This is inside the drawer.
  :END:
  After the drawer.

When I place the cursor on the line :DRAWERNAME: and hit TAB nothing happens:

enter image description here

Also, when I place the cursor on the headline and press TAB repeatedly, I cycle through the following two states:

enter image description here

... and:

enter image description here

In other words the entire headline appears collapsed but the drawer itself is never collapsed.

8

You need to tell org about any custom drawer names you want to use by customizing org-drawers:

org-drawers is a variable defined in org.el. Its value is ("PROPERTIES" "CLOCK" "LOGBOOK" "RESULTS")

Documentation: Names of drawers. Drawers are not opened by cycling on the headline above. Drawers only open with a TAB on the drawer line itself.

(blah blah blah)

The drawer "PROPERTIES" is special for capturing properties through the property API.

With the default, the :PROPERTIES: drawer will toggle, but the drawer :DRAWERNAME: will not. However, you can (add-to-list 'org-drawers "DRAWERNAME"), restart org-mode (M-x org-mode), and it will recognize the latter as well.

  • 1
    Newer org versions appear to have done away with org-drawers in favour of org-drawer-regexp. When I create a drawer named foobar, I can open and close it with the tab key just fine. (My org version is 8.3beta. I live dangerously and update it directly from the git repo at irregular intervals.) – Harald Hanche-Olsen Sep 11 '15 at 7:10
  • The org-mode 8.3 removed the need to specify custom drawers. – erikstokes Sep 11 '15 at 14:04
  • @erikstokes and Harald -- great, I was working with 8.2. Perhaps one of you can add another answer to highlight the changes with the new version? – Dan Sep 11 '15 at 14:06
11

As of org-mode version 8.3 this Just Works without needing to set anything.

Before you had to tell org-mode the names of your custom drawers (as per @Dan's answer) to make the work. The org-drawers variable and #+DRAWERS keyword are now obsolete.

  • Note: as of now, Emacs 25.1 is shipped with Org 8.2 built-in, but Org 8.3 can be installed from the gnu packages collection. – 9000 Jun 20 '17 at 15:02

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.