|
From: | Emanuel Berg |
Subject: | Re: Insert one of the flags automatically with tab completion. |
Date: | Sat, 23 Oct 2021 21:23:25 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
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) )) (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
[Prev in Thread] | Current Thread | [Next in Thread] |