[OS X Emacs] How to rebind the

David Reitter david.reitter at gmail.com
Mon Jan 26 10:52:36 EST 2015


On Jan 26, 2015, at 9:41 AM, Steven E.Harris <seh at panix.com> wrote:
> ,----
> | ;; Revert the binding for `recentf-open-files' defined in
> | ;; /Applications/Aquamacs.app/Contents/Resources/lisp/
> |      aquamacs/macosx/aquamacs-menu.el:
> | (eval-after-load "aquamacs-menu"
> |   '(progn
> |      (message "Overriding C-x C-r key binding.")
> |      (define-key (current-global-map) [(control ?x) (control ?r)]
> |        'find-file-read-only)))
> `----
> 
> The "Overriding ..." message gets printed to the *Messages* buffer, and the
> forms before and after this one run with lasting effect, but it seems that
> this call to `define-key' happens but the either some other binding replaces
> mine afterward, or the global key map in place while Preferences.el is
> loading is not the same map that comes into place later.
> 
> Is there some way to figure out what's replacing this binding?


What could be happening is that this key is bound in a keymap that has priority over the “global map” (which was very low priority).
However, Aquamacs binds it in the low-priority global map with global-set-key, as you may have seen yourself.

A function that finds out where something is bound would indeed be quite useful.  Perhaps we can write this some time.

In this case:

(global-set-key "\C-x\ \C-r" nil)

unbinds the key just fine for me.  And this

(global-set-key "\C-x\ \C-r" 'find-file-read-only)

works well, too, at least when executed from my scratch buffer.
 
Can you confirm that the above won’t work from Preferences.el?


--
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!


More information about the MacOSX-Emacs mailing list