* Any standard function to prompt for multiple comma-separated items?
@ 2002-11-15 19:17 Peter S Galbraith
0 siblings, 0 replies; 9+ messages in thread
From: Peter S Galbraith @ 2002-11-15 19:17 UTC (permalink / raw)
Hello,
For MH-E, I'm looking for code already available in Emacs to do
completing-read for multiple comma-separated items. e.g.
To: p.gal[TAB]
->
To: p.galbraith
->
To: p.galbraith, psg[TAB]
->
To: p.galbraith, psg@home
Does anyone now of such code already existing?
There's multi-prompt.el bundled with AUC-TeX that comes close (doesn't
allow whitespace after the field separator), but I need something I can
use in MH-E without external packages.
Thanks,
--
Peter S. Galbraith, MH-E developer <p.galbraith@globetrotter.net>
GPG key 1024/D2A913A1 - 97CE 866F F579 96EE 6E68 8170 35FF 799E
6623'rd GNU/Linux user at the Counter - http://counter.li.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.1037389349.31174.help-gnu-emacs@gnu.org>]
* Re: Any standard function to prompt for multiple comma-separated items?
[not found] <mailman.1037389349.31174.help-gnu-emacs@gnu.org>
@ 2002-11-16 18:55 ` Kai Großjohann
2002-11-17 14:03 ` Peter S Galbraith
[not found] ` <mailman.1037542582.16549.help-gnu-emacs@gnu.org>
2002-11-17 9:27 ` Klaus Berndl
2002-11-17 16:39 ` Kai Großjohann
2 siblings, 2 replies; 9+ messages in thread
From: Kai Großjohann @ 2002-11-16 18:55 UTC (permalink / raw)
Peter S Galbraith <p.galbraith@globetrotter.net> writes:
> For MH-E, I'm looking for code already available in Emacs to do
> completing-read for multiple comma-separated items.
I think Gnus just has people hit RET after each item. Entering an
empty item terminates the sequence. (Gnus has the same problem for
the Newsgroups header.)
Does this help?
kai
--
~/.signature is: umop ap!sdn (Frank Nobis)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Any standard function to prompt for multiple comma-separated items?
[not found] <mailman.1037389349.31174.help-gnu-emacs@gnu.org>
2002-11-16 18:55 ` Kai Großjohann
@ 2002-11-17 9:27 ` Klaus Berndl
[not found] ` <Klaus.Berndl@sdm.de>
2002-11-17 16:39 ` Kai Großjohann
2 siblings, 1 reply; 9+ messages in thread
From: Klaus Berndl @ 2002-11-17 9:27 UTC (permalink / raw)
On Fri, 15 Nov 2002, Peter S. Galbraith wrote:
> Hello,
>
> For MH-E, I'm looking for code already available in Emacs to do
> completing-read for multiple comma-separated items. e.g.
>
> To: p.gal[TAB]
> ->
> To: p.galbraith
> ->
> To: p.galbraith, psg[TAB]
> ->
> To: p.galbraith, psg@home
>
> Does anyone now of such code already existing?
>
> There's multi-prompt.el bundled with AUC-TeX that comes close (doesn't
> allow whitespace after the field separator), but I need something I can
> use in MH-E without external packages.
Hmm, i do not know if i understand your problem in the right way...Do you want
this completion in the minibuffer or is it more like dabbrev-completion in a
"normal" buffer?
Even more: What should be the domain of the completion, i.e. the set of
allowed completions??
If you are searching for something in the minibuffer, here is a function:
,----
| ;; stolen from query.el and slightly enhanced
| (defun ecb-query-string (prompt choices &optional other-prompt)
| "Prints PROMPT and returns a string which must be one of CHOICES.
| CHOICES is either a list of strings whereas the first choice is the default
| \(which is returned if the user simply types RET) or nil \(then only a simple
| RET quits the query and returns nil). If OTHER-PROMPT is not nil and a string
| then the choice \"other\" is added to CHOICES and after selecting this choice
| the user is prompted with OTHER-PROMPT to insert any arbitrary string."
| (let* ((new-choices (if other-prompt
| (add-to-list 'choices "other" t)
| choices))
| (default (car new-choices))
| answer)
| (setq prompt (concat prompt
| " ["
| (if new-choices
| (mapconcat (function (lambda (x) x))
| new-choices ", ")
| "RET")
| "] "))
| (setq new-choices (nconc (mapcar (function (lambda (x) (list x t)))
| new-choices)
| '('("" t))))
| (setq answer (completing-read prompt new-choices nil t ""))
| (cond ((string= answer "")
| (setq answer default))
| ((string= answer "other")
| (setq answer (read-string (concat other-prompt ": ")))))
| answer))
`----
Klaus
--
Klaus Berndl mailto: klaus.berndl@sdm.de
sd&m AG http://www.sdm.de
software design & management
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Any standard function to prompt for multiple comma-separated items?
[not found] <mailman.1037389349.31174.help-gnu-emacs@gnu.org>
2002-11-16 18:55 ` Kai Großjohann
2002-11-17 9:27 ` Klaus Berndl
@ 2002-11-17 16:39 ` Kai Großjohann
2002-11-18 15:53 ` Stefan Monnier <foo@acm.com>
2 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2002-11-17 16:39 UTC (permalink / raw)
Peter S Galbraith <p.galbraith@globetrotter.net> writes:
> For MH-E, I'm looking for code already available in Emacs to do
> completing-read for multiple comma-separated items. e.g.
The documentation for completing-read mentions that TABLE can also be
a function `that does the completion itself'. Alas, I couldn't find
any more info.
But maybe you could write a dummy function that invokes debug, then
you can see which arguments are passed to the function.
kai
--
~/.signature is: umop ap!sdn (Frank Nobis)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Any standard function to prompt for multiple comma-separated items?
2002-11-17 16:39 ` Kai Großjohann
@ 2002-11-18 15:53 ` Stefan Monnier <foo@acm.com>
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-11-18 15:53 UTC (permalink / raw)
>>>>> "Kai" == Kai Großjohann <kai.grossjohann@uni-duisburg.de> writes:
> The documentation for completing-read mentions that TABLE can also be
> a function `that does the completion itself'. Alas, I couldn't find
> any more info.
There's more info in the docstring of all-completions, try-completion,
and test-completion (you might not have this last one yet).
And there might also be more info in the elisp manual, of course.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2002-11-18 18:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-15 19:17 Any standard function to prompt for multiple comma-separated items? Peter S Galbraith
[not found] <mailman.1037389349.31174.help-gnu-emacs@gnu.org>
2002-11-16 18:55 ` Kai Großjohann
2002-11-17 14:03 ` Peter S Galbraith
[not found] ` <mailman.1037542582.16549.help-gnu-emacs@gnu.org>
2002-11-18 15:52 ` Stefan Monnier <foo@acm.com>
[not found] ` <foo@acm.com>
[not found] ` <monnier+gnu.emacs.help/news/@flint.cs.yale.edu>
2002-11-18 18:23 ` Peter S Galbraith
2002-11-17 9:27 ` Klaus Berndl
[not found] ` <Klaus.Berndl@sdm.de>
2002-11-17 14:08 ` Peter S Galbraith
2002-11-17 16:39 ` Kai Großjohann
2002-11-18 15:53 ` Stefan Monnier <foo@acm.com>
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.