;;; -*-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)) (autoload 'cc-mode "cc-mode" nil t) (autoload 'rexx-mode "rexx-mode" nil t) (autoload 'cvs-update "pcl-cvs" nil t) (autoload 'debian-changelog-mode "debian-changelog-mode" nil t) (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 --- (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") (setq browse-url-browser-function 'browse-url-mozilla browse-url-mozilla-program "firefox") (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 "http://metalzone.distorted.org.uk/doc/cltl/") (setq common-lisp-hyperspec-root "http://metalzone.distorted.org.uk/doc/hyperspec/") ;;;----- 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) ;; ("/[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\\}" "\\|" "\\)$") . 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) ("\\.\\(tex\\|dtx\\)$" . latex-mode) ("\\.gc$" . haskell.-mode) (,(concat "^" (getenv "HOME") "/News/") . mdwmail-mode) (,(concat "^" tmpdir "/\\(SLRN\\|snd\\|pico\\)") . mdwmail-mode)) auto-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) ;;;----- Rootly editingness ------------------------------------------------- (eval-after-load "tramp" '(progn (setq tramp-methods (mdw-uniquify-alist `(("become" (tramp-connection-function tramp-open-connection-su) (tramp-remote-sh "/bin/sh") (tramp-login-program "become") (tramp-copy-program nil) (tramp-copy-args nil) (tramp-copy-keep-date-arg nil) (tramp-login-args ("TERM=dumb" "%u"))) ("really" (tramp-connection-function tramp-open-connection-su) (tramp-login-program "really") (tramp-login-args ("-u" "%u" "--" "env" "TERM=dumb" "/bin/sh")) (tramp-copy-program nil) (tramp-copy-args nil) (tramp-copy-keep-date-arg nil) (tramp-remote-sh "/bin/sh")) ,@tramp-methods))) (setq tramp-multi-connection-function-alist (mdw-uniquify-alist '(("bc" tramp-multi-connect-su "become TERM=dumb %u%n")) '(("r" tramp-multi-connect-su "really -u %u%n")) tramp-multi-connection-function-alist)) (setq tramp-default-method "ssh") (setq tramp-default-method-alist `(("\\`localhost\\'" "" ,(cond ((executable-find "become") "become") ((executable-find "really") "really") (t "su"))))))) ;;;----- General fontification ---------------------------------------------- ;; --- Configure lazy fontification --- (setq font-lock-support-mode 'lazy-lock-mode) ; (setq lazy-lock-defer-contextually t) (setq lazy-lock-defer-time nil) (setq font-lock-maximum-decoration 3) (setq lazy-lock-minimum-size 0) (setq lazy-lock-stealth-time 5) (setq lazy-lock-stealth-lines 100) (setq lazy-lock-stealth-verbose t) (add-hook 'after-make-frame-functions 'mdw-do-set-font) (add-hook 'term-setup-hook (lambda () (mdw-do-set-font (selected-frame)))) (add-hook 'window-setup-hook (lambda () (mdw-do-set-font (selected-frame)))) (add-hook 'c-mode-hook 'mdw-fontify-c-and-c++ t) (add-hook 'objc-mode-hook 'mdw-fontify-c-and-c++ t) (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t) (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8))) (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t) (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t) (add-hook 'java-mode-hook 'mdw-fontify-java t) (add-hook 'awk-mode-hook 'mdw-fontify-awk t) (add-hook 'perl-mode-hook 'mdw-fontify-perl t) (add-hook 'cperl-mode-hook 'mdw-fontify-perl t) (setq-default py-indent-offset 2) (add-hook 'python-mode-hook 'mdw-fontify-python t) (setq-default tcl-indent-level 2) (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t) (add-hook 'rexx-mode-hook 'mdw-fontify-rexx t) (setq sml-nested-if-indent t) (setq sml-case-indent nil) (setq sml-indent-level 4) (setq sml-type-of-indent nil) (add-hook 'sml-mode-hook 'mdw-fontify-sml t) (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t) (setq-default haskell-indent-offset 2) (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t) (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t) (setq LaTeX-table-label "tbl:") (setq-default TeX-master nil) ;; (setq TeX-parse-self t) ;; (setq TeX-auto-save t) (setq TeX-auto-untabify nil) (add-hook 'TeX-mode-hook 'mdw-fontify-tex t) (add-hook 'tex-mode-hook 'mdw-fontify-tex t) (add-hook 'LaTeX-mode-hook 'mdw-fontify-tex t) (add-hook 'latex-mode-hook 'mdw-fontify-tex t) (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode) (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t) (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t) (add-hook 'emacs-lisp-mode-hook 'mdw-fontify-lispy t) (add-hook 'scheme-mode-hook 'mdw-fontify-lispy t) (add-hook 'lisp-mode-hook 'mdw-fontify-lispy t) (add-hook 'inferior-lisp-mode-hook 'mdw-fontify-lispy t) (add-hook 'lisp-interaction-mode-hook 'mdw-fontify-lispy t) (add-hook 'slime-repl-mode-hook 'mdw-fontify-lispy t) (add-hook 'lisp-mode-hook 'mdw-common-lisp-indent t) (require 'slime) (slime-setup :autodoc t) (trap (require 'xscheme)) (setq-default xscheme-process-command-line "scheme -large -emacs") (add-hook 'inferior-lisp-mode-hook #'(lambda () (local-set-key "\C-m" 'comint-send-and-indent)) t) (add-hook 'text-mode-hook 'mdw-text-mode t) ;;;----- Shell mode --------------------------------------------------------- ;; --- Make the shell mode aware of my prompt --- (setq shell-prompt-pattern "^[^]#$%>»\n]*[]#$%>»] *") (setq comint-password-prompt-regexp (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)" "[Pp]assword\\|pass phrase\\):\\s *\\'")) ;; --- Notice passwords, and make C-a work right --- (add-hook 'shell-mode-hook #'mdw-sh-mode-setup) (add-hook 'term-mode-hook #'mdw-term-mode-setup) ;;;----- Finishing touches -------------------------------------------------- (trap (select-window mdw-init-window)) (provide 'emacs-init) ;;;----- Emacs customization crud ------------------------------------------- (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(url-cookie-untrusted-urls (quote ("."))) '(url-proxy-services (quote (("http" . "tux.nsict.org:3128") ("ftp" . "tux.nsict.org:3128") ("gopher" . "tux.nsict.org:3128")))) '(w3-do-incremental-display t) '(w3-honor-stylesheets nil) '(w3-use-menus (quote (file edit view go bookmark options buffers style search emacs nil help))) '(w3m-display-inline-image t) '(w3m-key-binding (quote info))) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. ) ;;;----- That's all, folks --------------------------------------------------