org mode - Pre-populate property entry menu with items from setup file - Emacs S...
source link: https://emacs.stackexchange.com/questions/59448/pre-populate-property-entry-menu-with-items-from-setup-file/59492#59492
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Pre-populate property entry menu with items from setup file
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
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?
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, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged org-mode or ask your own question.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK