6

I have a collection of Org files that all link to a central properties file in which I specify _ALL properties so that I can get uniform entry of information across many files:

#+SETUPFILE: ../../properties.org

I have also tried adding properties set to <unspecified> in the hopes that they would pre-populate the property entry list because it is easier not to retype the same property names every time I open a new file. Thus, a snippet of my properties.org looks like:

#+PROPERTY: GENRE <unspecified>
#+PROPERTY: GENRE_ALL Commentary Theology History Biography Philosophy Sermons

However, I was wrong about how this works. The properties menu seems to be only populated from properties that are physically in the file, not from properties that are imported from the SETUPFILE.

Is there some way I can pre-populate the property menu so that I don't have to fully retype the property names every time I start entering them in a new file?

3
  • I cannot get away from typing GENRE the first time that I want to use the property in the file, but the GENRE_ALL values menu completion works for me and after I've entered one GENRE property in the file, then I don't have to type it again: completion works on the name as well as the values. The doc for SETUPFILE seems to imply that it ought to work too, so I'm not sure why you are having problems. Tested with release 9.3 (as distributed with emacs 28.0.50) and also with upstream Org mode version 9.3.7 (release_9.3.7-660-g73e367).
    – NickD
    Commented Jul 5, 2020 at 2:25
  • @NickD thanks for the response. To clarify, getting away from typing GENRE the first time is precisely what I want to do, and the rest of the behavior I'm seeing is exactly as you've described. I wouldn't care about this if all my properties were as short as GENRE, but this is a bad example in the sense that it is one of my shortest property names. The problem I have is that I only enter many of these properties once per file, and so the subsequent autocompletion gives me no benefit. Commented Jul 5, 2020 at 20:22
  • 1
    You can add your property names to the default property list org-default-properties. These are properties used by Org mode itself, but it is used for completion, so maybe you can add your own without adverse effects. But it's not a particularly flexible method.
    – NickD
    Commented Jul 6, 2020 at 19:51

1 Answer 1

9
+50

I think this is an omission, so I'm going to send the following patch to the Org mode mailing list as an enhancement. The patch is against latest (as of now) Org mode, but it is simple enough to apply by hand, if you'd like to try it out (or you might wait for a little while and see what happens to it upstream before doing anything):

diff --git a/lisp/org.el b/lisp/org.el
index 748c058ca..0ca7f3e92 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13084,6 +13084,12 @@ COLUMN formats in the current buffer."
    (props (append
            (and specials org-special-properties)
            (and defaults (cons org-effort-property org-default-properties))
+           ;; Get property names from #+PROPERTY keywords as well
+           (mapcar (lambda (s)               
+                     (nth 0 (split-string s)))
+                   (cdar (org-collect-keywords '("PROPERTY"))))
            nil)))
      (org-with-wide-buffer
       (goto-char (point-min))

If you want to try it, but the line numbers don't match up, the modification is to the function org-buffer-property-keys: you can easily add the hunk by hand at the proper place.

See this thread for the current state.

EDIT: the patch, slightly enhanced, has now been applied, but you will only be able to get it if you install Org mode from git (and you use the development ("master") branch, not the stable ("maint") branch). It will be part of Org mode 9.4 when that gets released.

Note that the patch that was applied adds the "bare" property foo if it finds a foo_ALL property, so you don't need to do

 #+PROPERTY: foo_ALL foo bar baz
 #+PROPERTY: foo <unspecified>

Just the first one is enough.

Your Answer

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

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