;;$Header: /home/martin/RCS/.emacs,v 1.19 2008/07/19 19:29:39 martin Exp $ (require 'cl) (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. '(TeX-PDF-mode t) '(TeX-output-view-style (quote (("^dvi$" ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$") "%(o?)dvips -t landscape %d -o && gv %f") ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "%(o?)dvips %d -o && gv %f") ("^dvi$" ("^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "^landscape$") "%(o?)xdvi %dS -paper a4r -s 0 %d") ("^dvi$" "^a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4$" "%(o?)xdvi %dS -paper a4 %d") ("^dvi$" ("^a5\\(?:comb\\|paper\\)$" "^landscape$") "%(o?)xdvi %dS -paper a5r -s 0 %d") ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "%(o?)xdvi %dS -paper a5 %d") ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d") ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d") ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d") ("^dvi$" "." "%(o?)xdvi %dS %d") ("^pdf$" "" "evince %o") ("^pdf$" "." "xpdf -remote %s -raise %o %(outpage)") ("^html?$" "." "netscape %o")))) '(auto-compression-mode t nil (jka-compr)) '(blank-chars (quote tabs)) '(blank-display-mappings nil) '(blink-cursor-mode nil) '(calculator-bind-escape nil) '(case-fold-search t) '(column-number-mode t) '(current-language-environment "UTF-8") '(default-input-method "rfc1345") '(delete-selection-mode t) '(display-time-day-and-date t) '(display-time-mode t) '(font-lock-maximum-decoration t) '(font-lock-mode t t (font-lock)) '(font-lock-use-colors t) '(font-lock-use-fonts nil) '(global-auto-revert-mode t) '(global-font-lock-mode t nil (font-lock)) '(global-linum-mode t) '(gnus-carpal nil) '(gnus-expert-user t) '(gnus-group-list-inactive-groups nil) '(gnus-inhibit-startup-message t) '(gnus-nntp-server nil) '(gnus-novice-user nil) '(gnus-select-method (quote (nntp "news.zen.co.uk"))) '(gnus-treat-display-xface (quote head)) '(gnus-visual (quote (summary-highlight group-highlight article-highlight mouse-face summary-menu group-menu article-menu tree-highlight menu highlight browse-menu server-menu page-marker tree-menu binary-menu pick-menu grouplens-menu))) '(graphviz-dot-preview-extension "gif") '(graphviz-dot-view-command "dotty %s") '(indent-tabs-mode nil) '(inferior-lisp-program "clisp -K full") '(inhibit-startup-echo-area-message "martin") '(inhibit-startup-screen t) '(initial-scratch-message nil) '(iswitchb-mode t) '(load-home-init-file t t) '(menu-bar-mode nil) '(message-user-fqdn "martindengler.com") '(next-line-add-newlines nil) '(p4-default-depot-completion-prefix "//KBCAIM/") '(p4-default-diff-options "-duw") '(p4-user-email "martin.dengler@kbcaim.com") '(p4-verbose nil) '(paren-mode (quote sexp) nil (paren)) '(remote-shell-program "ssh") '(save-place t nil (saveplace)) '(save-place-skip-check-regexp "\\`/\\(?:cdrom\\|floppy\\|mnt\\|\\(?:[^@/:]*@\\)?[^@/:]*[^@/:.]:\\)") '(scroll-bar-mode nil) '(shell-completion-fignore (quote ("~" "#" "%"))) '(show-paren-mode t nil (paren)) '(show-paren-style (quote expression)) '(show-trailing-whitespace t) '(size-indication-mode t) '(speedbar-default-position (quote right)) '(speedbar-track-mouse-flag t) '(speedbar-use-images nil) '(speedbar-verbosity-level 2) '(tab-width 4) '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify))) '(tool-bar-mode nil) '(transient-mark-mode t) '(truncate-lines nil) '(user-mail-address "denglerm") '(winner-mode t nil (winner))) (put 'downcase-region 'disabled nil) (put 'narrow-to-region 'disabled nil) (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. '(default ((t (:size "10pt" :family "Courier")))) '(blank-tab-face ((((class mono)) :inverse-video t) (t (:background "Red" :foreground "White")))) '(font-lock-doc-string-face ((((class color) (background light)) (:foreground "orange")))) '(font-lock-string-face ((((class color) (background light)) (:foreground "darkgreen")))) '(show-paren-match ((((class color) (background light)) (:background "green")))) '(trailing-whitespace ((((class color) (background light)) (:background "lightyellow"))))) ;; If running under screen, disable C-z. ;; from http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html ;; ...and correct backspace/delete problem ;; from http://www.gnu.org/software/emacs/manual/html_node/emacs/DEL-Does-Not-Delete.html (when (not window-system) (when (equal (getenv "TERM") "cygwin") (message "running in cygwin/not putty, so correcting backspace/delete") (normal-erase-is-backspace-mode 1)) (when (getenv "STY") (message "running in screen, so disabling C-z") (global-unset-key "\C-z") (unless (key-binding [(delete)]) (global-set-key [(delete)] "\C-d")))) ;; cycle buffers with C-Tab, ignoring uninteresting ones ;; ripped from http://www.cubic.org/~doj/emacs, which... ;; ripped from http://www.dotemacs.de/dotfiles/KilianAFoth.emacs.html (defun backward-buffer () (interactive) "Switch to previously selected buffer." (let* ((list (cdr (buffer-list))) (buffer (car list))) (while (and (cdr list) (string-match "\\*" (buffer-name buffer))) (progn (setq list (cdr list)) (setq buffer (car list)))) (bury-buffer) (switch-to-buffer buffer))) (defun forward-buffer () (interactive) "Opposite of backward-buffer." (let* ((list (reverse (buffer-list))) (buffer (car list))) (while (and (cdr list) (string-match "\\*" (buffer-name buffer))) (progn (setq list (cdr list)) (setq buffer (car list)))) (switch-to-buffer buffer))) (global-set-key [(control tab)] 'backward-buffer) (global-set-key [(control shift kp-tab)] 'forward-buffer) (global-set-key [(control shift iso-lefttab)] 'forward-buffer) (global-set-key [(control shift iso-righttab)] 'forward-buffer) ;; end rip ;; Make all yes/no prompts into y/n prompts (fset 'yes-or-no-p 'y-or-n-p) ;; sort-region-with-shell (fset 'sort-region-with-shell [?\C-u ?1 escape ?| ?s ?o ?r ?t return]) (setq calculator-user-operators '(("tf" cl-to-fr (+ 32 (/ (* X 9) 5)) 1) ("tc" fr-to-cl (/ (* (- X 32) 5) 9) 1) ("tp" kg-to-lb (/ X 0.453592) 1) ("tk" lb-to-kg (* X 0.453592) 1) ("tF" mt-to-ft (/ X 0.3048) 1) ("tM" ft-to-mt (* X 0.3048) 1))) ;; from http://www.cubic.org/~doj/emacs ;; set time to show in corner (display-time) (put 'scroll-left 'disabled nil) ;; from http://www.emacswiki.org/cgi-bin/emacs-en/McMahanEmacsConfiguration (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ;; ;; run a few shells. ;; (shell "*shell5*") ;; (shell "*shell6*") ;; (shell "*shell7*") ;; ;; C-5, 6, 7 to switch to shells ;; (global-set-key [(control 5)] ;; (lambda () (interactive) (switch-to-buffer "*shell5*"))) ;; (global-set-key [(control 6)] ;; (lambda () (interactive) (switch-to-buffer "*shell6*"))) ;; (global-set-key [(control 7)] ;; (lambda () (interactive) (switch-to-buffer "*shell7*"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Compile .emacs, and recompile if .emacs is newer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when (and user-init-file (equal (file-name-extension user-init-file) "elc")) (let* ((source (file-name-sans-extension user-init-file)) (alt (concat source ".el"))) (setq source (cond ((file-exists-p alt) alt) ((file-exists-p source) source) (t nil))) (when source (when (file-newer-than-file-p source user-init-file) (byte-compile-file source) (load-file source) (eval-buffer nil nil) (delete-other-windows) )))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Library loading ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (push "~/emacs.d/" load-path) (push "~/emacs.d/slime" load-path) (push "~/main/tools/etc" load-path) (push "~/emacs" load-path) (push "H:\\main\\tools\\etc" load-path) (push "H:\\emacs" load-path) (push "h:/doc/emacs.d" load-path) ; cygwin emacs (push "h:/doc/emacs.d/slime" load-path) ; cygwin emacs (setq with-library-load-libraries (or (getenv "EMACS_LOAD_LIBS") (getenv "EMACS_LOAD_LIBRARIES"))) ;; from http://www.emacswiki.org/cgi-bin/emacs-en/LoadingLispFiles (defmacro with-library (symbol &rest body) `(condition-case err-desc (when with-library-load-libraries (require ',symbol) ,@body) (error (message (format "Loading %s ...failed; not found." ',symbol)) nil))) (put 'with-library 'lisp-indent-function 1) ;; desktop mode lets us saves buffer state. activate it with M-x desktop-save RET. (with-library desktop (desktop-save-mode 1) (desktop-read)) (with-library graphviz-dot-mode ()) (with-library blank-mode ()) (with-library dev-p4 ()) ;; from http://bc.tech.coop/blog/040306.html (with-library slime (require 'slime) (add-hook 'lisp-mode-hook (lambda () (slime-mode t))) (add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t))) ;; If you don't want eldoc-like behavior, comment out the following line ;;(slime-autodoc-mode) ;; GNU CLISP - http://clisp.cons.org/ (defun clisp-start () (interactive) (shell-command (concat "/usr/bin/clisp -K full " "-B /usr/lib64/clisp " "-ansi -q -q&")))) (with-library anything ()) (with-library anything-config ()) (with-library linum ()) (with-library tramp ()) (with-library hippie-exp (global-set-key "\M-/" 'hippie-expand)) (with-library server (server-start)) (with-library htmlize ()) (with-library parenface ()) (with-library shebang ()) ;;TODO: add ~/.emacs.d/org.el ;; probably should be the last library loaded (with-library ffap (ffap-bindings)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Hooks & key bindings (mine, so last) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;C-next/prior (PgDn/PgUp) goes to next/prev interesting code block per interesting modes ;; we could remap backward/forward paragraph, but that's just different enough... (global-set-key [(control shift next)] 'scroll-left) (global-set-key [(control shift prior)] 'scroll-right) (global-set-key [(control next)] 'forward-sexp) ; useful surprisingly broadly (global-set-key [(control prior)] 'backward-sexp) ;; (add-hook 'lisp-mode-hook ;; '(lambda () ;; (local-set-key [(control next)] 'forward-sexp) ;; (local-set-key [(control prior)] 'backward-sexp))) ;; (setq lisp-mode-hook ()) (add-hook 'REPL-mode-hook '(lambda () (local-set-key [(control up)] 'slime-repl-previous-input) (local-set-key [(control down)] 'slime-repl-next-input))) (setq REPL-mode-hook ()) (add-hook 'python-mode-hook '(lambda () (local-set-key [(control next)] 'py-next-statement) (local-set-key [(control prior)] 'py-previous-statement))) ;; (setq python-mode-hook ()) ;; S-insert pastes from the clipboard ;; C-insert copies to the clipboard ;; C-S-insert cuts to the clipboard (global-set-key [(shift insert)] 'clipboard-yank) (global-set-key [(control insert)] 'clipboard-kill-ring-save) (global-set-key [(control shift insert)] 'clipboard-kill-region) (global-set-key "\C-x\C-c" (lambda () (interactive "*") (when (yes-or-no-p "Exit emacs? ") (save-buffers-kill-emacs)))) ;; from http://www.vinc17.org/mutt/index.en.html (defun mtd-mutt-ff-hook () ;; mutt buffer name example: "/tmp/mutt-sun-617-6486" (when (string-match "mutt-.*\\(-[0-9]+\\)+" (file-name-nondirectory (buffer-file-name))) (set (make-local-variable 'backup-inhibited) t) ;; The following code is executed only when composing messages ;; (new messages or replies), not when editing messages (which ;; start with "From ") from the mailbox. (when (looking-at "^From:") (flush-lines "^\\(> \n\\)*> -- \\(\\(\n> .*\\)+\\|$\\)") (not-modified) (message (format "mtd-mutt-ff-hook: point is %s" (point))) (search-forward "\n\n" nil t) (message (format "mtd-mutt-ff-hook: point is %s" (point))) ) (mail-mode))) ;; (remove-hook 'find-file-hook 'mtd-mutt-ff-hook) (add-hook 'find-file-hook 'mtd-mutt-ff-hook) ;; from http://steve.yegge.googlepages.com/effective-emacs (global-set-key "\C-x\C-m" 'execute-extended-command) (global-set-key "\C-c\C-m" 'execute-extended-command) ;;(global-set-key "\C-w" 'backward-kill-word) (global-set-key "\C-x\C-k" 'kill-region) ; we lose edit-kbd-macro, but so what (global-set-key "\C-c\C-k" 'kill-region) ;; from me! (global-set-key "\C-s" 'isearch-forward-regexp) (defun mtd-invoke-isearch-with-symbol-near-point () (interactive) (let ((search-string (thing-at-point 'symbol)) (search-string-start (first (bounds-of-thing-at-point 'symbol)))) (unless (eq search-string-start (point)) (goto-char search-string-start)) (isearch-resume search-string ; SEARCH t ; REGEXP nil ; WORD t ; FORWARD search-string ; MESSAGE t ; CASE-FOLD ) (isearch-push-state) (isearch-update) )) (global-set-key "\M-s" 'mtd-invoke-isearch-with-symbol-near-point) (define-key isearch-mode-map "\M-s" 'isearch-repeat-forward) ;; ;; misc ;; ;; EXPERIMENTAL (menu-bar-enable-clipboard)