Search code examples
pythonemacskey-bindingsido

ido-switch-buffer can't be bound to <backtab> in python mode of emacs24


When I was using emacs23, I configured ido as below:

(require 'ido)
(ido-mode t)
(global-set-key (quote [backtab]) (quote ido-switch-buffer))
(define-key ido-common-completion-map (quote [backtab]) 'ido-next-match)
(define-key ido-common-completion-map (kbd "<C-S-iso-lefttab>") 'ido-prev-match)

But when I upgrade to emacs24, I found that the backtab in .py is bound to python-indent-dedent-line, so ido-switch-buffer can't be executed.

What should I do?


Solution

  • You can bind it in the python-mode-map since it takes priority over the global map in python buffers. And, similarly, minor mode maps would take higher priority than both.

    (define-key python-mode-map (kbd "<backtab>") 'ido-switch-buffer)