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

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

Going through a list using the minibuffer


From: arvid-harnack
Subject: Going through a list using the minibuffer
Date: Sun, 13 Jun 2021 18:02:23 +0200 (CEST)

Hi Yuri,



Using the command you described, how can I get tho selection into a variable

named "sel" ?



(completing-read "Choose a Greek letter: " '("alpha" "beta" "gamma") nil t)



Is like this good?



  (let* ( (gkser '("alpha" "beta" "gamma"))
     (gksel (completing-read
         "Choose a Greek letter: " gkser nil t)))
    (message "gksel %s" gksel))



Regards


From: Yuri Khan <yuri.v.khan@gmail.com>
To: arvid-harnack@lavache.com
Subject: Re: Going through a list using the minibuffer
Date: 13/06/2021 17:09:45 Europe/Paris
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>;
   Emanuel Berg <moasenwood@zoho.eu>

On Sun, 13 Jun 2021 at 20:55, <arvid-harnack@lavache.com> wrote:

> Suppose I define a list namely '("alpha" "beta" "gamma")
>
> I would like to get the minibuffer to show me the options one by
> one as the down and up arrow keys are pressed. Then in my
> function I get the equivalent position "k" of the string in the
> list.

You basically want ‘(completing-read "Choose a Greek letter: "
'("alpha" "beta" "gamma") nil t)’, except that it will give you the
selected option value rather than its index.




reply via email to

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