我已经使用偶像模式几个月了,偶尔到处都是偶像,我一般都很满意.但是,我希望我能改变一件事.当我键入C-u M-x shell以创建具有特定名称的新shell缓冲区时,ido为我提供了所有打开缓冲区的完成列表.如果我选择一个,则在该缓冲区中启动一个新的shell,无论它包含什么,它都会被置于shell模式.很难想象一个有用的用例.
有没有办法只为shell命令停用ido-mode?(当然,除了我将来偶然发现的任何其他类似命令.)
嘿,事实证明,无论你是否ido-everywhere启用,你都会获得相同的完成选择.
没有内置的方法来做你想要的. ido-mode只提供钩子,以便能够覆盖find-file行为是否被接管ido.在read-buffer目前一直通过覆盖ido-everywhere.
幸运的是,一点点Emacs lisp可以得到你想要的东西:
(put 'shell 'ido 'ignore)
(defadvice ido-read-buffer (around ido-read-buffer-possibly-ignore activate)
"Check to see if use wanted to avoid using ido"
(if (eq (get this-command 'ido) 'ignore)
(let ((read-buffer-function nil))
(run-hook-with-args 'ido-before-fallback-functions 'read-buffer)
(setq ad-return-value (apply 'read-buffer (ad-get-args 0))))
ad-do-it))
Run Code Online (Sandbox Code Playgroud)
对于任何其他命令,您不希望跟随ido-everywhere缓冲区选择,只需在.emacs中添加一个新表达式即可自定义:
(put 'other-command-i-want-untouched 'ido 'ignore)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
936 次 |
| 最近记录: |