首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取ido生成的候选列表

获取ido生成的候选列表
EN

Stack Overflow用户
提问于 2013-10-19 09:06:28
回答 2查看 107关注 0票数 1

是否可以获取列表并将其保存在变量中?我跑步

代码语言:javascript
复制
(ido-completing-read "prompt: " '("one" "two" "three" "four" "five") nil nil "t")

ido生成候选列表{two | three}。我想要这样的东西

代码语言:javascript
复制
(setq my-desired-list (ido-completing-read-silent '("one" "two" "three" "four" "five") nil nil "t"))

执行后my-desired-list的值为("two" "three")。我对ido使用了复杂的设置,它为choices准备了非常特殊的过滤器,我想直接使用结果。

EN

回答 2

Stack Overflow用户

发布于 2013-10-19 14:53:26

变量‘ido-matches’将包含上次调用ido-completing read时的匹配项。所以这就是你想要的:

代码语言:javascript
复制
(defun ido-completing-read-silent (prompt choices initial-input)
  (ido-completing-read prompt choices nil nil initial-input)
  ido-matches)

(ido-completing-read-silent "prompt: " '("one" "two" "three" "four" "five") "t")
;; ("two" "three")
票数 1
EN

Stack Overflow用户

发布于 2013-10-20 20:23:14

代码语言:javascript
复制
(defun ido-completing-read-silent (prompt choices initial-input)
  (run-with-timer 0.0001 nil 'exit-minibuffer)
  (ido-completing-read prompt choices nil nil initial-input)
  (mapcar (lambda (x) (flx-propertize x nil)) ido-matches))

(equal (ido-completing-read-silent "prompt: " '("one" "two" "three" "four" "five") "t")
       '("three" "two"))

该解决方案可以用于其他情况,用于不同的交互功能,如ido-completing-read

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19461171

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档