From 3d7f2d63f594b047c417cbacc23b84e09798cf2c Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Mon, 21 Mar 2016 20:18:23 -0500 Subject: Handle non-tag org completion prompts helm-mode.el: Add handler for org-capture helm-org.el: Do it. --- helm-org.el | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'helm-org.el') 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 -- cgit v1.2.3