;; * About this file ;; ;; This is a sample Emacs configuration file that Michael Olson ;; created for the PLUG Emacs Configuration presentation on ;; 2007-02-09. It may be written to the ~/.emacs file. ;; ;; The presentation and the extra code used by this file may be found ;; at . ;; ;; This should work with Emacs 21, XEmacs 21, and Emacs 22 (when it is ;; released). Lines that have two semicolons in front of them are ;; comments. ;; ;; * What you need to know about Emacs ;; ;; Emacs can make your life very easy. One example of this is in ;; TAB-completion. When Emacs prompts you for some value, you can ;; often hit TAB twice to see all of the available options. Then when ;; you start typing an option, hit TAB to try to complete the rest of ;; it. I use this constantly. ;;; Set up the environment ;; Make sure Emacs Lisp code in the ~/elisp directory can be found (add-to-list 'load-path "~/elisp") ;; * Installing more software for Emacs ;; ;; If you want to load other add-on programs for Emacs, do the ;; following, where PROG is the name of the program. ;; ;; 1. Unpack the program to ~/elisp/PROG ;; ;; 2. Add the line: ;; (add-to-list 'load-path "~/elisp/PROG") ;; ;; 3. Add the line: ;; (require 'PROG) ;; ;; Step 3 may need to be adjusted depending on the program -- read the ;; manual of the program in question for more specific details. ;; ;; 4. Add other lines that are suggested by the manual of the program, ;; if any. ;; As an example, I've enabled my "wtf" program, which allows you to ;; look up the definitions of acronyms by typing M-x wtf-is RET ;; RET. Replace with the term you want to look ;; up. If you move to the acronym, the prompt should be automatically ;; filled in with that acronym. (require 'wtf) ;;; Miscellaneous extra features ;; Make the Delete and Backspace keys work as expected (when (and (fboundp 'normal-erase-is-backspace-mode) window-system) (normal-erase-is-backspace-mode 1)) ;; Load `dired', a "directory editing" mode (require 'dired) (require 'wdired) (condition-case nil ; ignore errors if this is not found (require 'dired-x) (error nil)) ;; List directories before files in dired (condition-case nil (require 'ls-lisp) (error nil)) ;; Uncomment this if you don't like being prompted for recursive ;; deletion in dired. ;; ;; (setq dired-recursive-deletes 'always) ;; Load `ido', which shows a different prompt when you're switching ;; between files (condition-case nil (progn (require 'ido) (setq ido-everywhere nil ido-save-directory-list-file "~/.emacs.d/.ido.last") (ido-mode 'buffer)) (error nil)) ;; Uncomment this to cause the Tab key to insert spaces instead of ;; tabs. The default is to insert tabs. ;; ;; (setq-default indent-tabs-mode nil) ;; When not using X, don't show the menu bar (when (and (not window-system) (fboundp 'menu-bar-mode)) (menu-bar-mode 0)) ;; Find funtions and files at point (when (fboundp 'ffap-bindings) (ffap-bindings)) ;; Grand Unified Debugger (allows you to do M-x gdb) (require 'gud) ;; Enable browsing of kill ring (that is, recently-killed/cut text) ;; when you hit M-y (require 'browse-kill-ring) (defadvice yank-pop (around kill-ring-browse-maybe (arg)) "If last action was not a yank, run `browse-kill-ring' instead." (if (not (eq last-command 'yank)) (browse-kill-ring) ad-do-it)) (ad-activate 'yank-pop) ;; Load info before trying to deal with its mode map later on (require 'info) ;; Delete the selection when hitting a key after selecting it, like ;; most other editors do (if (featurep 'xemacs) (pending-delete-mode 1) (delete-selection-mode 1)) ;; Uncomment this if you'd like your Emacs session to do amusing ;; things after 3 minutes of idle time. Hitting a key will stop the ;; madness :^) . ;; ;; (require 'zone) ;; (setq zone-idle (* 60 3)) ;; (zone-when-idle zone-idle) ;;; Key customizations ;; Uncomment this to disable the Insert key, which I find annoying ;; ;; (global-set-key [insert] (lambda () (interactive))) ;; Make certain that Home and End do the right thing (global-set-key [home] 'beginning-of-line) (global-set-key [end] 'end-of-line) ;; Nasty hack to make Home and End work in Solaris (when (string= (getenv "TERM") "dtterm") (global-set-key (kbd "ESC O") nil) (global-set-key (kbd "ESC O H") 'beginning-of-line) (global-set-key (kbd "ESC O F") 'end-of-line)) ;; Make the key scroll backwards in Info mode (define-key Info-mode-map [delete] 'Info-scroll-down) ;; Prompt for a line and go to it when hitting C-x g (global-set-key "\C-xg" 'goto-line) ;;; Customizations ;; These are options that can be changed by doing the following, ;; replacing