75 points · by pdelgallego · 15y ago · 17 comments
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'none)
(setq mac-pass-command-to-system nil)Also, while it's really its own discussion, I think Emacs is more usable with the Dvorak keyboard layout. Emacs's default keybindings pack a lot of important keys into the left hand on Qwerty (C-x, C-c, C-v, C-r, C-s), while with Dvorak they're distributed more evenly.
Remapping left-Alt to Ctrl is another option; that way, you can hold Ctrl with your thumb while you type.
(global-set-key (kbd "keybinding") 'function-you-want-it-to-call)
The article goes into the significance of global-set-key vs. local-set-key; until you have more specific intentions, global-set-key is probably what you want.I've done a couple sessions teaching developers in using Emacs, and one point I always stress is that the Emacs help system is exhaustive, but you have to learn how it's organized. (It uses funny terminology sometimes.)
(defun insert-key-sequence (key-repr)
"Reads a literal key sequence from the user
and inserts a representation of it at point,
suitable for `global-set-key' or `local-set-key'."
(interactive "KKey sequence? ")
(prin1 key-repr (current-buffer))
(insert " "))
(add-hook 'emacs-lisp-mode-hook
#'(lambda ()
(local-set-key "\C-ck" #'insert-key-sequence)))
(run-hooks 'emacs-lisp-mode-hook)
Unfortunately it doesn't seem to work for mouse chords.Edit: insert-key-sequence doesn't exist on Emacs 22.3.1, is that a more recent addition?
Also, while not crucial, I prefer to add a my-X-mode-hook function and add things to that, rather than adding several lambdas to the mode hook - it's easier to modify them all after binding that way.