;;; -*-emacs-lisp-*- ;;; ;;; $Id: .emacs,v 1.11 1997/01/01 18:47:09 mdw Exp $ ;;; ;;; Emacs configuration file ;;; ;;; (c) 1996-1999 Mark Wooding ;;; ;;;----- Licensing notice --------------------------------------------------- ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA (setq load-path (nconc load-path (list "~/lib/emacs"))) (require 'dot-emacs) ;;;----- Some random initialisation ----------------------------------------- (setq mdw-init-window (selected-window)) ;; --- Load some other bits of code --- (setq load-path (cons "~/lib/emacs" load-path)) (maybe-autoload 'cc-mode "cc-mode" nil t) (maybe-autoload 'rexx-mode "rexx-mode" nil t) (maybe-autoload 'cvs-update "pcl-cvs" nil t) (maybe-autoload 'debian-changelog-mode "debian-changelog-mode" nil t) (maybe-autoload 'git-status "git" nil t) (and (library-exists-p "vc-git") (not (memq 'GIT vc-handled-backends)) (setq vc-handled-backends (cons 'GIT vc-handled-backends))) (and (library-exists-p "quilt") (load "quilt")) (trap (or (fboundp 'make-regexp) (load "make-regexp"))) (trap (require 'tex-site)) ;; --- Skeleton stuff --- (trap (require 'skel-init)) ;; --- Window system-dependent things --- (require 'paren) (trap (show-paren-mode t)) (or window-system (menu-bar-mode -1)) ;; --- Temporary directory handling --- (defun mdw-check-dir-exists (dir) (and dir (file-directory-p dir) dir)) (setq tmpdir (or (mdw-check-dir-exists (getenv "TMPDIR")) (mdw-check-dir-exists (format "/tmp/%s" (user-login-name))) "/tmp")) ;; --- Emacs server behaviour --- (and window-system (trap (gnuserv-start) (setq server-temp-file-regexp (concat "^" tmpdir "\\|/draft$")))) ;; --- Control backup behaviour --- (setq backup-by-copying nil) (setq backup-by-copying-when-linked t) (setq backup-by-copying-when-mismatch t) ;; --- Calculator fiddling --- (setq calc-settings-file "~/.emacs-calc") (load calc-settings-file) ;; ---- Some mail and news configuration --- (setq mail-from-style 'parens) (setq mail-signature t) (setq mail-yank-prefix "> ") (setq mail-archive-file-name "~/Mail/sent") (setq rmail-display-summary t) (setq rmail-file-name "~/Mail/rmail") ;; --- GNUS configuration --- (setq gnus-select-method '(nntp "tux.nsict.org")) (setq gnus-read-active-file 'some) (setq gnus-inhibit-startup-message t) (setq gnus-large-newsgroup 500) ;; --- Internationalization twiddling --- (trap (standard-display-european 1) (let ((im (current-input-mode))) (apply #'set-input-mode (nconc (list (nth 0 im) (nth 1 im) 0) (nthcdr 3 im)))) (set-language-environment "Latin-1")) ;; --- Don't disable any commands --- (mapatoms #'(lambda (sym) (put sym 'disabled nil))) ;; --- Split a wide window --- (mdw-divvy-window) ;; --- Other goodies --- (trap (resize-minibuffer-mode 1)) ;Make minibuffer grow dynamically (auto-compression-mode 1) ;Enable automatic compression (setq dabbrev-case-replace nil) ;Retain case when completing (setq next-line-add-newlines nil) ;Don't add weird newlines (setq split-height-threshold 45) ;Reuse windows where sensible (setq dired-deletion-confirmer ;Make deletion easier in dired (symbol-function 'y-or-n-p)) (setq dired-listing-switches "-alF") ;Do `ls -F' things in dired windows (setq case-fold-file-names nil) ;Don't translate file names (grr...) (setq scroll-step 5) ;Don't scroll too much at a time (setq-default fill-column 77) ;I use rather narrow windows (setq-default comment-column 40) ;Set a standard comment column (setq-default truncate-partial-width-windows nil) (setq diff-switches "-u" ;I like reading unified diffs cvs-diff-flags (list diff-switches)) (setq echo-keystrokes 10) ;Long delay before keystrokes echo (setq ange-ftp-ftp-program-name "pftp") ;Use passive FTP (setq find-ls-option ;Build file lists efficiently '("-print0 | xargs -0r ls -ld" . "ld")) (setq Info-fontify-maximum-menu-size 60000) (setq ispell-dictionary "british" flyspell-default-dictionary "british" ispell-silently-savep t) (trap (require 'uniquify) (setq uniquify-buffer-name-style 'post-forward-angle-brackets) (setq uniquify-after-kill-buffer-p t)) (transient-mark-mode t) (trap (tooltip-mode 0) (tool-bar-mode 0)) (trap (global-auto-revert-mode t)) (setq psgml-html-build-new-buffer nil) (setq cltl2-root-url (mdw-config 'cltl-url)) (setq common-lisp-hyperspec-root (mdw-config 'hyperspec-url)) ;;;----- W3 and URL fetching stuff ------------------------------------------ (let ((proxy (mdw-config 'http-proxy))) (setq url-proxy-services `(("http" . ,proxy) ("ftp" . ,proxy) ("gopher" . ,proxy)))) (setq url-cookie-untrusted-urls '(".")) (setq browse-url-browser-function (mdw-good-url-browser) browse-url-mozilla-program "firefox") (setq w3m-default-display-inline-images t) (setq w3-do-incremental-display t w3-use-menus '(file edit view go bookmark options buffers style search emacs nil help) w3-display-inline-image t w3-keybinding 'info) ;;;----- Calendar configuration --------------------------------------------- ;; --- Trivial stuff for the sunrise/sunset calculations --- (setq calendar-latitude 52.2) (setq calendar-longitude 0.1) (setq calendar-location-name "Cambridge, UK") ;; --- Date format fiddling --- (setq european-calendar-style t) (setq diary-date-forms '((day "[-/]" month "[^-/0-9]") (day " *" monthname "[ \t]*\\(\^M\\|\n\\)") (backup day " *" monthname "\\W+\\<[^*0-9]") (day "[-/]" month "[-/]" year "[^0-9]") (day " *" monthname " *" year "[^0-9]") (year "[-/]" month "[-/]" day "[^0-9]") (dayname "\\W"))) ;; --- Fancy diary handling --- (add-hook 'diary-display-hook 'fancy-diary-display) (setq diary-list-include-blanks t) (add-hook 'list-diary-entries-hook 'sort-diary-entries t) (add-hook 'list-diary-entries-hook 'include-other-diary-files) (add-hook 'mark-diary-entries-hook 'mark-included-diary-files) ;; --- Appointment management --- (add-hook 'diary-hook 'appt-make-list) (setq appt-issue-message t) (setq appt-display-interval 3) (setq appt-message-warning-time 10) ;; --- Cosmetic stuff --- (setq display-time-24hr-format t) (display-time) (trap (if window-system (let ((view-diary-entries-initially t)) (calendar)))) (defvar mdw-black-background t) ;; --- Define more mode hooks for MailCrypt --- (setq mdw-mc-modes '((mdwmail-mode (encrypt . mdwmail-mc-encrypt) (sign . mdwmail-mc-sign)))) ;; --- Load the MailCrypt support --- (trap (and (string-match "linux" (symbol-name system-type)) (progn (require 'mailcrypt-init) (require 'mailcrypt) (setq mc-default-scheme 'mc-scheme-gpg) (setq mc-pgp-user-id "mdw-nsict-pgp") (setq mc-gpg-user-id "mdw-nsict-gpg") (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes)) (setq mc-pgp-always-sign t) (setq mc-gpg-always-sign t) (setq mc-always-replace 'never) (setq mc-passwd-timeout 3600) (setq mc-temp-directory tmpdir) (setq mc-modes-alist (append mc-modes-alist mdw-mc-modes)) (define-key mc-write-mode-map "\C-c/S" 'mc-sign-region) (define-key mc-write-mode-map "\C-c/E" 'mc-encrypt-region) (add-hook 'text-mode-hook 'mc-install-write-mode)))) ;;;----- Other common declarations ------------------------------------------ ;; --- Default frame size --- (setq default-frame-alist (mdw-uniquify-alist '((width . 78) (height . 33) (vertical-scroll-bars . right)) (and window-system '((cursor-type . bar) (cursor-blink . t))) '((cursor-color . "red")) (if mdw-black-background '((background-color . "black") (foreground-color . "white") (background-mode . dark)) '((background-mode . light))) (and (eq window-system 'pm) '((font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850") (menu-font . "8.Helv") (background-color . "lightgrey"))) '((transparency . t)) default-frame-alist)) ;; --- Other frame fiddling --- (setq frame-title-format '("" invocation-name "@" system-name ": %b")) ;; --- Global keymap changes --- (trap (windmove-default-keybindings) (setq windmove-wrap-around t)) (trap (iswitchb-mode)) (global-set-key [f4] 'query-replace-regexp) (global-set-key [f5] 'goto-line) (global-set-key [f6] 'auto-fill-mode) (global-set-key [f7] 'occur) (global-set-key [f8] 'undo) (global-set-key [f9] 'mdw-divvy-window) (global-set-key [insertchar] 'overwrite-mode) (global-set-key "\C-xm" 'vm-mail) (global-set-key "\C-x\C-n" 'skel-create-file) (global-set-key "\C-x4n" 'skel-create-file-other-window) (global-set-key "\C-x5n" 'skel-create-file-other-frame) (global-set-key [delete] 'delete-char) (global-set-key "\C-[\C-m" 'call-last-kbd-macro) (global-set-key "\M-q" 'mdw-fill-paragraph) (global-set-key "\C-h\C-m" 'manual-entry) (global-set-key [mode-line C-mouse-1] 'mouse-tear-off-window) (global-set-key [vertical-scroll-bar C-down-mouse-1] 'mouse-drag-vertical-line) (global-set-key [vertical-scroll-bar C-mouse-1] #'(lambda () (interactive))) (global-set-key [mouse-4] 'mdw-wheel-up) (global-set-key [mouse-5] 'mdw-wheel-down) ;; --- Recognising types of files --- (setq auto-mode-alist (append `(("\\.p[lm]$" . perl-mode) ("\\.m$" . objc-mode) ("\\.mxd$" . c-mode) ("\\.cs" . csharp-mode) ;; ("/[ch]/" . c-mode) (,(concat "/\\(" "\\.stgit\\.msg" "\\|" "\\.git/COMMIT_EDITMSG" "\\|" "svn-commit\\.tmp" "\\|" "svk-commit[^/.]*\\.tmp" "\\)$") . text-mode) (,(concat "^" tmpdir "/\\(" "svk-commit[^/.]*\\.tmp" "\\|" "gitci\\.[^/.]*" "\\|" "cvs[^/.]\\{6\\}" "\\|" "quilt_header\.[^/.]\\{6\\}" "\\)$") . text-mode) ("\\.calc?$" . apcalc-mode) ("/src/linux/.*\\.\\(c\\|h\\|cc\\)$" . linux-c-mode) ("/\\(s\\|sh\\)/" . arm-assembler-mode) ("\\.\\(cmd\\|exec\\|rexx\\)$" . rexx-mode) ("\\.st$" . smalltalk-mode) ("\\.msgs$" . messages-mode) ("/all-cmds\\.in$" . cpp-messages-mode) ("\\.\\(tex\\|dtx\\)$" . latex-mode) ("\\.gc$" . haskell.-mode) (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode) (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\)") . mdwmail-mode)) auto-mode-alist)) (setq interpreter-mode-alist (append `(("runlisp" . lisp-mode)) interpreter-mode-alist)) (setq completion-ignored-extensions (append `(".hc" ".hi") completion-ignored-extensions)) ;; --- Some common local definitions --- (make-variable-buffer-local 'mdw-auto-indent) (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config)) '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook perl-mode-hook cperl-mode-hook python-mode-hook awk-mode-hook tcl-mode-hook TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook tex-mode-hook latex-mode-hook texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook lisp-mode-hook lisp-interaction-mode-hook inferior-lisp-mode-hook slime-repl-mode-hook sml-mode-hook haskell-mode-hook smalltalk-mode-hook rexx-mode-hook arm-assembler-mode-hook)) (global-font-lock-mode t) (defalias 'perl-mode 'cperl-mode) ;;;----- SGML hacking ------------------------------------------------------- (defun mdw-sgml-mode () (interactive) (sgml-mode) (mdw-standard-fill-prefix "") (make-variable-buffer-local 'sgml-delimiters) (setq sgml-delimiters '("AND" "&" "COM" "--" "CRO" "&#" "DSC" "]" "DSO" "[" "DTGC" "]" "DTGO" "[" "ERO" "&" "ETAGO" ":e" "GRPC" ")" "GRPO" "(" "LIT" "\"" "LITA" "'" "MDC" ">" "MDO" "" "PIO" "" "XML-ECOM" "-->" "XML-PIC" "?>" "XML-SCOM" "