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: Hongyi Zhao
Subject: Re: Embedded list selection with ido-completing-read.
Date: Tue, 26 Oct 2021 23:07:25 +0800

On Tue, Oct 26, 2021 at 10:05 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > I tried for some time and got the following code snippet,
> > but it doesn't seem to be able to complete the work
> > discussed here by the original code snippet:
> >
> > (defun atomic-position (prog flag1 flag2)
> >   (interactive
> >    (list
> >     (completing-read "prog: " '("neb" "pw" "cp") nil t)
> >     (completing-read "flag1: " '("alat" "angstrom" "bohr" "crystal"
> > "crystal_sg") nil t)
> >     (completing-read "flag2: " '("alat" "angstrom" "bohr" "crystal") nil t)
> >     )
> >    )
> >
> >   (cond ((or (equal prog "neb")
> >          (equal prog "pw"))
> >      (insert (format "Atomic position: %s\n" flag1)))
> >     ((equal prog "cp")
> >      (insert (format "Atomic position: %s\n" flag2)))
> >     ))
>
> Ha, so what's up with all this?

The above code has a problem: only one of the completing-read command
corresponding to flag1 or flag2 should be called in one run, but it
runs both at the same call.

> You fooled me, I admit it ... good one :)

I’m serious and have never done anything flashy.

HZ



reply via email to

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