自动补全功能在任何时候都是受欢迎的,Emacs提供了一个基本的函数completing-read,可以在接受用户输入时提供补全功能。除此之外,我们还可以使用一些更加强大的函数,比如ido里面的ido-completing-read,或者使用iswitchb提供的功能。
使用ido-completing-read比较简单,参见psvn.el。而iswitchb并没有提供一个类似的函数,所以必须自己写一个。
(defun wl-completing-read (prompt choices dummy require-match)
"Use iswitchb completion functionality."
(let ((iswitchb-make-buflist-hook
(lambda ()
(setq iswitchb-temp-buflist choices))))
(iswitchb-read-buffer prompt nil require-match)))
(defvar wl-completing-read-function
(if (fboundp 'iswitchb-read-buffer) 'wl-completing-read 'completing-read))
在引入wl-completing-read-function变量之后,要使用funcall来调用它,而不是直接进行函数调用。
(funcall wl-completing-read-function prompt choice nil t)





