chiark / gitweb /
Found on mariner (already did .bashrc and .emacs)
[ian-dotfiles.git] / home / emacs / ian.el
index d68ac348218e6402deeec4cc4fa77b72f2e2649b..d08f100d956e10fe7c24f4ebc1eeb1d1a83d0476 100644 (file)
@@ -1,20 +1,11 @@
 ; This is my real emacs start-up file (for chiark).
 ; 
-
-(defalias 'perl-mode 'cperl-mode)
-(setq cperl-invalid-face nil
-      cperl-indent-level 4
-      cperl-continued-statement-offset 4)
-
 (make-variable-buffer-local 'indent-line-function)
 ; Un-disable narrow and eval-expression
 (put 'narrow-to-region 'disabled nil)
 (put 'eval-expression 'disabled nil)
 (standard-display-european t)
 ;
-(setq browse-url-netscape-program "mozilla")
-(setq common-lisp-hyperspec-root "/usr/share/doc/hyperspec/")
-;
 ; Make sure we don't disturb links or change ownership, use numbers
 (setq backup-by-copying-when-mismatch t)
 (setq backup-by-copying-when-linked t)
 (setq enable-local-variables 'ask-me)
 (setq enable-recursive-minibuffers t)
 (setq compile-command "make")
-(setq next-line-add-newlines t)
+(setq compilation-context-lines 0)
+(setq compilation-skip-threshold 0)
+(setq compilation-scroll-output 'first-error)
+(global-set-key "\18\\" 'previous-error)
 (setq diff-switches "-u")
-(setq line-move-visual nil)
 (display-time)
+(setq next-line-add-newlines t)
 ;
 (set-variable 'search-repeat-char 28)
-(set-fringe-mode (cons 0 nil))
 (if (string-match "^19\." emacs-version)
     (progn
-;      (setq file-name-handler-alist     ; Disable nasty auto-loading of ange-ftp
-;            (delq (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)
-;                  file-name-handler-alist))
+      (setq file-name-handler-alist     ; Disable nasty auto-loading of ange-ftp
+            (delq (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)
+                  file-name-handler-alist))
       (require 'find-alternate-18style)
       (defun unset-down-mouse-23 ()
         (local-set-key [mouse-2] 'mouse-yank-at-click)
                 (function (lambda ()
                             (local-set-key " " 'scroll-up)
                             (local-set-key "\7f" 'scroll-down))))
+      (add-hook 'sh-mode-hook
+                (function (lambda ()
+                            (local-set-key "<" 'self-insert-command))))
       (define-key isearch-mode-map "\1c" 'isearch-repeat-forward)
       (define-key isearch-mode-map "\1d" 'isearch-quote-char)))
 ;
 (menu-bar-mode -1)
+(tool-bar-mode -1)
 (defun terminal-keybindings ()
   "This function should be called by the term-setup-hook mechanism"
   (interactive)
@@ -72,7 +69,7 @@
   ; Set keybindings generally (including I-search on C-\)
 ;  (global-set-key "   " 'self-insert-command)
   (global-set-key "\1c" 'isearch-forward)
-;  (global-set-key "\r" 'newline)
+  (global-set-key "\r" 'newline-and-indent)
   (global-set-key "\ f" 'set-mark-command)
   (global-set-key "\1d" 'quoted-insert)
   ;
@@ -91,7 +88,7 @@
   (global-set-key "\18\12" 'bury-buffer)
   (global-set-key "\18\v" 'quicker-compile)
   (global-set-key "\18\18" 'exchange-point-and-mark)
-  (global-set-key "\18\1a" 'load-tramp)
+  (global-set-key "\18\1a" 'load-ange-ftp)
   (global-set-key "\184\16" 'scroll-other-window)
   (global-set-key "\184m" 'vm-mail-other-window)
   (global-set-key "\189" 'vm-visit-folder)
   (global-set-key "\eOB" 'next-line))
 (setq term-setup-hook 'terminal-keybindings)     ; remap keys in due course
 ;
+(setq frame-title-format
+      '(multiple-frames
+       (:eval 
+        (let*
+            ((buf (current-buffer))
+             (leaf (buffer-name buf))
+             (dir default-directory))
+          (if dir
+              (let*
+                  ((dir (abbreviate-file-name dir))
+                   (node (replace-regexp-in-string "\\..*" "" system-name)))
+                (concat leaf "  " node ":" dir))
+            leaf)))
+       ("" invocation-name "@" system-name)))
+;(setq frame-title-format
+;      '(multiple-frames
+;      (:eval 
+;       (let*
+;           ((buf (current-buffer))
+;            (fn (buffer-file-name buf)))
+;         (if fn
+;             (let*
+;                 ((fn (abbreviate-file-name fn))
+;                  (dir (file-name-directory fn))
+;                  (leaf (file-name-nondirectory fn))
+;                  (node (replace-regexp-in-string "\\..*" "" system-name)))
+;               (concat leaf "  " node ":" dir))
+;           (buffer-name buf))))
+;      ("" invocation-name "@" system-name)))
+;
 ; Autoload definitions
 (autoload 'tar-mode "tar-mode")
 (autoload 'uncompress-while-visiting "uncompress")
 ; (autoload 'c++-mode "c++-mode" "Mode for editing C and C++ programs" t)
 (autoload 'hide-ifdef-mode "hideif" "For editing code with #ifdefs" t)
-;(setq-default indent-tabs-mode nil)
+(setq-default indent-tabs-mode nil)
 (autoload 'dired-find-alternate-file "dired-alternate" "Find alternately" t)
 (autoload 'dired-run-file "dired-alternate" "Run this file" t)
 (autoload 'perl-mode "perl-mode" "Mode for Perl code" t)
 ; (autoload 'rmail "rmail-fixed" "Patched mail reader" t)
 (autoload 'quicker-compile "quicker-compile" "Patched Compile mode" t)
 
-(autoload 'vm "vm" "Start VM on your primary inbox." t)
-(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
-(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
-(autoload 'vm-mode "vm" "Run VM major mode on a buffer" t)
-(autoload 'vm-mail "vm" "Send a mail message using VM." t)
-(autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t)
+;(autoload 'vm "vm" "Start VM on your primary inbox." t)
+;(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
+;(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
+;(autoload 'vm-mode "vm" "Run VM major mode on a buffer" t)
+;(autoload 'vm-mail "vm" "Send a mail message using VM." t)
+;(autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t)
+;
+;(require 'vm-autoload)
 ;
 ; (autoload 'info "info-fixed" "Patched info browser" t)
 (setq shell-mode-hook
       '(lambda ()
          (make-variable-buffer-local 'scroll-step)
          (setq scroll-step 1)))
-(setq inferior-lisp-program "sbcl")
-;(setq jit-lock-chunk-size 100
-;      jit-lock-stealth-time 1.00)
+; (setq inferior-lisp-program "kcl")
 (setq dired-mode-hook
       '(lambda ()
         (define-key dired-mode-map "F" 'dired-find-alternate-file)
 ;                ("\\.tar$" . tar-mode)
                 ("\\.pl$" . perl-mode)
                 ("\\.ci$" . tex-mode)
-                ("\\.asm$" . fundamental-mode)
                 ("\\.Z$" . uncompress-while-visiting))
               auto-mode-alist))
 (setq interpreter-mode-alist
                         (local-set-key ";" 'self-insert-command)))
 (setq c++-mode-hook '(lambda ()
                        (hide-ifdef-mode 1)
-                      (local-set-key "," 'self-insert-command)
                        (local-set-key ":" 'electric-c++-terminator)))
 ; c++-electric-colon
 (setq c-mode-hook '(lambda ()
                      (hide-ifdef-mode 1)
                      (c-set-offset 'substatement-open 0 nil)
-                    (local-set-key "," 'self-insert-command)
-                    (local-set-key ";" 'self-insert-command)
-                    (local-set-key "/" 'self-insert-command)
-                    (local-set-key "*" 'self-insert-command)
-                    (local-set-key "#" 'self-insert-command)
                     (local-set-key "(" 'self-insert-command)
                     (local-set-key ")" 'self-insert-command)
+                    (local-set-key ";" 'self-insert-command)
                     (local-set-key "{" 'self-insert-command)
                      (local-set-key "\r" 'newline-and-indent)))
 (setq c-hanging-comment-ender-p nil)
@@ -289,12 +310,12 @@ then call send-and-exit."
   (insert-file (concat vm-folder-directory ",Formletter")))
 ;
 ; This function bound to C-x C-z
-(defun load-tramp ()
-  "Load tramp using require, if it isn't loaded already"
+(defun load-ange-ftp ()
+  "Load ange-ftp using require, if it isn't loaded already"
   (interactive)
-  (message "Loading tramp...")
-  (require 'tramp) ; -extended
-  (message "Loading tramp...done"))
+  (message "Loading ange-ftp...")
+  (require 'ange-ftp) ; -extended
+  (message "Loading ange-ftp...done"))
 ;
 ; This function bound to M-+
 (defun toggle-truncate-lines ()
@@ -329,6 +350,9 @@ then call send-and-exit."
                         (concat "^" item " *\\((.*)\\)?$"))))
                   list)))
 ;
+;
+(setq mail-signature nil)
+;
 ; BBDB
 (setq bbdb-north-american-phone-numbers-p nil
       bbdb/mail-auto-create-p t
@@ -337,7 +361,7 @@ then call send-and-exit."
       bbdb-message-caching-enabled t)      
 ;
 ; VM stuff
-;(load-file "~/private/private.el")
+(load-file "~/private/private.el")
 (if (file-exists-p "~/private/private2.el")
   (load-file "~/private/private2.el"))
 (setq vm-included-text-attribution-format "%F writes (\"%s\"):\n"
@@ -350,6 +374,7 @@ then call send-and-exit."
       vm-auto-next-message nil
       vm-jump-to-new-messages nil
       vm-jump-to-unread-messages nil
+      vm-auto-displayed-mime-content-types '("text" "multipart")
       vm-mime-digest-discard-header-regexp "only-drop-this-header"
       vm-preview-lines nil
       vm-included-text-prefix "> "
@@ -385,40 +410,19 @@ then call send-and-exit."
       mail-archive-file-name "~/mail/Outbound"
 
 
-      vm-spool-files
-      '((vm-primary-inbox "/var/spool/mail/ian"
-                         "~/mail/INBOX.CRASH")
-        (vm-primary-inbox "~/News/r" "~/mail/INBOX.CRASH")
-       (vm-primary-inbox "~/mbox" "~/mail/INBOX.CRASH")
-       (vm-primary-inbox "~/mail/Outbound" "~/mail/INBOX.CRASH")
-       (vm-primary-inbox "~/mail/Import" "~/mail/INBOX.CRASH")
-       (vm-primary-inbox "~/mail/Record" "~/mail/INBOX.CRASH")
-       (vm-sinbin-inbox "/var/spool/mail/ian" "~/mail/SINBOX.CRASH"))
+      vm-spool-files (list
+                      "~/mbox"
+                      "~/mail/Outbound"
+                      "~/mail/Record"
+                      "~/mail/Import"
+                      "~/mail/inbox"
+                      "/var/mail/iwj"
+;                      "imap-ssl:mail.citrix.com:993:inbox:login:ianj:*"
+;                      (concat "imap-ssl:mail.citrix.com:993:inbox:cram-md5:ianj:*" ijackson-pop-password)
+                      "/u/ijackson/mail/INBOX.CRASH"
+                      "~/News/r")
       vm-startup-with-summary t
 
-      user-mail-address "ijackson@chiark.greenend.org.uk"
-
-
-;      vm-spool-files
-;      (list
-;       (list vm-primary-inbox "~/mbox" "~/mail/INBOX.CRASH")
-;       (list vm-primary-inbox "~/mail/Outbound" "~/mail/INBOX.CRASH")
-;       (list vm-primary-inbox "~/mail/Record" "~/mail/INBOX.CRASH")
-;       (list vm-primary-inbox "~/mail/Import" "~/mail/INBOX.CRASH")
-;       (list vm-primary-inbox "/var/spool/mail/ian" "~/mail/INBOX.CRASH")
-;       (list vm-primary-inbox "~/News/r" "~/mail/INBOX.CRASH")
-;       (list vm-sysadmin-inbox "~/mbox" "~/mail/SINBOX.CRASH")
-;       (list vm-sysadmin-inbox "~/mail/SOutbound" "~/mail/SINBOX.CRASH")
-;       (list vm-sysadmin-inbox "~/mail/Import" "~/mail/SINBOX.CRASH")
-;       (list vm-sysadmin-inbox "/var/spool/mail/sysadmin" "~/mail/SINBOX.CRASH")
-; (list "/u/ijackson/mail/INBOX" "/u/ijackson/mbox" "/u/ijackson/mail/INBOX.CRASH")
-; (list "/u/ijackson/mail/INBOX" "/u/ijackson/mail/Outbound"
-;       "/u/ijackson/mail/INBOX.CRASH")
-; (list "/u/ijackson/mail/INBOX" "/u/ijackson/mail/Record" "/u/ijackson/mail/INBOX.CRASH")
-; (list "/u/ijackson/mail/INBOX" "/u/ijackson/mail/Import" "/u/ijackson/mail/INBOX.CRASH")
-;        (list "/u/ijackson/mail/INBOX"
-;         (concat "localhost:110:pass:ijackson:" ijackson-pop-password)
-;         "/u/ijackson/mail/INBOX.CRASH"))
       vm-startup-with-summary nil
       vm-summary-format "%3n %a %2d %3m  %-19.19F  %s\n"
       mail-archive-file-name "~/mail/Outbound"
@@ -428,27 +432,27 @@ then call send-and-exit."
           '(lambda ()
              (local-set-key "Q" 'vm-quit)
              (local-set-key "q" "###Q")))
-(add-hook 'mail-mode-hook
-          '(lambda ()
-             (if (and (boundp 'folder-buffer)
-                      folder-buffer
-                      (string= (buffer-file-name folder-buffer)
-                               (file-truename vm-sysadmin-inbox)))
-                 (progn
-                   (make-local-variable 'vm-mail-header-from)
-                   (setq vm-mail-header-from
-                         "sysadmin@chiark.greenend.org.uk (Ian Jackson)")
-                   (make-local-variable 'mail-archive-file-name)
-                   (setq mail-archive-file-name
-                         "~/mail/SOutbound")))))
-;
-;(defun vmi ()
+;(add-hook 'mail-mode-hook
+;          '(lambda ()
+;             (if (and (boundp 'folder-buffer)
+;                      folder-buffer
+;                      (string= (buffer-file-name folder-buffer)
+;                               (file-truename vm-sysadmin-inbox)))
+;                 (progn
+;                   (make-local-variable 'vm-mail-header-from)
+;                   (setq vm-mail-header-from
+;                         "sysadmin@chiark.greenend.org.uk (Ian Jackson)")
+;                   (make-local-variable 'mail-archive-file-name)
+;                   (setq mail-archive-file-name
+;                         "~/mail/SOutbound")))))
+;
+;;(defun vmi ()
 ;  (interactive)
 ;  (vm "/u/ijackson/mail/INBOX"))
 ;;
-(defun vms ()
-  (interactive)
-  (vm vm-sinbin-inbox))
+;(defun vms ()
+;  (interactive)
+;  (vm vm-sinbin-inbox))
 ;
 (defun make-session ()
   "Makes this emacs hard to kill by requiring ^X^Cy to kill it
@@ -458,20 +462,20 @@ instead of just ^X^C."
   (global-set-key "\18\ 3y" 'save-buffers-kill-emacs))
 ;
 ; Fix problems with M-| setting window title of emacs' parent xterm
-(defun envdelete-term-termcap-windowid (list)
-  (let ((l list))
-    (mapcar '(lambda (x)
-               (if x (delq x l)))
-            (mapcar '(lambda (x)
-                       (if (or (string-match "^TERM=" x)
-                               (string-match "^TERMCAP=" x)
-                               (string-match "^WINDOWID=" x))
-                           x
-                         nil))
-                    l))
-    l))
-(setq process-environment
-      (envdelete-term-termcap-windowid process-environment))
+;(defun envdelete-term-termcap-windowid (list)
+;  (let ((l list))
+;    (mapcar '(lambda (x)
+;               (if x (delq x l)))
+;            (mapcar '(lambda (x)
+;                       (if (or (string-match "^TERM=" x)
+;                               (string-match "^TERMCAP=" x)
+;                               (string-match "^WINDOWID=" x))
+;                           x
+;                         nil))
+;                    l))
+;    l))
+;(setq process-environment
+;      (envdelete-term-termcap-windowid process-environment))
 ;
 (defun add-insertion-keys (table)
   "Adds keybindings according to TABLE.  Each element of
@@ -527,4 +531,51 @@ The citation string is taken from cite-string."
            (> (point-max) (point)))
         (insert cite-string)))))
 ;
+(blink-cursor-mode nil)
+(setq c-basic-offset 4)
+(setq indent-tabs-mode 4)
+;
+(require 'tramp)
+(setq tramp-default-proxies-alist
+      (append '(("names\\.colo\\.xensource\\.com"
+                 "root" "/ssh:names.colo.xensource.com:")
+                ("colo-dns1\\.colo\\.xensource\\.com" "root"
+                 "/ssh:ianj@colo-dns1.colo.xensource.com:"))
+              tramp-default-proxies-alist))
+; /sudo:root@names.colo.xensource.com:/etc/bind/xen.org.zone
+; /sudo:root@colo-dns1.colo.xensource.com:/etc/bind/xensource.com.zone
+
+
+
+(defun hack-dir-local-variables ()
+  "Read per-directory local variables for the current buffer.
+Store the directory-local variables in `dir-local-variables-alist'
+and `file-local-variables-alist', without applying them."
+  (when (and enable-local-variables
+            (buffer-file-name))
+    ;; Find the variables file.
+    (let ((variables-file (dir-locals-find-file (buffer-file-name)))
+         (class nil)
+         (dir-name nil))
+      (cond
+       ((stringp variables-file)
+       (setq dir-name (file-name-directory (buffer-file-name)))
+       (setq class (dir-locals-read-from-file variables-file)))
+       ((consp variables-file)
+       (setq dir-name (nth 0 variables-file))
+       (setq class (nth 1 variables-file))))
+      (when class
+       (let ((variables
+              (dir-locals-collect-variables
+               (dir-locals-get-class-variables class) dir-name nil)))
+         (when variables
+           (dolist (elt variables)
+             (unless (memq (car elt) '(eval mode))
+               (setq dir-local-variables-alist
+                     (assq-delete-all (car elt) dir-local-variables-alist)))
+             (push elt dir-local-variables-alist))
+           (hack-local-variables-filter variables dir-name)))))))
+
+(delete ".git/" completion-ignored-extensions)
+
 ; End of this file.