emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org: add property names from #+PROPERTY keywords to completion list
@ 2020-07-07  2:01 Nick Dokos
  2020-07-07  2:40 ` Nick Dokos
  2020-07-07  4:23 ` Kyle Meyer
  0 siblings, 2 replies; 11+ messages in thread
From: Nick Dokos @ 2020-07-07  2:01 UTC (permalink / raw)
  To: emacs-orgmode

Here's a patch to enhance the property name completion list with names from
#+PROPERTY keyword lines: at the moment, only property names found in property
drawers are used to populate the completion list.

Keith Pinson posted the question on Emacs SE:

    https://emacs.stackexchange.com/questions/59448/

Please let me know if the patch looks reasonable. If it does, I should
probably add a test.

Thanks!

--8<---------------cut here---------------start------------->8---
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 +++++
 1 file changed, 5 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))
-- 
2.25.1
--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



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-07-09  7:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07  2:01 [PATCH] org: add property names from #+PROPERTY keywords to completion list Nick Dokos
2020-07-07  2:40 ` Nick Dokos
2020-07-07  4:23 ` Kyle Meyer
2020-07-07 12:44   ` Nick Dokos
2020-07-07 13:38   ` Nick Dokos
2020-07-07 16:48   ` Nick Dokos
2020-07-08  3:52     ` Kyle Meyer
2020-07-08 15:47       ` Nick Dokos
2020-07-08 16:07       ` Nick Dokos
2020-07-09  4:36         ` [PATCH] agenda: Fold case when retrieving user-configured effort values Kyle Meyer
2020-07-09  7:50           ` Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).