ido-ignore-buffers
变量指向的列表可能不仅包含正则表达式,还包含函数(实际上是它们的任何组合)。提供一个过滤掉所有非用户缓冲区的函数很容易,除了*ielm*
:
(defun ido-ignore-non-user-except-ielm (name)
"Ignore all non-user (a.k.a. *starred*) buffers except *ielm*."
(and (string-match "^\*" name)
(not (string= name "*ielm*"))))
(setq ido-ignore-buffers '("\\` " ido-ignore-non-user-except-ielm))
这是一个具有多个未忽略缓冲区名称的示例:
(setq my-unignored-buffers '("*ielm*" "*scratch*" "*foo*" "*bar*"))
(defun my-ido-ignore-func (name)
"Ignore all non-user (a.k.a. *starred*) buffers except those listed in `my-unignored-buffers'."
(and (string-match "^\*" name)
(not (member name my-unignored-buffers))))
(setq ido-ignore-buffers '("\\` " my-ido-ignore-func))
在源代码的注释中可以找到一个使用忽略函数的有趣示例ido.el
(我已;;
在每一行的开头删除):
(defun ido-ignore-c-mode (name)
"Ignore all c mode buffers -- example function for ido."
(with-current-buffer name
(derived-mode-p 'c-mode)))
基本上,一旦你有了缓冲区名称,你就可以做任何你想做的检查/忽略。