diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-10-18 17:03:15 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-10-18 17:54:35 +0200 |
commit | ccfb9d44de0a2c4e2dd75f4eb515779c636aaad4 (patch) | |
tree | 6c6c460b838c34501f3a625a8387f663361f0432 | |
parent | 9d4af29febb6b80806ee205f4afebd2fbecdef0f (diff) | |
download | org-mode-ccfb9d44de0a2c4e2dd75f4eb515779c636aaad4.tar.gz |
org-pcomplete: Complete drawer names
* lisp/org-pcomplete.el (pcomplete/org-mode/drawer): New function.
-rw-r--r-- | lisp/org-pcomplete.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index a258994..9f4cd11 100644 --- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -351,6 +351,23 @@ This needs more work, to handle headings with lots of spaces in them." (and (string-match ".*:" pcomplete-stub) (substring pcomplete-stub (match-end 0)))))) +(defun pcomplete/org-mode/drawer () + "Complete a drawer name, including \"PROPERTIES\"." + (pcomplete-here + (org-pcomplete-case-double + (mapcar (lambda (x) (concat x ":")) + (let ((names (list "PROPERTIES"))) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-drawer-regexp nil t) + (let ((drawer (org-element-at-point))) + (when (memq (org-element-type drawer) + '(drawer property-drawer)) + (push (org-element-property :drawer-name drawer) names) + (goto-char (org-element-property :end drawer)))))) + (pcomplete-uniquify-list names)))) + (substring pcomplete-stub 1))) ;remove initial colon + (defun pcomplete/org-mode/prop () "Complete a property name. Omit properties already set." (pcomplete-here |