all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Question to completion
Date: Sun, 9 Nov 2003 16:36:34 +0200	[thread overview]
Message-ID: <200311091436.hA9EaY3X015315@beta.mvs.co.il> (raw)
In-Reply-To: <usmkzvx8p.fsf@sdm.de> (message from Klaus Berndl on 08 Nov 2003 13:52:06 +0100)

-----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-----

  parent reply	other threads:[~2003-11-09 14:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-08 12:52 Question to completion Klaus Berndl
2003-11-08 14:14 ` Klaus Berndl
2003-11-09 14:36 ` Ehud Karni [this message]
     [not found] ` <mailman.73.1068392321.2005.help-gnu-emacs@gnu.org>
2003-11-09 17:21   ` Klaus Berndl
2003-11-10 16:20   ` Stefan Monnier
2003-11-09 19:04 ` jan

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=200311091436.hA9EaY3X015315@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --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.
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.