[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preventing modes overriding global keys
From: |
Kevin Rodgers |
Subject: |
Re: Preventing modes overriding global keys |
Date: |
Tue, 14 Jun 2005 12:07:44 -0600 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041105) |
Ian Crowther wrote:
> I'm trying to make emacs bind end-of-line to the tab key in all modes.
> Doing:
>
> (global-set-key (kbd "TAB") 'end-of-line)
>
> doesn't have any effect. "C-h k <TAB>" shows:
> TAB runs the command lisp-indent-line
>
> I assume my parameters to global-set-key are correct, as local-set-key
> works. It looks like the lisp mode is defining the tab key. If I
> evaluate "(lisp-mode)" then my binding made with local-set-key is
> disabled.
>
> Is there a way to override the mode settings for the tab key?
Yes. But you'll have to change the binding for each mode you use:
(add-hook 'lisp-mode-hook
(lambda () (local-set-key (kbd "TAB") 'end-of-line)))
> Or a way to prevent modes overriding certain keys in the first place?
You might be able to fudge it by using key-translation-map to generate a
user-defined function key from (kbd "TAB") that you would map globally to
end-of-line.
--
Kevin Rodgers