[OS X Emacs] Keybindings question

David Reitter david.reitter at gmail.com
Mon Nov 10 10:44:42 EST 2008


Ian,

On 8 Nov 2008, at 16:07, Ian Eure wrote:

> As I've been using Aquamacs, if I wanted to define a global binding,  
> I've been setting it in osx-key-mode-map. However, I want to make my  
> customizations less dependent on any specific emacs. So I changed  
> these to use (define-key (current-global-map)), and now they don't  
> work when there is a local binding for that key in a mode.
>
> For example, I have C-c C-d bound to a custom function, but in php- 
> mode, this is bound to c-hungry-delete-forward. This no longer works  
> when I use (current-global-map). I tried turning off osx-key-mode,  
> but that didn't change anything, either.
>
> How can I get the old behavior without using osx-key-mode-map?


define your own minor mode, like `ians-keys-mode', using `define-minor- 
mode'.  Use your own keymap variable, `ians-bindings, `ians-keys-mode- 
keys', and use that as the mode keymap.

Major mode bindings override the global ones, and minor mode bindings  
override everything else, if I remember correctly.  My `osx-key-mode'  
goes out of its way to define a "low-priority keymap" in addition to  
the normal, high-priority minor mode keymap.

Your problem points out a general design flaw in Emacs: key bindings  
don't have priorities.  I'm cc'ing Stefan Monnier who, I believe,  
wanted key priorities to be put on the "to do" list some 1-2 years ago  
when I pointed out this issue.  I think it's too late to introduce  
such changes in Emacs 23, but perhaps this can be supported in Emacs 24.

- David

--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and  
support the Aquamacs Project!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2193 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20081110/d8004134/attachment.p7s>


More information about the MacOSX-Emacs mailing list