From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Using ido-completions in other packages
Date: Fri, 04 Jun 2010 12:57:18 +0200 [thread overview]
Message-ID: <87hbljqd4h.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: m1iq5zywaq.fsf@67-159.eduroam.rwth-aachen.de
Andrea Crotti <andrea.crotti.0@gmail.com> writes:
Hi Andrea,
> I've looked in the code but I don't see what I could substitute, maybe
> substituting some functions or advising something else would do the
> trick?
Basically, if you want to use ido-completion in some code, you would use
`ido-comleting-read' instead of `completing-read'. For example, in some
home-brewn mode I have something like that:
--8<---------------cut here---------------start------------->8---
(if (and (featurep 'ido) ido-mode)
;; ido is available and enabled, so use it.
(ido-completing-read "Command: " commands)
;; fallback to normal completion with the
;; most frequently used command as default.
(completing-read
(concat "Command (defaults to `"
(car commands) "'): ")
commands
nil t nil nil (car commands)))
--8<---------------cut here---------------end--------------->8---
You could try to make `completing-read' point to `ido-completing-read':
(fset 'completing-read 'ido-completing-read)
But that might error in some cases, cause `completing-read' has one
optional parameter more than `ido-completing-read'. You might want to
create a function `andrea-completing-read' with the exact signature of
`completing-read' which just delegates to `ido-completing-read' and
throws away the additional parameter, and then do
(fset 'completing-read 'andrea-completing-read)
In any case: This method is a hammer, so be warned. ;-)
Bye,
Tassilo
next prev parent reply other threads:[~2010-06-04 10:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 9:35 Using ido-completions in other packages Andrea Crotti
2010-06-04 10:57 ` Tassilo Horn [this message]
2010-06-04 12:06 ` Štěpán Němec
2010-06-04 12:12 ` Andrea Crotti
2010-06-04 13:14 ` Thierry Volpiatto
2010-06-04 14:41 ` Andrea Crotti
2010-06-04 15:15 ` Thierry Volpiatto
2010-06-05 14:15 ` Andrea Crotti
2010-06-08 4:39 ` William Xu
2010-08-16 9:27 ` Andrea Crotti
2010-08-16 11:07 ` Richard Riley
2010-08-17 21:49 ` Andrea Crotti
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hbljqd4h.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).