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

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

Re: Embedded list selection with ido-completing-read.


From: Emanuel Berg
Subject: Re: Embedded list selection with ido-completing-read.
Date: Tue, 26 Oct 2021 07:19:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hongyi Zhao wrote:

> But the formal parameter isn't used in the `interactive'
> part of your code:

The order if there are many. If therer are parameters
A B C then the interactive form should read (a b c) and
parameter A will be assigned a and so on ...

> (defun atomic-position (flag)
>   (interactive
>    (list
>     (completing-read "flag: " '("alat" "angstrom" "bohr" "crystal"
> "crystal_sg") nil t)))
>   (insert (format "Atomic position: %s\n" flag)))
>
> This makes it difficult for me to adapt the above code to
> a multi-parameter situation.
>
>> > (defun ATOMIC_POSITIONS ()
>> >   (interactive
>> >    (let* ((prog '("neb" "pw" "cp"))
>> >       (prog-read (completing-read "prog: " prog))
>> >       )
>> >
>> >      (cond ((or (equal prog-read "neb")
>> >         (equal prog-read "pw"))
>> >         (insert "ATOMIC_POSITIONS "
>> >             (completing-read "flag: "
>> >                      '("alat" "bohr" "angstrom" "crystal" "crystal_sg"))))
>> >        ((equal prog-read "cp")
>> >         (insert "ATOMIC_POSITIONS "
>> >             (completing-read "flag: "
>> >                      '("alat" "bohr" "angstrom" "crystal")))))
>> >      ))
>> >   (newline 1))

(list (completing-read ... )
      (completing-read ... )
      ;; as many you like/have said should be there )

Remove everything that isn't doing the list. Then see if and
in what state you get a list by evaluating the
interactive form.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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