;;; ;;; .emacs: EMACS start-up configuration and customization OS X ;;; Fri Mar 25 13:04:14 2005 ;;; Mon Mar 12 22:09:20 2007 added link to bitstream vera sans font (setq tramp-default-method "ftp") ;;; Set default language (set-language-environment "latin-1") (set-keyboard-coding-system 'mac-roman) (setq mac-transparency-alpha 84) (setq-default scroll-conservatively 1000) ;scroll 1 line at a time ;;;needed when using DoubleCommand to swap Option and Command ;(setq mac-command-key-is-meta t) ;;; Emacs 23 use command/mac key to be used for meta and the ;;; alt/option key to be left unbound for inserting special symbols. Aug 3,2009 (setq mac-option-key-is-meta nil) (setq mac-command-key-is-meta t) (setq mac-option-modifier nil) ;; get bitstrem vera sans mono font from: ;; 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-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) ;;;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) ;(setq scroll-step 1) ; scroll 1 line at a time ;;PATHS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;set load-path for lisp packages to look for my customizations in ;;;~/elf/lisp before looking at the default packages (setq load-path (cons (expand-file-name "~elf/lisp/erc") load-path )) ;(setq fancy-splash-image (expand-file-name "~/images/splash.xpm")) ;;; VARIABLE settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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")) (eval-after-load "erc" '(set-face-foreground 'erc-nick-default-face "green3")) ;;;Emacs 21 only-- disable fancy stuff (tool-bar-mode 0) ; disable toolbar ;;(menu-bar-mode -1) ; disable menu-bar ;;(scroll-bar-mode -1);disable scroll-bar ;(setq inhibit-eol-conversion t) ;don't be clever wrt CRLF/CR conversion ;;; enable all the bells and whistles of cperl-mode ;;;(setq cperl-hairy t) ;;; don't hilite trailing spaces with underscores (setq cperl-invalid-face (quote off)) ;;; to appease those paranoid anonymous ftp daemons (setq ange-ftp-generate-anonymous-password "elf@ee.ryerson.ca") ;(add-hook 'php-mode-user-hook 'turn-on-font-lock) ;;;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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(setq browse-url-browser-function 'w3m-browse-url) ;(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t) ;(global-set-key "\C-xm" 'browse-url-at-point) ;; Del will delete forward and Backspace will delete backwards ;; Fri May 02 2003. Moved to default.el ;(normal-erase-is-backspace-mode) ;; 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) ;;;loading pre-compiled libs & functions save time on start-up ;;; these are in ~/lisp/extralib.el ;(load-library "extralib") ;;;Handy MACROS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; 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-x\C-q" 'vc-toggle-read-only) (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 mapped to Fn on Mac) (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 "\*") ;; Emacs does not beep when you hit `C-g' in the minibuffer or during ;; an `isearch' (http://www.emacswiki.org/cgi-bin/wiki.pl?AlarmBell) (setq ring-bell-function (lambda () (unless (memq this-command '(isearch-abort abort-recursive-edit find-file exit-minibuffer keyboard-quit)) (ding)))) ;; 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) ;;; 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) ;;;turn off the bell http://www.emacswiki.org/cgi-bin/wiki?AlarmBell (setq ring-bell-function 'ignore) (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"))) ;;; 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) ;;;open urls in default browser (setq browse-url-browser-function 'browse-url-default-macosx-browser) ;; Normally, when a new message is inserted and point is after the ERC ;; prompt, the point is pushed down along with the prompt after the ;; newly inserted text. This function moves the point away from the ;; prompt so that you can find the place where you left off reading. ;; --bojohan (defun my-erc-leave-last-line (dummy) "Move point away from the last line in a non-selected ERC buffer." (when (and (not (eq (window-buffer (selected-window)) (current-buffer))) (>= (point) erc-insert-marker)) ;; now, move (deactivate-mark) (goto-char (erc-beg-of-input-line)) (forward-line -1))) (add-hook 'erc-insert-pre-hook 'my-erc-leave-last-line) ;;; 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)))