emacs: Highlight full tables of contents in Info.
[profile] / emacs
diff --git a/emacs b/emacs
index 0d640fe..8abc4af 100644 (file)
--- a/emacs
+++ b/emacs
@@ -1,6 +1,4 @@
-;;; -*-emacs-lisp-*-
-;;;
-;;; $Id: .emacs,v 1.11 1997/01/01 18:47:09 mdw Exp $
+;;; -*- mode: emacs-lisp; coding: utf-8 -*-
 ;;;
 ;;; Emacs configuration file
 ;;;
 
 ;; --- 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)
+(maybe-autoload 'git-blame-mode "git-blame" nil t)
+(maybe-autoload 'stgit "stgit" nil t)
+(maybe-autoload 'nc-timesheet-prepare "nc-timesheet" nil t nil)
+(maybe-autoload 'nc-timesheet-submit "nc-timesheet" nil t nil)
+
 (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")
+     (not mdw-fast-startup)
      (load "quilt"))
 
-(trap
-  (or (fboundp 'make-regexp)
-      (load "make-regexp")))
-
-(trap (require 'tex-site))
+(trap (or mdw-fast-startup (require 'tex-site)))
 
 ;; --- Skeleton stuff ---
 
-(trap (require 'skel-init))
+(trap (or mdw-fast-startup (require 'skel-init)))
 
 ;; --- Window system-dependent things ---
 
 (setq backup-by-copying-when-linked t)
 (setq backup-by-copying-when-mismatch t)
 
+(setq mdw-backup-disable-regexps
+      '("/\\.git/COMMIT_EDITMSG$"
+       "/\\.stgit\\(-edit\\.txt\\|msg\\.txt\\|\\.msg\\)$"))
+
+;; --- Safe variables ---
+
+(setq safe-local-variable-values
+      '((make-backup-files . nil)))
+
 ;; --- Calculator fiddling ---
 
 (setq calc-settings-file "~/.emacs-calc")
 (setq rmail-display-summary t)
 (setq rmail-file-name "~/Mail/rmail")
 
-;; --- GNUS configuration ---
+;; --- Customization ---
+
+(setq custom-file "~/.emacs-custom")
+(trap (load custom-file))
 
-(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)
+(trap (load "~/.emacs-local"))
 
 ;; --- Internationalization twiddling ---
 
 (trap
-  (standard-display-european 1)
+  ;; Have top-bit-set characters work properly in terminals.
   (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"))
+          (nconc (list (nth 0 im) (nth 1 im) 0) (nthcdr 3 im)))))
 
 ;; --- Don't disable any commands ---
 
 
 (mdw-divvy-window)
 
+;; --- Postscript printing ---
+
+(setq ps-paper-type 'a4
+      ps-print-color-p nil
+      ps-landscape-mode t
+      ps-number-of-columns 3
+      ps-font-family 'Courier
+      ps-font-size 4)
+
+;; --- Splash screen stuff ---
+
+(or window-system
+    (setq inhibit-splash-screen t
+         inhibit-startup-message t))
+
 ;; --- Other goodies ---
 
 (trap (resize-minibuffer-mode 1))      ;Make minibuffer grow dynamically
 (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 display-buffer-reuse-frames nil  ;Don't confuse me by showing buffers
+      iswitchb-default-method 'samewindow) ;in other random frames
 (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 wdired-allow-to-change-permissions t)
 (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 woman-use-own-frame nil)         ;Keep man pages somewhere sensible
 (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 bookmark-save-flag 0)            ;Save bookmarks automatically
+(setq Info-fontify-maximum-menu-size 100000)
+(setq set-mark-command-repeat-pop t)
+(setq ispell-program-name "aspell"
+      ispell-local-dictionary "en_GB-ize-w_accents"
+      flyspell-default-dictionary "en_GB-ize-w_accents"
       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)
+(setq mark-even-if-inactive t)
 (trap
   (tooltip-mode 0)
   (tool-bar-mode 0))
-(trap (global-auto-revert-mode t))
+(trap (or mdw-fast-startup (global-auto-revert-mode t)))
 (setq psgml-html-build-new-buffer nil)
 
+(defvar mdw-black-background t)
+
+(eval-after-load "outline"
+  '(progn
+     (trap (require 'foldout))
+     (define-key outline-mode-prefix-map [?\C-r] 'reveal-mode)
+     (define-key outline-mode-prefix-map [?\C--] 'mdw-outline-collapse-all)))
+
 (setq cltl2-root-url (mdw-config 'cltl-url))
 (setq common-lisp-hyperspec-root (mdw-config 'hyperspec-url))
 
 
 ;;;----- Calendar configuration ---------------------------------------------
 
+(setq diary-file "~/etc/diary")
+
 ;; --- Trivial stuff for the sunrise/sunset calculations ---
 
 (setq calendar-latitude 52.2)
 (setq calendar-longitude 0.1)
 (setq calendar-location-name "Cambridge, UK")
 
+;; --- Holidays ---
+
+(and (not mdw-fast-startup)
+     (trap
+       (require 'ew-hols)
+       (setq other-holidays (append english-and-welsh-bank-holidays
+                                   other-holidays))))
+
 ;; --- Date format fiddling ---
 
 (setq european-calendar-style t)
       (let ((view-diary-entries-initially t))
        (calendar))))
 
-(defvar mdw-black-background t)
+;;;----- MailCrypt ----------------------------------------------------------
 
 ;; --- Define more mode hooks for MailCrypt ---
 
 
 (trap
   (and (string-match "linux" (symbol-name system-type))
+       (not mdw-fast-startup)
        (progn (require 'mailcrypt-init)
              (require 'mailcrypt)
              (setq mc-default-scheme 'mc-scheme-gpg)
         (vertical-scroll-bars . right))
        (and window-system
            '((cursor-type . bar)
-             (cursor-blink . t)))
+             (cursor-blink . t)
+             (left-fringe . 5)
+             (right-fringe . 5)
+             (scroll-bar-width . 15)))
        '((cursor-color . "red"))
        (if mdw-black-background
           '((background-color . "black")
 ;; --- Global keymap changes ---
 
 (trap
-  (windmove-default-keybindings)
-  (setq windmove-wrap-around t))
+  (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 [?\C-x ?w left] 'windmove-left)
+(global-set-key [?\C-x ?w ?h] 'windmove-left)
+(global-set-key [?\C-x ?w up] 'windmove-up)
+(global-set-key [?\C-x ?w ?k] 'windmove-up)
+(global-set-key [?\C-x ?w down] 'windmove-down)
+(global-set-key [?\C-x ?w ?j] 'windmove-down)
+(global-set-key [?\C-x ?w right] 'windmove-right)
+(global-set-key [?\C-x ?w ?l] 'windmove-right)
+(global-set-key [?\C-x ?g ?l] 'org-store-link)
+(global-set-key [?\C-x ?g ?a] 'org-agenda)
+(global-set-key [?\C-x ?t ?i] 'timeclock-in)
+(global-set-key [?\C-x ?t ?c] 'timeclock-change)
+(global-set-key [?\C-x ?t ?o] 'timeclock-out)
+(global-set-key [?\C-x ?t ?r] 'timeclock-reread-log)
+(global-set-key [?\C-x ?t ?w] 'timeclock-workday-remaining-string)
+(global-set-key [?\C-x ?t ?s] 'timeclock-status-string)
+(global-set-key [?\C-x ?t ?p] 'nc-timesheet-prepare)
+(global-set-key [?\C-x ?t ?\C-m] 'nc-timesheet-submit)
+(global-set-key [?\M-#] 'calc-dispatch)
+(global-set-key [?\C-x ?/] 'auto-fill-mode)
+(global-set-key [?\C-x ?w ?d] '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 [?\C-x ?m] 'vm-mail)
+(global-set-key [?\C-x ?\C-n] 'skel-create-file)
+(global-set-key [?\C-x ?4 ?n] 'skel-create-file-other-window)
+(global-set-key [?\C-x ?5 ?n] '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 [?\M-q] 'mdw-fill-paragraph)
+(global-set-key [?\C-h ?\C-m] 'manual-entry)
+(global-set-key [C-M-backspace] 'backward-kill-sexp)
 (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 ---
 
                ("\\.m$" . objc-mode)
                ("\\.mxd$" . c-mode)
                ("\\.cs" . csharp-mode)
+               ("\\.org$" . org-mode)
                ;; ("/[ch]/" . c-mode)
                (,(concat "/\\("
                          "\\.stgit\\.msg" "\\|"
 
 (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 asm-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
+         csharp-mode-hook perl-mode-hook cperl-mode-hook
+         python-mode-hook awk-mode-hook tcl-mode-hook
+         asm-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 erlang-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" "<!" "MINUS" "-" "MSC" "]]" "NESTC" "{"
-         "NET" "}" "OPT" "?" "OR" "|" "PERO" "%" "PIC" ">" "PIO" "<?"
-         "PLUS" "+" "REFC" "." "REP" "*" "RNI" "#" "SEQ" "," "STAGO" ":"
-         "TAGC" "." "VI" "=" "MS-START" "<![" "MS-END" "]]>"
-         "XML-ECOM" "-->" "XML-PIC" "?>" "XML-SCOM" "<!--" "XML-TAGCE" "/>"
-         "NULL" ""))
-  (setq major-mode 'mdw-sgml-mode)
-  (setq mode-name "[mdw] SGML")
-  (run-hooks 'mdw-sgml-mode-hook))
-
 ;;;----- Rootly editingness -------------------------------------------------
 
 (eval-after-load "tramp"
 (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t)
 
 (add-hook 'java-mode-hook 'mdw-fontify-java t)
+(add-hook 'csharp-mode-hook 'mdw-fontify-csharp t)
 
 (add-hook 'awk-mode-hook 'mdw-fontify-awk t)
 
 
 (setq-default py-indent-offset 2)
 (add-hook 'python-mode-hook 'mdw-fontify-python t)
+(setq py-python-command-args `("-i" "-colors" ,(if mdw-black-background
+                                                  "Linux"
+                                                "LightBG")))
 
 (setq-default tcl-indent-level 2)
 (add-hook 'tcl-mode-hook 'mdw-fontify-tcl t)
 (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t)
 (setq-default haskell-indent-offset 2)
 
+(add-hook 'erlang-mode-hook 'mdw-fontify-erlang t)
+
 (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t)
 (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t)
 
 (add-hook 'latex-mode-hook 'mdw-fontify-tex t)
 
 (add-hook 'sh-mode-hook #'mdw-setup-sh-script-mode)
+(add-hook 'autoconf-mode-hook #'mdw-setup-m4)
+(add-hook 'm4-mode-hook #'mdw-setup-m4)
 
 (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t)
 (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk 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)
-(trap
-  (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)
        ("^pdf$" "." "evince %o")
        ("^html?$" "." "netscape %o")))
 
+;;;----- SLIME setup --------------------------------------------------------
+
+(trap
+ (if (not mdw-fast-startup)
+     (progn
+       (require 'slime-autoloads)
+       (slime-setup '(slime-autodoc slime-c-p-c)))))
+
+(let ((stuff '((cmucl ("cmucl"))
+              (sbcl ("sbcl") :coding-system utf-8-unix)
+              (clisp ("clisp") :coding-system utf-8-unix))))
+  (or (boundp 'slime-lisp-implementations)
+      (setq slime-lisp-implementations nil))
+  (while stuff
+    (let* ((head (car stuff))
+          (found (assq (car head) slime-lisp-implementations)))
+      (setq stuff (cdr stuff))
+      (if found
+         (rplacd found (cdr head))
+       (setq slime-lisp-implementations
+             (cons head slime-lisp-implementations))))))
+(setq slime-default-lisp 'sbcl)
+
+;;;----- Blogging -----------------------------------------------------------
+
+(setq weblogger-config-alist
+      '(("vox"
+        ("user" . "mdw")
+        ("server-url" . "http://vox.distorted.org.uk/admin/mt-xmlrpc.cgi")
+        ("weblog" . "1"))))
+
 ;;;----- Shell mode ---------------------------------------------------------
 
 ;; --- Make the shell mode aware of my prompt ---
 
-(setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *")
+(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)
+(setq shell-font-lock-keywords nil)
 
 (add-hook 'term-mode-hook #'mdw-term-mode-setup)