1

リストを取得して変数に保存することはできますか? 走る

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

そして ido は候補のリストを生成します{two | three}。私はこのようなものが欲しい

(setq my-desired-list (ido-completing-read-silent '("one" "two" "three" "four" "five") nil nil "t"))

my-desired-list実行後の値は です("two" "three")。私は ido に複雑な設定を使用しています。非常に特殊なフィルターを用意してchoicesおり、その結果を直接使用したいと考えています。

4

2 に答える 2

1
(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

于 2013-10-20T12:23:13.930 に答える
1

変数「ido-matches」には、ido-completing-read への最後の呼び出しから一致した項目が含まれます。したがって、これはあなたが望むことを行います:

(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")
于 2013-10-19T06:53:25.753 に答える