7

私は数ヶ月間ido-modeを使用していて、ido-everywhereがオンになっていて、一般的にかなり満足しています。ただし、変更したいことが1つあります。C-u M-x shell特定の名前で新しいシェルバッファーを作成するために入力すると、idoは開いているすべてのバッファーの完全なリストを提供します。いずれかを選択すると、そのバッファーで新しいシェルが起動され、含まれているものに関係なく、シェルモードになります。このための有用なユースケースを想像するのは難しいです。

シェルコマンドに対してのみido-modeを非アクティブ化する方法はありますか?(もちろん、他の同様のコマンドと同様に、将来遭遇する可能性があります。)

4

1 に答える 1

5

Heh, it turns out you'll get the same completion choices whether or not you have ido-everywhere enabled.

There's no built-in way to do what you want. ido-mode only provides hooks for you to be able to override whether or not the find-file behavior is taken over by ido or not. The read-buffer is currently always overridden by ido-everywhere.

Luckily, a little Emacs lisp can get what you want:

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

And for any other command you don't want following ido-everywhere for buffer selection can be customized by simply adding a new expression to your .emacs:

(put 'other-command-i-want-untouched 'ido 'ignore)
于 2011-07-21T15:11:34.580 に答える