Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assign multiple Emacs keybindings to a single command?

I'm giving ErgoEmacs mode a try to see if I can use Emacs more comfortably. Some of its keybindings are fairly intuitive, but in many cases I don't want to outright replace the defaults.

For example, in the context of ErgoEmacs' navigation shortcut structure, M-h makes sense as a replacement for C-a--but I want to be able to use both, not just M-h. I tried simply duplicating the commands:

;; Move to beginning/ending of line
(defconst ergoemacs-move-beginning-of-line-key   (kbd "C-a")) ; original
(defconst ergoemacs-move-end-of-line-key         (kbd "C-e")) ; original
(defconst ergoemacs-move-beginning-of-line-key   (kbd "M-h")) ; ergoemacs
(defconst ergoemacs-move-end-of-line-key         (kbd "M-H")) ; ergoemacs

But Emacs simply overwrites the first keybinding with the second. What's the best way to address this?

like image 852
Dan Avatar asked Jun 15 '10 19:06

Dan


1 Answers

To re-post reply from ergo-emacs mailing list:

Xah Lee said:

that's very easy.
in the ergoemacs-mode.el file, there's this line (load "ergoemacs-unbind") just comment it out. That should be all you need to do. However, note that ErgoEmacs keybinding defines those common shortcuts such as Open, Close, New, Save... with keys Ctrl+o, Ctrl+w, Ctrl+n, Ctrl+s etc. About 7 of them or so. So, i think some of these will hit on emacs traditional bindings with Ctrl. if you are new to ErgoEmacs and trying to explore it, you might just try starting with few keys. this page might have some useful info: http://code.google.com/p/ergoemacs/wiki/adoption thanks for checking out ErgoEmacs!
Xah ∑ http://xahlee.org/

like image 176
boskom Avatar answered Sep 28 '22 05:09

boskom