~ brendano /.emacs

I use vim and textmate as primary editors, so this is rusty. ... Best feature: simple keystroke C-b for electric-buffer-list.
; ======================================================================
; a(n) .emacs file.
; brendan o'connor - dotfiles.org/~brendano/.emacs - brenocon at gmail
; ======================================================================

;;(setq mac-allow-anti-aliasing nil)  ;; turn off anti-aliasing

;; (longlines-mode)   ;; soft word wrap like the rest of the world

;; make colors not suck so much

(if (and window-system (file-exists-p "~/color-theme-6.6.0"))
    (progn
      (add-to-list 'load-path "~/color-theme-6.6.0/color-theme/")  ; your SLIME directory
      (require 'color-theme)
      (color-theme-vim-colors)))
  

;; XLE LFG
(if (file-exists-p "/p/libexec/xle/emacs/lfg-mode.el")
  (load-library "/p/libexec/xle/emacs/lfg-mode"))
(if (file-exists-p "~/lfg-mode.el")
  (load-library "~/lfg-mode"))

;; Prolog (Sicstus)
(if (file-exists-p "/p/libexec/sicstus-3.12.7/emacs")
    (load "/p/libexec/sicstus-3.12.7/emacs/sicstus_emacs_init"))
(setq Info-default-directory-list 
      (append Info-default-directory-list '("/p/libexec/sicstus-3.12.7/doc/info/")))

;(setq load-path (cons (expand-file-name "/p/libexec/sicstus-3.12.7/emacs") load-path))
;(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
;(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
;(setq prolog-system 'sicstus)
;(setq auto-mode-alist (cons '("\\.pl$" . prolog-mode) auto-mode-alist))

;; Lisp (SLIME)
(if (file-exists-p "~/sw/lisp/slime-2.0")
    (progn
      (add-to-list 'load-path "~/sw/lisp/slime-2.0/")  ; your SLIME directory
      (setq inferior-lisp-program "/pt/bin/sbcl")
      ;(setq inferior-lisp-program "/pt/bin/clisp")
      (require 'slime)
      (slime-setup)))

;; (load "/afs/ir/users/b/r/brendano/local/ilisp-5.12.0/ilisp.custom.emacs")


;; for php/js/html intermixing
(defun recolor ()
  (interactive) (font-lock-mode) (font-lock-mode) (font-lock-mode))  
(defun js-switch ()
  (interactive) ;;makes it a commandp, is req'd to be a callbackable fn
  (javascript-mode) (recolor))
(defun html-swtich ()
  (interactive) (html-mode) (recolor))
(defun css-switch ()
  (interactive) (css-mode) (recolor))

;; key bindings
(global-set-key "\M-g" 'goto-line)
(global-set-key "\M-o" 'occur)
(global-set-key "\M-p" 'grep)


;(global-set-key "\C-b" 'man)

;; electric buffer list is AWESOME
(global-set-key "\C-b" 'electric-buffer-list)
(global-set-key "\C-x\C-b" 'electric-buffer-list)
(global-set-key [ (f8) ] 'bs-cycle-previous)
(global-set-key [ (f9) ] 'bs-cycle-next)
(global-set-key [ (f13) ] 'compile) ;;the funny key in top-left of a sun keyboard

(global-set-key [ (f11) ] 'previous-error)
(global-set-key [ (f12) ] 'next-error)

;(global-set-key [ (f4) ] 'js-swtich )
;(global-set-key [ (f5) ] 'html-switch )
;;;(global-set-key "\C-f" 'compile)
;(define-key key-translation-map 'f11 "{")
;(define-key key-translation-map 'f12 "}")
;(define-key key-translation-map 'f8 "_")


;;; Allow extra space at the end of the line
(setq-default fill-column 78)

(setq-default line-number-mode t)
(setq column-number-mode t)

;; Make lines wrap automatically in text mode.
(add-hook 'text-mode-hook
          '(lambda () (auto-fill-mode 1)))

(setq-default tab-width 8)

;; spaces instead of tabs by default...
(setq-default indent-tabs-mode nil)

;; Turn off the bell
;(setq visible-bell t)

;;If at beginning of a line, don't make me C-k twice.
(setq kill-whole-line t)

;; Don't let me add new lines to the bottom of a file with the downarrow
(setq-default next-line-add-newlines nil)

;; Set up hungry deleting for c and c++
(setq-default c-hungry-delete-key 1)

(add-hook 'c-mode-hook '(lambda () 
  (c-set-style "K&R") 
  (setq c-basic-offset 4)
))

; Make Emacs automatically hit return for you after left curly braces,
; right curly braces, and semi-colons.

;(setq-default c-auto-newline 1)


; Set the default comment column for end-of-line comments to 40.
; When you want to comment the end of a line of code, put the
; cursor anywhere on that line and hold down Alt and press the
; semi-colon key (';').  Emacs automatically goes to column 40, puts
; in the appropriate comment characters, and then lets you type your
; comment.  With the auto-fill feature turned on, this also allows you
; to have your comment extend beyond the end of the line and still be
; lined up and enclosed with comment characters for you on the next
; line.
(setq comment-column 40)



; Make Emacs use "newline-and-indent" when you hit the Enter key so
; that you don't need to keep using TAB to align yourself when coding.
; This is akin to setting autoindent in vi.

(global-set-key "\C-m" 'newline-and-indent)


; Turn on auto-fill-mode (line wrapping like in a word processor).
; This is VERY nice for typing end-of-line comments, since Emacs will
; not only position you on the next line when you go beyond the
; fill-column (set below), but it will line you up with the first
; slash on the previous line and then put two slashes and a space for
; you!  (In C mode it's a "/* */" pair with the cursor positioned
; correctly in the middle.)

;(add-hook 'c++-mode-hook 'turn-on-auto-fill)
;(add-hook 'c-mode-hook 'turn-on-auto-fill)

(tool-bar-mode)

(when window-system
  ;; enable wheelmouse support by default
  (mwheel-install)
  ;; use extended compound-text coding for X clipboard
  (set-selection-coding-system 'compound-text-with-extensions))

; Get mouse support in the xterm -- putty too!!!!
(unless window-system
  (xterm-mouse-mode 1)
  (mwheel-install))

;; --- Old crappy way of doing mouse wheel
;; Set up mouse wheel
;; (defun up-slightly () (interactive) (scroll-up 8))
;; (defun down-slightly () (interactive) (scroll-down 8))
;; (global-set-key [mouse-4] 'down-slightly)
;; (global-set-key [mouse-5] 'up-slightly)

;(defun up-one () (interactive) (scroll-up 1))
;(defun down-one () (interactive) (scroll-down 1))
;(global-set-key [S-mouse-4] 'down-one)
;(global-set-key [S-mouse-5] 'up-one)

;(defun up-a-lot () (interactive) (scroll-up))
;(defun down-a-lot () (interactive) (scroll-down))
;(global-set-key [C-mouse-4] 'down-a-lot)
;(global-set-key [C-mouse-5] 'up-a-lot)

;; Set up the keyboard so the delete key on both the regular keyboard
;; and the keypad delete the character under the cursor and to the right
;; under X, instead of the default, backspace behavior.
;;(global-set-key [delete] 'delete-char)
;;(global-set-key [kp-delete] 'delete-char)


(custom-set-faces
  ;; custom-set-faces 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.
 '(shadow ((((class color grayscale) (min-colors 88) (background light)) (:foreground "grey20")))))

(setq minibuffer-max-depth nil)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
 '(case-fold-search t)
 '(current-language-environment "English")
 '(global-font-lock-mode t nil (font-lock))
 '(load-home-init-file t t)
 '(pc-select-meta-moves-sexps t)
 '(pc-select-selection-keys-only t)
 '(pc-selection-mode t nil (pc-select))
 '(query-user-mail-address nil)
 '(show-paren-mode t)
 '(transient-mark-mode t)
 '(user-mail-address "asdf@asdf.com"))