From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Embedded list selection with ido-completing-read. Date: Sat, 23 Oct 2021 15:33:16 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40766"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 23 09:47:32 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1meBka-000ASc-FM for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 09:47:32 +0200 Original-Received: from localhost ([::1]:48706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meBkZ-0006g8-Dc for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 03:47:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meBX1-0007Mt-LT for help-gnu-emacs@gnu.org; Sat, 23 Oct 2021 03:33:31 -0400 Original-Received: from mail-ua1-x935.google.com ([2607:f8b0:4864:20::935]:33653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meBWz-0004zl-QP for help-gnu-emacs@gnu.org; Sat, 23 Oct 2021 03:33:31 -0400 Original-Received: by mail-ua1-x935.google.com with SMTP id o12so7886790uap.0 for ; Sat, 23 Oct 2021 00:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=YFjzxiFhCsA0KXdvrg8Z5ujwMnnjGJ8yi7WiY0mh6mM=; b=FGifg1CU8sYs7AN8Cv5giUYbyVCgNV6VzbzldjTkGSa/Zxor51vY67/WwJVUhYKs1W U91GUTwNL7B8Ji7fPJQRNogs+QAv71s6nEPt+qKu+rz97Kr7317Aowy7UKP5KWJYDAW/ cnsrrWmeKanzmquTxpKajlDB/Zq5+cfIU79rXmY9G4rTd1L/hcbXN5iSbRP3RhowxAtE 9NZlIG89lPjhySQIrz0nlbk776vMk3Cb1pHZd+hXYiyX1XEAZ+8pSVpBE/65SDFGmTmZ otD1RKLoZYL/rn2ADCOf7ByfrYTASyW9KAOwD1zdGcX9G5YeA550rJEg3Y7e/33LsfxX FuJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=YFjzxiFhCsA0KXdvrg8Z5ujwMnnjGJ8yi7WiY0mh6mM=; b=i9u4rzOt68Od9PnFWn2MlV17Q5w+rbrzx33OpuSvoKlWUfpArNBurd8VjrzrD1fjNb O0YAyKbUB9VrACNbHs3RLqpnWyyyeM527x6R7bKQmOME6FInSYh/kMa+XWAQX89ge6Rp Smkj14Hh0m9v9FL5s+sxYPu/1GsKXLW+4Itr42bVo/9tmjxG8Elw+GEcSiJkVtFzYYZ5 OIhcdIAlgRL5hkuqHm0jBVJWfaJrQaUWZbd5YJNnwDYco2lIYMFRVBgA9LYRnsFLt6YZ dvIV7JC3j1LsPYpg2dgUyWInHW2Rn9YDoMMCPyNoY2mYYvUi1STaarHSdVOlVkQOOML+ fFwg== X-Gm-Message-State: AOAM530yl+Okf4Fm5Yc28S65+rnprdvBMqx9kiSWGmH2U/d9Bpk008c/ M4PjjuAsUyBux9IfuHO3a+8XbCAWh6/0wzb2hsq99cA+p7zSb2rb X-Google-Smtp-Source: ABdhPJx7dkQfJrpLNTCO+SM0nRg5O8InGzUjveQjCRy/4kxKWdWEhHBVWjmychdIqfg5BfgfSC8XM/p8zPM1B6QwLiY= X-Received: by 2002:a67:a60c:: with SMTP id p12mr5315919vse.25.1634974407312; Sat, 23 Oct 2021 00:33:27 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::935; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x935.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_20=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134035 Archived-At: 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=E2=80=99t output results. Any hints for this problem? Regards --=20 Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province