From: Anders Johansson <mejlaandersj@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Bug? org-set-tags never uses ido
Date: Wed, 02 Apr 2014 19:37:42 +0200 [thread overview]
Message-ID: <533C4AE6.3020002@gmail.com> (raw)
In-Reply-To: <CAJcAo8uZa=Vf+dPzpH3Y+vyda+5r8NQY_mTa+VhuORgpuBduew@mail.gmail.com>
A hack to get ido selection for multiple tags. It uses
ido-completing-read-multiple (available here and included below:
https://gist.github.com/mgalgs/1329188) to allow for completing one tag
at a time and ending it by typing ":".
I haven't tested it much and it might possibly break things (or most
certainly it's implemented in an ugly way). Perhaps someone more than me
will find it useful.
Cheers,
Anders
----
(defadvice org-icompleting-read
(around org-use-ido-for-tags
(prompt coll &optional pred reqm initial hist def)
activate)
"Advised to use ido for multiple completion of tags"
(setq ad-return-value
(if (string= "Tags: " prompt)
(mapconcat 'identity
(ido-completing-read-multiple
prompt
(mapcan
'copy-list org-last-tags-completion-table)
pred reqm initial hist def ":")
":")
ad-do-it)))
(defun ido-completing-read-multiple (prompt choices &optional predicate
require-match initial-input hist def sentinel)
"Read multiple items with ido-completing-read. Reading stops
when the user enters SENTINEL. By default, SENTINEL is
\"*done*\". SENTINEL is disambiguated with clashing completions
by appending _ to SENTINEL until it becomes unique. So if there
are multiple values that look like SENTINEL, the one with the
most _ at the end is the actual sentinel value. See
documentation for `ido-completing-read' for details on the
other parameters."
(let
((sentinel (if sentinel sentinel "*done*"))
(done-reading nil)
(res ()))
;; uniquify the SENTINEL value
(while (find sentinel choices)
(setq sentinel (concat sentinel "_")))
(setq choices (cons sentinel choices))
;; read some choices
(while (not done-reading)
(setq this-choice (ido-completing-read prompt choices predicate
require-match initial-input hist def))
(if (equal this-choice sentinel)
(setq done-reading t)
(setq res (cons this-choice res))))
;; return the result
res
))
----
prev parent reply other threads:[~2014-04-02 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 16:39 Bug? org-set-tags never uses ido Anders Johansson
2013-11-01 1:33 ` Eric Abrahamsen
2014-03-04 22:22 ` Anders Johansson
2014-03-05 0:20 ` Samuel Wales
2014-03-05 0:31 ` Anders Johansson
2014-03-05 0:47 ` Samuel Wales
2014-03-05 1:49 ` Eric Abrahamsen
2014-04-02 17:37 ` Anders Johansson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=533C4AE6.3020002@gmail.com \
--to=mejlaandersj@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.