help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question to completion


From: Ehud Karni
Subject: Re: Question to completion
Date: Sun, 9 Nov 2003 16:36:34 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08 Nov 2003 13:52:06 +0100, Klaus Berndl <klaus.berndl@sdm.de> wrote:
>
> Suppose i have s command like follows:
>
> (defun offer-some-choices ()
>   (interactive)
>   (completing-read "Select a name: " '(("Klaus" . t) ("Berndl" . t))))
>
> Then this displays in the minibuffer "Select a name: " and then wait for input
> from the user.
>
> How can i achieve that always - *without* the user has to hit TAB - the
> possible completions are displayed immediately?

You have 2 choices:
  1. Run the function corresponding to [tab] 3 times (by preloading the
     keyboard buffer or by adding it to `minibuffer-setup-hook'.
     This will make some extra displays and has built in delay.
  2. Defining a simple function to display all possible completions
     and adding it to `minibuffer-setup-hook'.

Here is the function and an example to the 2nd solution:

(defun minibuffer-all-completion ()
       (with-output-to-temp-buffer "*Completions*"
           (display-completion-list (all-completions "" 
minibuffer-completion-table))))

;; An example.
(defun offer-some-choices ()
  (interactive)
       (let* ((minibuffer-setup-hook
                    (append minibuffer-setup-hook 
'(minibuffer-all-completion))))
           (completing-read "Select a name: "
                   '(("Klaus" . t) ("Klaus-2" . t) ("Klaus-3" . t)))
           ))

Ehud.


- --
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE/rlDxLFvTvpjqOY0RAiDLAJ47APX46csdk5+W+vQS093NKS1jpACeIjp3
1oKBBDBs6ICQY2S5ZWl4BPk=
=qqew
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]