[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 20:31:24 +0800 |
On Tue, Oct 26, 2021 at 7:26 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> (defun atomic-position (prog flag)
> (interactive
> (list
> (completing-read "program: " '("cp" "neb" "pw")
> nil t)
> (completing-read "flag: " '("alat" "angstrom" "bohr" "crystal"
> "crystal_sg") nil t) ))
> (let ((pstr (pcase prog
> ((or "neb" "pw") (format "[neb/pw, here %s] %s\n" prog flag))
> ("cp" (format "[%s] %s" prog flag))
> (_ (error "No such program")) )))
> (insert "Atomic Kitten " pstr) ))
Thank you for your wonderful code snippets. But there is a small
problem that makes the above code not meet my requirements, as
described below. In my original but ugly code, it does the following:
(or
(equal prog "neb")
(equal prog "pw"))
flag is chosen from: '("alat" "angstrom" "bohr" "crystal" "crystal_sg")
(equal prog "cp")
flag is chosen from: '("alat" "angstrom" "bohr" "crystal")
And this is why I try to use two flags.
> ;; test:
> ;; (atomic-position "neb" "bohr")
> ;; (call-interactively #'atomic-position)
>
> Now do this:
> https://www.youtube.com/watch?v=uQgB1DdwdMQ
>
> And read this post again ... and sloowly this time!
>
> --
> underground experts united
> https://dataswamp.org/~incal
- Re: Embedded list selection with ido-completing-read., (continued)
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/24
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/24
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/24
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/25
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/26
- Re: Embedded list selection with ido-completing-read.,
Hongyi Zhao <=
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/26
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/26