summaryrefslogtreecommitdiff
path: root/helm-org.el
diff options
context:
space:
mode:
authorAdam Porter <adam@alphapapa.net>2016-03-21 20:18:23 -0500
committerAdam Porter <adam@alphapapa.net>2016-03-21 20:26:29 -0500
commit3d7f2d63f594b047c417cbacc23b84e09798cf2c (patch)
treea876d6ef773da161baf9d6241ea5d1914b4adea8 /helm-org.el
parent28dc5ea92f02eb663c3c5d5c10b5f3b2482fa494 (diff)
Handle non-tag org completion prompts
helm-mode.el: Add handler for org-capture helm-org.el: Do it.
Diffstat (limited to 'helm-org.el')
-rw-r--r--helm-org.el51
1 files changed, 30 insertions, 21 deletions
diff --git a/helm-org.el b/helm-org.el
index bd3590f8..234e96fc 100644
--- a/helm-org.el
+++ b/helm-org.el
@@ -282,27 +282,36 @@ current heading."
;; if its name starts with "helm"?! If its name starts with anything
;; else, it works fine!
(defun not-helm-org-completing-read-tags (prompt coll pred req initial hist def inh)
- (let* ((initial (and (stringp initial)
- (not (string= initial ""))
- initial))
- (curr (when initial
- (org-split-string initial ":")))
- (table (org-uniquify (mapcar 'car org-last-tags-completion-table)))
- (table (if curr
- ;; Remove current tags from list
- (cl-delete-if (lambda (x)
- (member x curr))
- table)
- table))
- (prompt (if initial
- (concat "Tags " initial)
- prompt)))
- (concat initial
- (mapconcat 'identity
- (nreverse (helm-org-completing-read-multiple
- prompt table pred nil nil hist def
- t "Org tags" "*Helm org tags*" ":"))
- ":"))))
+ (if (not (string= "Tags: " prompt))
+ ;; Not a tags prompt. Use normal completion by calling
+ ;; `org-icompleting-read' again without this function in
+ ;; `helm-completing-read-handlers-alist'
+ (let ((helm-completing-read-handlers-alist (rassq-delete-all
+ 'not-helm-org-completing-read-tags
+ helm-completing-read-handlers-alist)))
+ (org-icompleting-read prompt coll pred req initial hist def inh))
+ ;; Tags prompt
+ (let* ((initial (and (stringp initial)
+ (not (string= initial ""))
+ initial))
+ (curr (when initial
+ (org-split-string initial ":")))
+ (table (org-uniquify
+ (mapcar 'car org-last-tags-completion-table)))
+ (table (if curr
+ ;; Remove current tags from list
+ (cl-delete-if (lambda (x)
+ (member x curr))
+ table)
+ table))
+ (prompt (if initial
+ (concat "Tags " initial)
+ prompt)))
+ (concat initial (mapconcat 'identity
+ (nreverse (helm-org-completing-read-multiple
+ prompt table pred nil nil hist def
+ t "Org tags" "*Helm org tags*" ":"))
+ ":")))))
(defun helm-org-completing-read-multiple (prompt choices
&optional predicate require-match initial-input hist def