1

I'd like all the property drawers of my org document to be expanded by default when opening my document or launching Emacs with the org document already in my persistent desktop file. I have the following options set at the top of the document:

#+OPTIONS: toc:nil
#+STARTUP: showblocks
#+STARTUP: showeverything

This shows the tree structure, but keeps property drawers hidden/collapsed. I want the property drawers to be shown/expanded. If no such setting exists, is there a command I can use, and perhaps even bind to a key, to expand all property drawers?

The properties I have set contain important data, which I use org's builtin functions to process. If I were to move the data out of the property drawers then I'd have to write functions to parse and process the data. I could, but I'd rather keep the document structure as is.

2
  • Can you reproduce the effect with emacs -Q? I cannot reproduce it with Org version 9.2.3.
    – Tobias
    Apr 22, 2020 at 7:11
  • @Tobias wat? the feature is described in the org manual. Apr 23, 2020 at 22:26

1 Answer 1

3

Note that there is the option org-custom-properties and the function org-toggle-custom-properties-visibility for that purpose.

If you want to open the property drawers in general you can put the following Elisp code below in your init file.

(defun org+-show-drawers ()
  "Show all property drawers in current buffer."
  (interactive)
  (let ((data (org-element-parse-buffer)))
    (org-element-map
    data
    'property-drawer
      (lambda (drawer)
    (let ((b (org-element-property :begin drawer))
          (e (org-element-property :end drawer)))
      (org-flag-region b e nil 'org-hide-drawer))))))

(put 'org+-show-drawers 'safe-local-eval-function t)

If the code is evaluated the following file local variable setting opens all property drawers of the file at startup.

Local Variables:
eval: (org+-show-drawers)
End:
1
  • This works, somehow. As a bonus I see some further possibilities to enhance my use of org in new ways. Spelunking the org source to understand what's going on has yielded some promising nuggets for future implementation. Thank you for the answer. Apr 23, 2020 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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