[OS X Emacs] How to rebind the

Steven E. Harris seh at panix.com
Mon Jan 26 09:41:31 EST 2015

Alan Schmitt <alan.schmitt <at> polytechnique.org> writes:

> I'm also using Aquamacs 2.4. I tried again, and when I do
> C-x C-r I get the menu and not my function.
> Is there a way to debug the startup sequence of Aquamacs so that
> I find how the binding gets overridden?

It's more than three years later, and I'm still struggling with this same
problem. I've tried wrapping the `define-key' (or `global-set-key') call in
`eval-after-load' to ensure that my rebinding runs *after* the one I find in
aquamacs-menu.el, still to no avail:

| ;; 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?

Steven E. Harris

More information about the MacOSX-Emacs mailing list