;;; ;;; .emacs: EMACS start-up configuration and customization ;;; Known to work for: GNU Emacs 21.3.50.1 (powerpc-apple-darwin7.8.0) ;;; Updated for: GNU Emacs 22.0.50.1 (powerpc-apple-darwin7.9.0) ;;; Created: Fri Mar 25 13:04:14 2005 ;;; Updated: Fri Aug 04 17:32:58 2006 ;;; Author: elfee.ryerson.ca ;;; Journal: www.ee.ryerson.ca/~elf/pb/ ;;; ;;; You are invited to chat with other Emacs users on the #emacs channel ;;; and Mac users on #macosx channel, at irc.freenode.net ;;; Uncomment the following line if there is a problem in your .emacs ;;; and then run emacs. The debugger will pop-up at the line with the ;;; error. ;(setq debug-on-error t) ;;; Set default language (set-language-environment "latin-1") (set-keyboard-coding-system 'mac-roman) ;;; Emacs 21 settings for transparency OS X only (setq mac-transparency-alpha 84) ;;; Emacs 22 settings for transparency OS X only (set-frame-parameter (selected-frame) 'active-alpha 0.84) ;;; Enable standard Mac keybindings like Cmd-C to copy and Cmd-v to paste (mac-key-mode 1) ;;; if you use DoubleCommand to swap Option and Command you will need this (setq mac-command-key-is-meta nil) ;;; set up fonts ;; create a bitstream vera sans fontset for ascii, latin-1 and unicode ;; d/l: http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/ (create-fontset-from-fontset-spec "-apple-bitstream vera sans mono-medium-r-normal--15-*-*-*-*-*-fontset-mac, ascii:-apple-bitstream vera sans mono-medium-r-normal--15-*-*-*-m-*-mac-roman, latin-iso8859-1:-apple-bitstream vera sans mono-medium-r-normal--15-*-*-*-m-*-mac-roman, mule-unicode-0100-24ff:-apple-bitstream vera sans mono-medium-r-normal--15-*-*-*-m-*-mac-roman") ;; set the fontset for the emacs frame (set-frame-font "-apple-bitstream vera sans mono-medium-r-normal--15-*-*-*-*-*-fontset-mac" 'keep) (add-to-list 'default-frame-alist '(font . "-apple-bitstream vera sans mono-medium-r-normal--15-*-*-*-*-*-fontset-mac")) ;;;LOOK AND FEEL (if (and window-system (x-display-color-p)) (setq default-frame-alist '((top . 1) (left . 394) (width . 80) (height . 40) (cursor-color . "red") (cursor-type . box) (foreground-color . "lightcyan") (background-color . "midnightblue")))) ;;; When Emacs is configured to use a gui, File->Open File will pop up ;;; a file selection dialog if `use-dialog-box' is set to t. (setq use-dialog-box t) ;;PATHS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;set load-path for lisp packages to look for my customizations in ;;;~/elf/lisp before looking at the default packages (add-to-list 'load-path "~elf/lisp") ; customize the splash screen image with your own image ;(setq fancy-splash-image (expand-file-name "~/images/splash.xpm")) ;;; VARIABLE settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq-default scroll-conservatively 1000) ;scroll 1 line at a time (column-number-mode t) ;show column-number in the mode line (display-time) ;show date and time in modeline (setq-default case-fold-search nil ;case sensitive searches by default search-highlight t) ;hilit matches when searching (setq mark-even-if-inactive t) ; keep region hilited after marking (global-set-key [?\C-2] 'set-mark-command) ; make C-2 eqv. to C-@ (nconc auto-mode-alist '( ("\\.ps\\'" . ps-mode) ("zshrc$" . shell-script-mode) ("\\.pl\\'" . perl-mode))) (autoload 'ps-mode "ps-mode" "Mode for editing PostScript files." t) ;;;Fontification ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; colorize buffers (setq font-lock-maximum-decoration t) (global-font-lock-mode 1) (eval-after-load "font-lock" '(set-face-foreground (quote font-lock-comment-face) "darkgrey")) ;;; use ftp to remotely edit files (setq tramp-default-method "ftp") ;;; disable fancy stuff (tool-bar-mode 0) ; disable toolbar ;;(menu-bar-mode -1) ; disable menu-bar ;;(scroll-bar-mode -1) ;disable scroll-bar ;;; don't hilite trailing spaces with underscores (setq cperl-invalid-face (quote off)) ;;;C source-code look (setq-default tab-width 4 c-indent-level 2) (setq c-argdecl-indent 0 comment-multi-line t) ;;;Version-control and backups (setq version-control t kept-old-versions 1 delete-old-versions t) ; from trim-versions-without-asking ;;;LIBRARIES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; handle ansi escape sequences in M-x shell (ansi-color-for-comint-mode-on) ;; switch off delete-selection-mode (delete-selection-mode 'nil) ;; switch off transient mark mode (transient-mark-mode 'nil) (put 'narrow-to-region 'disabled nil) (put 'eval-expression 'disabled nil) ;;;Handy functions and keyboard shortcuts;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; insert current date into the buffer at point (defun insert-date() "Insert a time-stamp according to locale's date and time format." (interactive) (insert (format-time-string "%c" (current-time)))) (global-set-key "\C-cd" 'insert-date) ;;; Personal key bindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; the number of time I've typed C-x C-k when I meant C-xk are uncountable (global-set-key "\C-x\C-k" 'kill-buffer) ;;; Mac OS X M-up/down for paging (global-set-key [M-down] 'scroll-up) (global-set-key [M-up] 'scroll-down) ;; Fn+home Fn+end (right-Enter is redefined to Fn on Mac using DoubleCommand) (global-set-key [home] 'beginning-of-buffer) (global-set-key [end] 'end-of-buffer) ;;; accelerator for what-line & goto-line (global-set-key "\C-c\C-g" 'what-line) (global-set-key "\C-cg" 'goto-line) ;;; now set the display for smart quotes to the standard quote character (standard-display-ascii ?\221 "\`") (standard-display-ascii ?\222 "\'") (standard-display-ascii ?\223 "\"") (standard-display-ascii ?\224 "\"") (standard-display-ascii ?\227 "\-") (standard-display-ascii ?\225 "\*") ;;;turn off the bell http://www.emacswiki.org/cgi-bin/wiki?AlarmBell (setq ring-bell-function 'ignore) ;; better switch buffer mode (iswitchb-mode 1) ;; buffers have unique names so we know where index.html file belongs (require 'uniquify) (setq uniquify-buffer-name-style 'forward) ;; Mouse-wheel support (load-library "mwheel") (mwheel-install) ;;;open urls in default browser (setq browse-url-browser-function 'browse-url-default-macosx-browser) ;;; slight re-definition, similar to w in vi (defun next-word () (interactive) (forward-word 2) (backward-word 1)) (global-set-key "\M-f" 'next-word) ;;;show recently opened files in the File menu (recentf-mode 1) ;;; Stefan Monnier . It is the opposite of fill-paragraph ;;; Takes a multi-line paragraph and makes it into a single line of text. (defun unfill-paragraph () (interactive) (let ((fill-column (point-max))) (fill-paragraph nil))) ;;; Luke Gorrie (defun activate-peril-sensitive-sunglasses () "With apologies to Zaphod Beeblebrox." (interactive) (mapc (lambda (face) (set-face-foreground face "black") (set-face-background face "black")) (face-list))) ;;; ;;; The rest is for configuring erc, the emacs irc client ;;; Uncomment it if you want to try ERC ;;; download ERC from: http://ftp.gnu.org/gnu/erc ;;; add it to your load-path and start it with: M-x erc-select ;; (require 'erc) ;; (setq erc-server "irc.freenode.net" ;; erc-port 6667 ;; erc-nick "e1f" ;; erc-user-full-name "luis fernandes" ;; erc-prompt-for-password nil) ;; (setq erc-flood-protect nil) ;safety off for erc 5.0.2 ;; ;; automatically join channels when we start-up ;; (require 'erc-autojoin) (erc-autojoin-mode 1) ;; (setq erc-autojoin-channels-alist ;; '(("freenode.net" "#zsh" "#freedesktop" "#perl" "#web" "#macosx" "#emacs"))) ;; customize the color of the nickname face ;(eval-after-load "erc" ; '(set-face-foreground 'erc-nick-default-face "green3")) ;; ;;; hilite occurences of my nick in the emacs modeline ;; (erc-match-mode 1) ;; (setq erc-keywords '("\\be1f\\b" "\\belf:\\b")) ;; ;(setq erc-current-nick-highlight-type 'nick) ;; ;;don't flood buffer with quit/joins when a netsplit happens ;; (require 'erc-netsplit) ;; (erc-netsplit-mode 0) ;; ;; split the window when we get a privmsg ;; (setq erc-auto-query 'window-noselect) ;; ;; timestamp the conversations ;; (erc-timestamp-mode 1)