[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Insert one of the flags automatically with tab completion.
From: |
Hongyi Zhao |
Subject: |
Re: Insert one of the flags automatically with tab completion. |
Date: |
Sun, 24 Oct 2021 22:53:44 +0800 |
On Sun, Oct 24, 2021 at 3:23 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > (defun my-pw-ATOMIC_POSITIONS2 ()
> > (interactive
> > (list
> > (insert "ATOMIC_POSITIONS "
> > (completing-read
> > "Select the flag: "
> > '(("alat" 1)
> > ("bohr" 2)
> > ("angstrom" 3)
> > ("crystal" 4)
> > ("crystal_sg" 5)
> > )
> > nil t ""))))
> > (newline 1))
>
> (defun atomic-position (flag)
> (interactive
> (list
> (completing-read
> "flag: " '("alat" "angstrom" "bohr" "crystal" "crystal_sg") nil t) ))
I can't find the real effect of `nil t` here, so I omitted it:
(defun atomic-position (flag)
(interactive
(list
(completing-read
"flag: " '("alat" "angstrom" "bohr" "crystal" "crystal_sg"))))
(insert (format "Atomic position: %s\n" flag)))
> (insert (format "Atomic position: %s\n" flag)) )
>
> Note that interactive and non-interactive use are not
> identical in one aspect ...
>
> --
> underground experts united
> https://dataswamp.org/~incal
- Insert one of the flags automatically with tab completion., Hongyi Zhao, 2021/10/23
- Re: Insert one of the flags automatically with tab completion., Hongyi Zhao, 2021/10/23
- Re: Insert one of the flags automatically with tab completion., Emanuel Berg, 2021/10/23
- Re: Insert one of the flags automatically with tab completion., Hongyi Zhao, 2021/10/24
- Re: Insert one of the flags automatically with tab completion., Emanuel Berg, 2021/10/24
- Re: Insert one of the flags automatically with tab completion., Hongyi Zhao, 2021/10/25
- Re: Insert one of the flags automatically with tab completion., Emanuel Berg, 2021/10/26
- Re: Insert one of the flags automatically with tab completion., Hongyi Zhao, 2021/10/26
- Re: Insert one of the flags automatically with tab completion.,
Hongyi Zhao <=