Adding a simple test to the previous patch: --8<---------------cut here---------------start------------->8--- >From cae6b5596f69968003c053f53cb45ffb4139a5ad Mon Sep 17 00:00:00 2001 From: Nick Dokos <ndo...@gmail.com> Date: Mon, 6 Jul 2020 21:07:01 -0400 Subject: [PATCH] org: add property names from #+PROPERTY keywords to completion list
* lisp/org.el (org-buffer-property-keys): ehhance the completion list with property names from #+PROPERTY keywords, not just property drawers. See https://emacs.stackexchange.com/questions/59448/ for details. --- lisp/org.el | 5 +++++ testing/lisp/test-org.el | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index 748c058ca..0e83162e8 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13084,6 +13084,11 @@ 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) + (let ((split (split-string s))) + (nth 0 split))) + (cdar (org-collect-keywords '("PROPERTY")))) nil))) (org-with-wide-buffer (goto-char (point-min)) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 3c563f344..ddda96105 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -5352,6 +5352,11 @@ Paragraph<point>" (equal '("A") (org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:A+: 2\n:END:" (org-buffer-property-keys)))) + ;; Retrieve properties from #+PROPERTY keyword lines + (should + (equal '("A" "C") + (org-test-with-temp-text "#+PROPERTY: C foo\n* H\n:PROPERTIES:\n:A: 1\n:A+: 2\n:END:" + (org-buffer-property-keys)))) ;; With non-nil COLUMNS, extract property names from columns. (should (equal '("A" "B") -- 2.25.4 --8<---------------cut here---------------end--------------->8--- -- Nick "There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors." -Martin Fowler