unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Embedded list selection with ido-completing-read.
@ 2021-10-23  7:33 Hongyi Zhao
  2021-10-23  8:43 ` Hongyi Zhao
  0 siblings, 1 reply; 33+ messages in thread
From: Hongyi Zhao @ 2021-10-23  7:33 UTC (permalink / raw)
  To: help-gnu-emacs

I've written the following code snippet:

(require 'ido)
(defun ATOMIC_POSITIONS ()
  (interactive)
  (let ((prog '("neb" "pw" "cp")))
    (cond
     ((or (equal (ido-completing-read "prog: " prog) "neb")
      (equal (ido-completing-read "prog: " prog) "pw"))
      (let ((flag '("alat" "bohr" "angstrom" "crystal" "crystal_sg")))
    (insert "ATOMIC_POSITIONS " (ido-completing-read "flag: " flag)))
      )
     ((equal (ido-completing-read "prog: " prog) "cp")
      (let ((flag '("alat" "bohr" "angstrom" "crystal")))
    (insert "ATOMIC_POSITIONS " (ido-completing-read "flag: " flag)))
      )
     ))

  (newline 1))


The purpose is do the following:

If the user selects "neb" or "pw", then insert one entry coming from
'("alat" "bohr" "angstrom" "crystal" "crystal_sg").

If the user selects "cp", then insert one entry coming from '("alat"
"bohr" "angstrom" "crystal").


But based on tries, the above code snippet only works for selection of
"neb", while for the other two selections, sometimes it works,
sometimes it doesn’t output results.

Any hints for this problem?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2021-10-26 22:14 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23  7:33 Embedded list selection with ido-completing-read Hongyi Zhao
2021-10-23  8:43 ` Hongyi Zhao
2021-10-23 19:29   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24  0:28     ` Hongyi Zhao
2021-10-24  1:16       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24  2:28         ` Hongyi Zhao
2021-10-24  3:11           ` Hongyi Zhao
2021-10-24  3:21             ` Hongyi Zhao
2021-10-24  5:37           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24  5:36         ` Hongyi Zhao
2021-10-24  5:43           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24  6:57             ` Hongyi Zhao
2021-10-24  7:00               ` Hongyi Zhao
2021-10-24  9:42               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24 15:05                 ` Hongyi Zhao
2021-10-24 15:12                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24 15:18                     ` Hongyi Zhao
2021-10-24 15:25                       ` Hongyi Zhao
2021-10-24 17:53                         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24 17:51                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-24 15:21         ` Hongyi Zhao
2021-10-24 16:23           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-26  2:52             ` Hongyi Zhao
2021-10-26  5:19               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-26  8:44                 ` Hongyi Zhao
2021-10-26 11:23                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-26 12:31                     ` Hongyi Zhao
2021-10-26 12:40                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-26 12:55                         ` Hongyi Zhao
2021-10-26 13:04                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-26 14:04                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-26 15:07                     ` Hongyi Zhao
2021-10-26 22:14                       ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).