Emacs customization
From Perceptual Learning Wiki
Emacs Customization
Few editors are as customizable as Emacs. The most powerful customization method is to add Lisp statements in its customization file .emacs in each user's home directory.
Aquamacs Emacs
Aquamacs Emacs is a nice port to Mac OS X compiled natively ("carbonized") for the Aqua interface. It supports the Apple key in addition to Control and Meta. Thus, you can copy and paste with A-c and A-v as well as M-w and C-y. Its customization is a little non-standard relative to GNU Emacs.
First, the relevant files are:
- /Library/Preferences/Emacs/Preferences.el -- for all Carbon Emacs installations
- /Library/Preferences/Aquamacs Emacs/Preferences.el -- for Aquamacs and for all users
- /Users/username/Library/Preferences/Emacs/Preferences.el -- User-specific preferences for all Carbon Emacs installations
- ~/Library/Preferences/Aquamacs Emacs/Preferences.el -- User-specific preferences for Aquamacs. If in doubt, use this option.
- ~/Library/Preferences/Aquamacs\ Emacs/customizations.el -- Generated via the Options> Customize Emacs menu
The usual ~/.emacs file is still loaded for compatibility but it seems that Aquamacs second-guesses the Apple-specific keybindings there.
I [Alex] like to use Home and End to move to beg/end of line (rather than the whole buffer). Here's a snippet from ~apetrov/Library/Preferences/Aquamacs Emacs/Preferences.el:
(define-key osx-key-mode-map [home] 'move-beginning-of-line) (define-key osx-key-mode-map [end] 'move-end-of-line) (define-key osx-key-mode-map [A-home] 'beginning-of-buffer) (define-key osx-key-mode-map [A-end] 'end-of-buffer)
To change the default window (technically "frame") size, do the following:
- Pull down menu Options> Customize Emacs> Specific option...
- Type default-frame-alist at the prompt that appears at the bottom of the currently edited buffer (Tip: "defa" <tab> "fr" <tab>).
- Press Enter and you should find yourself in a new window with brownish background.
- Set (width . 85) chars and (height . 66) lines.
- Scroll to the top of the Customize Option buffer and click on the "Save for Future Sessions" button.
- This should update your ~/Library/Preferences/Aquamacs\ Emacs/customizations.el file:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default-frame-alist
(quote ((font . "fontset-monaco12")
(foreground-color . "Black")
(background-color . "White")
(cursor-color . "Red")
(vertical-scroll-bars . right)
(tool-bar-lines . 1)
(left-fringe . 1)
(width . 85)
(height . 66)
(top . 23))))
'(fill-column 80)
'(initial-frame-alist
(quote ((top . 23)
(left . 0)
(width . 85)
(height . 66))))
)
To enable spell checking in Aquamacs, you should install the ispell package via Fink. See also Mac essentials.
Links
- GNU Emacs
- Book Learning GNU Emacs (3rd Ed.). Highly recommended.
- Wikipedia "Emacs" entry
- Aquamacs Emacs -- Emacs for Mac OS X's Aqua interface
See also Help Files, Mac essentials
