[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: |
Sun, 24 Oct 2021 13:36:03 +0800 |
On Sun, Oct 24, 2021 at 9:17 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > I still can't figure out how to use your suggestions above
> > to further simplify my implementation below:
> >
> > (defun my-pw-ATOMIC_POSITIONS2 ()
> > (interactive
> > (list
> > (insert "ATOMIC_POSITIONS "
> > (completing-read
> > "flag: "
> > '(("alat")
> > ("bohr")
> > ("angstrom")
> > ("crystal")
> > ("crystal_sg")
> > )
> > )))))
>
> Same as I said before ...
>
> 1) Use a formal parameter.
>
> 2) Don't do anything in the `interactive' form except
> get/assign the argument(s).
>
> 3) Test interactively and non-interactively (i.e., from Lisp).
>
> (defun atomic-position (flag)
> (interactive
> (list (completing-read
> "flag: "
> '("alat" "angstrom" "bohr" "crystal" "crystal_sg") )))
> (insert (format "Atomic Kitten: %s" flag) ))
>
> ;; test:
> ;; (call-interactively #'atomic-position)
The following also works:
(call-interactively 'atomic-position)
> ;; (atomic-position "bohr")
>
> --
> underground experts united
> https://dataswamp.org/~incal
- Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Hongyi Zhao, 2021/10/23
- Re: Embedded list selection with ido-completing-read., Emanuel Berg, 2021/10/24
- Re: Embedded list selection with ido-completing-read.,
Hongyi Zhao <=
- 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., 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/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/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., Emanuel Berg, 2021/10/24