help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Embedded list selection with ido-completing-read.


From: Hongyi Zhao
Subject: Embedded list selection with ido-completing-read.
Date: Sat, 23 Oct 2021 15:33:16 +0800

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]