From: Ian Jackson Date: Wed, 16 Dec 2015 20:49:27 +0000 (+0000) Subject: Import ~/emacs from zealot X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=ian-dotfiles.git;a=commitdiff_plain;h=bfecc94125841b9f04e8321974d5c2eaa5032d54 Import ~/emacs from zealot --- diff --git a/home/emacs/dired-alternate.el b/home/emacs/dired-alternate.el new file mode 100644 index 0000000..8c6c258 --- /dev/null +++ b/home/emacs/dired-alternate.el @@ -0,0 +1,30 @@ +; dired-alternate.el +; (C)1991 Ian Jackson +; This file is placed under the protection of the GNU General Public Licence. +; +; Patch to make "F" in dired-mode replace the current (dired) buffer with +; a buffer visiting the file the cursor is on. +; +; Also new dired-run-file function. + +(defun dired-find-alternate-file () + "Like dired-find-file and find-alternate-file put together" + (interactive) + (find-alternate-file (dired-get-filename))) + +(defun dired-run-file () + "Runs the file pointed to in dired - output if any is put in the *Shell Command Output* buffer" + (interactive) + (let ((file (dired-get-filename)) + (shelco (get-buffer-create "*Shell Command Output*")) + (oldbuf (current-buffer))) + (message "Running %s..." file) + (set-buffer shelco) + (erase-buffer) + (set-buffer-modified-p nil) + (call-process file nil shelco nil) + (if (buffer-modified-p) + (display-buffer shelco)) + (message "Running %s...done" file) + (set-buffer oldbuf) + (revert-buffer))) diff --git a/home/emacs/find-alternate-18style.el b/home/emacs/find-alternate-18style.el new file mode 100644 index 0000000..beaa39d --- /dev/null +++ b/home/emacs/find-alternate-18style.el @@ -0,0 +1,43 @@ +(defun find-alternate-file (filename) + "Find file FILENAME, select its buffer, kill previous buffer. +If the current buffer now contains an empty file that you just visited +\(presumably by mistake), use this command to visit the file you really want. + +This function has been modified by Ian Jackson so as to revert to the +old (Emacs 18) behaviour of not requiring you to cut out the current +buffer's filename." + (interactive + (let ((file buffer-file-name) + (file-dir nil)) + (and file + (setq file-dir (file-name-directory file))) + (list (read-file-name + "Find alternate file: " file-dir nil nil nil)))) + (and (buffer-modified-p) + ;; (not buffer-read-only) + (not (yes-or-no-p (format "Buffer %s is modified; kill anyway? " + (buffer-name)))) + (error "Aborted")) + (let ((obuf (current-buffer)) + (ofile buffer-file-name) + (onum buffer-file-number) + (otrue buffer-file-truename) + (oname (buffer-name))) + (rename-buffer " **lose**") + (setq buffer-file-name nil) + (setq buffer-file-number nil) + (setq buffer-file-truename nil) + (unwind-protect + (progn + (unlock-buffer) + (find-file filename)) + (cond ((eq obuf (current-buffer)) + (setq buffer-file-name ofile) + (setq buffer-file-number onum) + (setq buffer-file-truename otrue) + (lock-buffer) + (rename-buffer oname)))) + (or (eq (current-buffer) obuf) + (kill-buffer obuf)))) + +(provide 'find-alternate-18style) diff --git a/home/emacs/ian-aliases.el b/home/emacs/ian-aliases.el new file mode 100644 index 0000000..ff6e330 --- /dev/null +++ b/home/emacs/ian-aliases.el @@ -0,0 +1,33 @@ +;; Ian Jackson's mail nicknames file. -*- fundamental -*- +;; (don't edit as elisp) + +;; Address translations for PGP +(setq autopgp-outgoing-address-translation-alist '( + ("ian". "Ian Jackson ") + ("Ian Jackson ". "Ian Jackson ") + ("Owen Dunn ". "Owen S. Dunn ") + ("Stephen Early ". "Stephen Early ") + ("Pete.Chown@dale.dircon.co.uk". "Pete Chown ") + ("(Pete Chown) pc@dale.demon.co.uk". "Pete Chown ") + ("Richard Brooksby ". + "Richard Brooksby ") + ("Ron Pritchett ". + "Ron Pritchett ") + ("szahn%masterix@goesser.sie.siemens.co.at". + "Steffen Zahn ") + ("Phil Karn ". "Phil Karn ") + ("Alan Bain ". "Alan F. R. Bain ") + ("Andrew Burt ". + "Andrew Burt ") + ("Grant.Denkinson@nottingham.ac.uk". + "Grant W. Denkinson ") + ("Ian Murdock ". + "Ian Murdock ") + ("Ian A. Murdock "."Ian Murdock ") + ("Tim Morley ". "Tim Morley ") + ("Eva R. Myers ". "Eva Rebecca Myers ") + ("Patrick.Weemeeuw@kulnet.kuleuven.ac.be". + "Patrick J.G.C. Weemeeuw ") + ("Allen Wheelwright ". + "Allen Wheelwright ") +)) diff --git a/home/emacs/ian-x.el b/home/emacs/ian-x.el new file mode 100644 index 0000000..d498fb4 --- /dev/null +++ b/home/emacs/ian-x.el @@ -0,0 +1,20 @@ +; Ian's X initialisations. + +(if (not (string-match "^18\." emacs-version)) + (require 'ian-x19) + +; (require 'x-fix-mouse) +; (define-key mouse-map x-button-left-up 'x-cut-text-if-moved) +; (define-key mouse-map x-button-middle 'x-cut-text) +; (define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text) +; (define-key mouse-map x-button-right 'x-paste-text)) +) + +; (x-set-cursor-color "white") +; (x-set-foreground-color "white") +; (x-set-background-color "black") + +(if (boundp 'tool-bar-mode) + (tool-bar-mode -1)) + +; End of this file. diff --git a/home/emacs/ian-x.el.~1.2.~ b/home/emacs/ian-x.el.~1.2.~ new file mode 100644 index 0000000..4055022 --- /dev/null +++ b/home/emacs/ian-x.el.~1.2.~ @@ -0,0 +1,16 @@ +; Ian's X initialisations. + +(if (not (string-match "^18\." emacs-version)) + (require 'ian-x19) + + (require 'x-fix-mouse) + (define-key mouse-map x-button-left-up 'x-cut-text-if-moved) + (define-key mouse-map x-button-middle 'x-cut-text) + (define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text) + (define-key mouse-map x-button-right 'x-paste-text)) + +; (x-set-cursor-color "white") +; (x-set-foreground-color "white") +; (x-set-background-color "black") + +; End of this file. diff --git a/home/emacs/ian-x.el~ b/home/emacs/ian-x.el~ new file mode 100644 index 0000000..84d9da5 --- /dev/null +++ b/home/emacs/ian-x.el~ @@ -0,0 +1,19 @@ +; Ian's X initialisations. + +(if (not (string-match "^18\." emacs-version)) + (require 'ian-x19) + +; (require 'x-fix-mouse) +; (define-key mouse-map x-button-left-up 'x-cut-text-if-moved) +; (define-key mouse-map x-button-middle 'x-cut-text) +; (define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text) +; (define-key mouse-map x-button-right 'x-paste-text)) + +; (x-set-cursor-color "white") +; (x-set-foreground-color "white") +; (x-set-background-color "black") + +(if (boundp 'tool-bar-mode) + (tool-bar-mode -1)) + +; End of this file. diff --git a/home/emacs/ian-x19.el b/home/emacs/ian-x19.el new file mode 100644 index 0000000..a0a9aed --- /dev/null +++ b/home/emacs/ian-x19.el @@ -0,0 +1,87 @@ +; Ian's X, Emacs-19 (and higher) initialisations + +;(setq frame-title-format +; '(multiple-frames "%b" ("" invocation-name " : " +; user-real-login-name "@" system-name))) + +;(setq default-frame-alist +; (append '((internal-border-width . 1)) default-frame-alist)) +;(scroll-bar-mode nil) +;(modify-frame-parameters (selected-frame) '((internal-border-width . 1))) +;(let ((bd (cdr (assoc 'border-width (frame-parameters))))) +; (set-frame-position (selected-frame) +; (- 1024 ; was (string-to-number (ians-configure "pixels_x")) +; (+ (frame-pixel-width) bd)) +; bd)) + +(setq mouse-yank-at-point t) +(setq x-pointer-shape x-pointer-left-ptr) +(set-mouse-color (cdr (assoc 'mouse-color (frame-parameters)))) + +(global-set-key [mode-line mouse-1] + '(lambda (event) (interactive "e\n") + (let ((old-window (selected-window))) + (unwind-protect + (progn (select-window (posn-window (event-end event))) + (scroll-up)) + (select-window old-window))))) + +(global-set-key [mode-line C-mouse-3] 'mouse-delete-window) + +(global-set-key [mode-line mouse-3] + '(lambda (event) (interactive "e\n") + (let ((old-window (selected-window))) + (unwind-protect + (progn (select-window (posn-window (event-end event))) + (scroll-down)) + (select-window old-window))))) + +(global-set-key [mode-line down-mouse-2] 'mouse-buffer-menu) + +(global-unset-key [C-down-mouse-1]) +(global-set-key [C-mouse-1] 'save-buffer) +(global-unset-key [C-down-mouse-2]) +(global-set-key [C-mouse-2] 'mouse-kill) + +(fset 'run-programs-menu '(keymap + "Programs" + ([compile] . ("Quicker Compile" . quicker-compile)) + ([vm] . ("VM" . vm)))) + +(global-unset-key [down-C-mouse-3]) +(global-set-key [down-C-mouse-3] 'run-programs-menu) + +;(global-set-key [mouse-2] 'mouse-yank-at-click) +;(global-set-key [mouse-3] 'mouse-save-then-kill) + +;(setq interprogram-paste-function +; '(lambda () (x-get-cut-buffer 0))) + +; (append '((vertical-scroll-bars . nil) (horizontal-scroll-bars . nil) +; (menu-bar-lines . 0)) +; default-frame-alist)) + +;(if (assoc 'user-position default-frame-alist) t +; (setq default-frame-alist +; (append '((top . 0) (left . -1)) +; default-frame-alist)) +; (set-frame-position (selected-frame) -1 0)) + +;(if (equal (ians-configure "colours") "mono") +; (progn +; (setq default-frame-alist +; (append '((foreground-color . "black") (background-color . "white") +; (mouse-color . "white") (cursor-color . "black")) +; default-frame-alist)) +; (set-face-foreground 'modeline "white") +; (set-face-background 'modeline "black") +; (modify-frame-parameters (selected-frame) '((cursor-color . "black"))) +; )) +;(if (equal (ians-configure "colours") "mono") +; (setq inverse-video t)) +; +; (append '((foreground-color . "black") (background-color . "white") +; (mouse-color . "white") (cursor-color . "black")) +; default-frame-alist))) + +(provide 'ian-x19) diff --git a/home/emacs/ian-x19.el.~1.1.~ b/home/emacs/ian-x19.el.~1.1.~ new file mode 100644 index 0000000..1c9d8e9 --- /dev/null +++ b/home/emacs/ian-x19.el.~1.1.~ @@ -0,0 +1,87 @@ +; Ian's X, Emacs-19 initialisations + +;(setq frame-title-format +; '(multiple-frames "%b" ("" invocation-name " : " +; user-real-login-name "@" system-name))) + +;(setq default-frame-alist +; (append '((internal-border-width . 1)) default-frame-alist)) +;(scroll-bar-mode nil) +;(modify-frame-parameters (selected-frame) '((internal-border-width . 1))) +;(let ((bd (cdr (assoc 'border-width (frame-parameters))))) +; (set-frame-position (selected-frame) +; (- 1024 ; was (string-to-number (ians-configure "pixels_x")) +; (+ (frame-pixel-width) bd)) +; bd)) + +(setq mouse-yank-at-point t) +(setq x-pointer-shape x-pointer-left-ptr) +(set-mouse-color (cdr (assoc 'mouse-color (frame-parameters)))) + +(global-set-key [mode-line mouse-1] + '(lambda (event) (interactive "e\n") + (let ((old-window (selected-window))) + (unwind-protect + (progn (select-window (posn-window (event-end event))) + (scroll-up)) + (select-window old-window))))) + +(global-set-key [mode-line C-mouse-3] 'mouse-delete-window) + +(global-set-key [mode-line mouse-3] + '(lambda (event) (interactive "e\n") + (let ((old-window (selected-window))) + (unwind-protect + (progn (select-window (posn-window (event-end event))) + (scroll-down)) + (select-window old-window))))) + +(global-set-key [mode-line down-mouse-2] 'mouse-buffer-menu) + +(global-unset-key [C-down-mouse-1]) +(global-set-key [C-mouse-1] 'save-buffer) +(global-unset-key [C-down-mouse-2]) +(global-set-key [C-mouse-2] 'mouse-kill) + +(fset 'run-programs-menu '(keymap + "Programs" + ([compile] . ("Quicker Compile" . quicker-compile)) + ([vm] . ("VM" . vm)))) + +(global-unset-key [down-C-mouse-3]) +(global-set-key [down-C-mouse-3] 'run-programs-menu) + +(global-set-key [mouse-2] 'mouse-yank-at-click) +(global-set-key [mouse-3] 'mouse-save-then-kill) + +(setq interprogram-paste-function + '(lambda () (x-get-cut-buffer 0))) + +; (append '((vertical-scroll-bars . nil) (horizontal-scroll-bars . nil) +; (menu-bar-lines . 0)) +; default-frame-alist)) + +;(if (assoc 'user-position default-frame-alist) t +; (setq default-frame-alist +; (append '((top . 0) (left . -1)) +; default-frame-alist)) +; (set-frame-position (selected-frame) -1 0)) + +;(if (equal (ians-configure "colours") "mono") +; (progn +; (setq default-frame-alist +; (append '((foreground-color . "black") (background-color . "white") +; (mouse-color . "white") (cursor-color . "black")) +; default-frame-alist)) +; (set-face-foreground 'modeline "white") +; (set-face-background 'modeline "black") +; (modify-frame-parameters (selected-frame) '((cursor-color . "black"))) +; )) +;(if (equal (ians-configure "colours") "mono") +; (setq inverse-video t)) +; +; (append '((foreground-color . "black") (background-color . "white") +; (mouse-color . "white") (cursor-color . "black")) +; default-frame-alist))) + +(provide 'ian-x19) diff --git a/home/emacs/ian-x19.el~ b/home/emacs/ian-x19.el~ new file mode 100644 index 0000000..dc49aa8 --- /dev/null +++ b/home/emacs/ian-x19.el~ @@ -0,0 +1,87 @@ +; Ian's X, Emacs-19 (and higher) initialisations + +;(setq frame-title-format +; '(multiple-frames "%b" ("" invocation-name " : " +; user-real-login-name "@" system-name))) + +;(setq default-frame-alist +; (append '((internal-border-width . 1)) default-frame-alist)) +;(scroll-bar-mode nil) +;(modify-frame-parameters (selected-frame) '((internal-border-width . 1))) +;(let ((bd (cdr (assoc 'border-width (frame-parameters))))) +; (set-frame-position (selected-frame) +; (- 1024 ; was (string-to-number (ians-configure "pixels_x")) +; (+ (frame-pixel-width) bd)) +; bd)) + +(setq mouse-yank-at-point t) +(setq x-pointer-shape x-pointer-left-ptr) +(set-mouse-color (cdr (assoc 'mouse-color (frame-parameters)))) + +(global-set-key [mode-line mouse-1] + '(lambda (event) (interactive "e\n") + (let ((old-window (selected-window))) + (unwind-protect + (progn (select-window (posn-window (event-end event))) + (scroll-up)) + (select-window old-window))))) + +(global-set-key [mode-line C-mouse-3] 'mouse-delete-window) + +(global-set-key [mode-line mouse-3] + '(lambda (event) (interactive "e\n") + (let ((old-window (selected-window))) + (unwind-protect + (progn (select-window (posn-window (event-end event))) + (scroll-down)) + (select-window old-window))))) + +(global-set-key [mode-line down-mouse-2] 'mouse-buffer-menu) + +(global-unset-key [C-down-mouse-1]) +(global-set-key [C-mouse-1] 'save-buffer) +(global-unset-key [C-down-mouse-2]) +(global-set-key [C-mouse-2] 'mouse-kill) + +(fset 'run-programs-menu '(keymap + "Programs" + ([compile] . ("Quicker Compile" . quicker-compile)) + ([vm] . ("VM" . vm)))) + +(global-unset-key [down-C-mouse-3]) +(global-set-key [down-C-mouse-3] 'run-programs-menu) + +(global-set-key [mouse-2] 'mouse-yank-at-click) +(global-set-key [mouse-3] 'mouse-save-then-kill) + +;(setq interprogram-paste-function +; '(lambda () (x-get-cut-buffer 0))) + +; (append '((vertical-scroll-bars . nil) (horizontal-scroll-bars . nil) +; (menu-bar-lines . 0)) +; default-frame-alist)) + +;(if (assoc 'user-position default-frame-alist) t +; (setq default-frame-alist +; (append '((top . 0) (left . -1)) +; default-frame-alist)) +; (set-frame-position (selected-frame) -1 0)) + +;(if (equal (ians-configure "colours") "mono") +; (progn +; (setq default-frame-alist +; (append '((foreground-color . "black") (background-color . "white") +; (mouse-color . "white") (cursor-color . "black")) +; default-frame-alist)) +; (set-face-foreground 'modeline "white") +; (set-face-background 'modeline "black") +; (modify-frame-parameters (selected-frame) '((cursor-color . "black"))) +; )) +;(if (equal (ians-configure "colours") "mono") +; (setq inverse-video t)) +; +; (append '((foreground-color . "black") (background-color . "white") +; (mouse-color . "white") (cursor-color . "black")) +; default-frame-alist))) + +(provide 'ian-x19) diff --git a/home/emacs/ian.el b/home/emacs/ian.el new file mode 100644 index 0000000..d68ac34 --- /dev/null +++ b/home/emacs/ian.el @@ -0,0 +1,530 @@ +; 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 version-control t +; kept-new-versions 4 +; kept-old-versions 4 +; trim-versions-without-asking t) +; +; Various one-liners +(setq require-final-newline "ask") +(if (string= window-system 'x) (load-library "ian-x")) +(load-library "ian-aliases") +; (load-library "auto-pgp") +; (load-library "debian-changelog-mode") +; (if (string= (getenv "TERM") "bbcb32") (setq term-file-prefix nil)) +; (setq explicit-shell-file-name "/usr/local/bin/tcsh") +(setq inhibit-local-variables t) +(setq enable-local-variables 'ask-me) +(setq enable-recursive-minibuffers t) +(setq compile-command "make") +(setq next-line-add-newlines t) +(setq diff-switches "-u") +(setq line-move-visual nil) +(display-time) +; +(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)) + (require 'find-alternate-18style) + (defun unset-down-mouse-23 () + (local-set-key [mouse-2] 'mouse-yank-at-click) + (local-unset-key [down-mouse-2]) + (local-unset-key [down-mouse-3]) + (local-unset-key [C-down-mouse-3])) + (add-hook 'vm-mode-hook 'unset-down-mouse-23) + (add-hook 'vm-mail-mode-hook 'unset-down-mouse-23) + (add-hook 'text-mode-hook 'unset-down-mouse-23) + (add-hook 'Info-mode-hook + (function (lambda () + (local-set-key " " 'scroll-up) + (local-set-key "" 'scroll-down)))) + (define-key isearch-mode-map "" 'isearch-repeat-forward) + (define-key isearch-mode-map "" 'isearch-quote-char))) +; +(menu-bar-mode -1) +(defun terminal-keybindings () + "This function should be called by the term-setup-hook mechanism" + (interactive) + ; Set my own keybindings + ; + ; Set keybindings generally (including I-search on C-\) +; (global-set-key " " 'self-insert-command) + (global-set-key "" 'isearch-forward) +; (global-set-key " " 'newline) + (global-set-key "" 'set-mark-command) + (global-set-key "" 'quoted-insert) + ; + ; Set keybindings on esc-map + (global-set-key "#" 'query-replace-regexp) + (global-set-key "+" 'toggle-truncate-lines) + (global-set-key "g" 'goto-line) + (global-set-key "s" 'isearch-forward-regexp) + (global-set-key "" 'eval-expression) + ; + ; Set keybindings on ^X-map. + (global-set-key "m" 'vm-mail) + (global-set-key "" 'save-buffer) + (global-set-key "" 'toggle-read-only) + (global-set-key "#" 'recover-file) + (global-set-key "\12" 'bury-buffer) + (global-set-key " " 'quicker-compile) + (global-set-key "" 'exchange-point-and-mark) + (global-set-key "" 'load-tramp) + (global-set-key "4" 'scroll-other-window) + (global-set-key "4m" 'vm-mail-other-window) + (global-set-key "9" 'vm-visit-folder) + (global-set-key "8" 'rmail-input) + (global-set-key "p" 'cite-region) + (global-set-key "F" 'mail-formletter) + ; + ; Set keybindings for Sun numeric pad. + (setq esc-bracket-map (make-keymap)) + (define-key esc-bracket-map "D" 'backward-char) + (define-key esc-bracket-map "C" 'forward-char) + (define-key esc-bracket-map "A" 'previous-line) + (define-key esc-bracket-map "B" 'next-line) + (define-key esc-map "[" esc-bracket-map) + (global-set-key "\e[214z" 'beginning-of-buffer) + (global-set-key "\e[220z" 'end-of-buffer) + (global-set-key "\e[216z" 'scroll-down) + (global-set-key "\e[222z" 'scroll-up) + (global-set-key "\e[192z" 'save-buffer) + (global-set-key "\e[194z" 'save-some-buffers) + (global-set-key "\e[195z" 'undo) + (global-set-key "\e[193z" 'call-last-kbd-macro) + (global-set-key "\e[196z" 'switch-to-buffer-other-window) + (global-set-key "\e[197z" 'copy-region-as-kill) + (global-set-key "\e[198z" 'find-file) + (global-set-key "\e[199z" 'yank) + (global-set-key "\e[198z" 'find-alternate-file) + (global-set-key "\e[200z" 'find-file) + (global-set-key "\e[201z" 'kill-region) + (global-set-key "\e[-1z" 'info) + ; + ; Set keybindings for Chiarks' x11emacs + (global-set-key "[5~" 'scroll-down) + (global-set-key "[6~" 'scroll-up) + ; + ; Set keybindings for knackered vt100-like terminal emulators. + (global-set-key "\eOt" 'scroll-down) + (global-set-key "\eOu" 'scroll-up) + (global-set-key "\eOD" 'backward-char) + (global-set-key "\eOC" 'forward-char) + (global-set-key "\eOA" 'previous-line) + (global-set-key "\eOB" 'next-line)) +(setq term-setup-hook 'terminal-keybindings) ; remap keys in due course +; +; 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) +(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 '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 dired-mode-hook + '(lambda () + (define-key dired-mode-map "F" 'dired-find-alternate-file) + (define-key dired-mode-map "X" 'dired-run-file))) +; +; Prevent loading of default init file and do some of the things it did +; (setq inhibit-default-init t) +; +; Additional alist handling function +;(defun alist-remove-elem (s s-list) +; "Delete the element of the alist S-LIST whose car is S" +; (if s-list (if (equal s (car (car s-list))) +; (cdr s-list) +; (cons (car s-list) (alist-remove-elem s (cdr s-list)))) +; (nil))) +; +; Load C++ mode and edit Perl in perl mode +(setq auto-mode-alist + (append '(("\\.[ch]$" . c-mode) + ("\\.[CH]$" . c++-mode) + ("\\.cc$" . c++-mode) + ("\\.hh$" . c++-mode) +; ("\\.tar$" . tar-mode) + ("\\.pl$" . perl-mode) + ("\\.ci$" . tex-mode) + ("\\.asm$" . fundamental-mode) + ("\\.Z$" . uncompress-while-visiting)) + auto-mode-alist)) +(setq interpreter-mode-alist + (append '(("sh" . fundamental-mode) + ("bash" . fundamental-mode)) + interpreter-mode-alist)) +; +; Use auto-fill when editing text +(add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1))) +; (add-hook 'text-mode-hook '(lambda () (local-set-key " " 'self-insert-command))) +; +; Set up newline to auto-indent & other stuff for perl, c++ and c modes. +(setq perl-mode-hook '(lambda () + (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 " " 'newline-and-indent))) +(setq c-hanging-comment-ender-p nil) +; +(defun vm-mail-other-window () + "Like `vm-mail' command, but display buffer in another window." + (interactive) + (switch-to-buffer-other-window (current-buffer)) + (vm-mail)) +; +; mail precedences +(setq mail-precedence-key-alist + '((?0 . "special-delivery") + (?1 . "air-mail") + (?2 . "first-class") + (?3 . "second-class") + (?5 . "third-class") + (?\ . nil) + (?6 . "bulk") + (?9 . "junk"))) +; +(defun mail-precedence-as-key () + "Set precedence by looking up last command char in mail-precedence-key-alist" + (interactive) + (message "%s" (concat "Precedence [" + (mapconcat '(lambda (c) (char-to-string (car c))) + mail-precedence-key-alist "") + "] ?")) + (let* ((key (read-char)) + (prec (assoc key mail-precedence-key-alist))) + (if prec (mail-precedence (cdr prec)) + (error "mail-precedence-as-key `%s' not found" key)))) +; +(defun mail-precedence-as-key-send-and-exit (arg) + "Set precedence by looking up last command char in mail-precedence-key-alist, +then call send-and-exit." + (interactive "P") + (mail-precedence-as-key) + (execute-kbd-macro "")) +; +(defun mail-precedence (prec) + (save-excursion + (mail-position-on-field "Precedence") + (let ((p (point))) + (beginning-of-line) + (delete-region (point) p) + (if prec + (insert "Precedence: " prec) + (delete-char 1))))) +; +(defun mail-mode-setup-keys () + (local-set-key "" 'mail-precedence-as-key) + (local-set-key "p" 'mail-precedence-as-key-send-and-exit)) +(add-hook 'mail-mode-hook 'mail-mode-setup-keys) +(add-hook 'vm-mail-mode-hook 'mail-mode-setup-keys) +; +(defun vm-mail-other-window () + "Like `vm-mail' command, but display buffer in another window." + (interactive) + (switch-to-buffer-other-window (current-buffer)) + (vm-mail)) +; +(defun mail-formletter () + "Run VM-mail with ,Formletter" + (interactive) + (vm-mail) + (rename-buffer (generate-new-buffer-name "form letter") t) + (delete-region (point-min) (point-max)) + (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" + (interactive) + (message "Loading tramp...") + (require 'tramp) ; -extended + (message "Loading tramp...done")) +; +; This function bound to M-+ +(defun toggle-truncate-lines () + "Toggle truncation or folding of long lines" + (interactive) + (set-variable 'truncate-lines (not truncate-lines)) + (redraw-display)) +; +; RMAIL stuff +;(setq rmail-file-name "~/mail/RMAIL" +; mail-archive-file-name "~/mail/Outbound" +; rmail-primary-inbox-list '("~/mbox" "~/mail/Outbound" "~/mail/Record" +; "~/mail/Import" "/var/spool/mail/ian") +; rmail-delete-after-output t +; rmail-last-rmail-file "" +; rmail-ignored-headers (concat +; "^Content-Identifier:\\|^X400-[^O][A-Za-z-]+:\\|" +; rmail-ignored-headers)) +; +(defun make-regexps-ignore-non-address (list) + (apply 'append (mapcar + '(lambda (item) + (let ((item (mapconcat + '(lambda (ch) + (let ((s (char-to-string ch))) + (if (string-match "[][.*+?^$\\]" s) + (concat "\\" s) + s))) + item ""))) + (list + (concat "<" item ">") + (concat "^" item " *\\((.*)\\)?$")))) + list))) +; +; BBDB +(setq bbdb-north-american-phone-numbers-p nil + bbdb/mail-auto-create-p t + bbdb-auto-revert-p t + bbdb-notice-auto-save-file-p t + bbdb-message-caching-enabled t) +; +; VM stuff +;(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" + vm-reply-subject-prefix "Re: " + vm-folder-directory "~/mail/" + vm-delete-after-saving t + vm-delete-empty-folders t + vm-mutable-windows t + vm-auto-get-new-mail nil + vm-auto-next-message nil + vm-jump-to-new-messages nil + vm-jump-to-unread-messages nil + vm-mime-digest-discard-header-regexp "only-drop-this-header" + vm-preview-lines nil + vm-included-text-prefix "> " + vm-confirm-quit 1 + vm-auto-center-summary t + vm-confirm-new-folders t + vm-circular-folders nil + vm-visit-when-saving 0 + vm-move-after-deleting t + vm-keep-sent-messages t + vm-follow-summary-cursor t + vm-frame-per-composition nil + vm-frame-per-edit nil + vm-frame-per-summary nil + vm-frame-per-folder nil + vm-tale-is-an-idiot t + vm-primary-inbox (concat vm-folder-directory "INBOX") + vm-sinbin-inbox (concat vm-folder-directory "SINBOX") + vm-uninteresting-senders "ian" + vm-reply-ignored-addresses + (make-regexps-ignore-non-address + '("ian@chiark.chu.cam.ac.uk" "ian" "iwj10@cus.cam.ac.uk" + "ian@chiark.greenend.org.uk" + "ijackson@nyx.cs.du.edu" "ijackson@gnu.ai.mit.edu")) + vm-primary-inbox (concat vm-folder-directory "INBOX") + + vm-uninteresting-senders "ian" + vm-reply-ignored-addresses + (make-regexps-ignore-non-address + '("ijackson@chiark.chu.cam.ac.uk" "ijackson" + "iwj10@thor.cam.ac.uk" "iwj10@hermes.cam.ac.uk" "iwj10@cl.cam.ac.uk" + "iwj10@cam.ac.uk" "Ian.Jackson@cl.cam.ac.uk")) + 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-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" + vm-mime-8bit-text-transfer-encoding '8bit) +; +(add-hook 'vm-mode-hook + '(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 () +; (interactive) +; (vm "/u/ijackson/mail/INBOX")) +;; +(defun vms () + (interactive) + (vm vm-sinbin-inbox)) +; +(defun make-session () + "Makes this emacs hard to kill by requiring ^X^Cy to kill it +instead of just ^X^C." + (interactive) + (global-unset-key "") + (global-set-key "y" '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 add-insertion-keys (table) + "Adds keybindings according to TABLE. Each element of +TABLE should be a four-element list. + +BINDING should be the key to bind; FUNCTION will be the name of the +function defined to do the insertion; DESCRIPTION will be inserted +into \"Inserts ... .\", and used as the descriptive string for the +generated function; STRING is the string which will actually be +inserted into the buffer when the keystroke is pressed." + (while table + (let* ((head (car table)) + (key (car head)) + (func (nth 1 head)) + (desc (nth 2 head)) + (string (nth 3 head))) + (defalias func + (list + 'lambda () + (concat "Inserts " desc ".") + '(interactive) + (list 'insert string))) + (funcall 'local-set-key key func)) + (setq table (cdr table)))) + +(defun ian-sgml-setup () + (interactive) + (add-insertion-keys + '((" " sgml-insert-new-para "new paragraph markup" "\n

\n") + ("" sgml-insert-tt-emph "tt emph markup" " " "String to insert when citing") +; +(defun cite-region (start end) + "Quote each line in the region with an angle-bracket and space. + +The citation string is taken from cite-string." + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (insert cite-string) + (while + (and + (= (forward-line) 0) + (> (point-max) (point))) + (insert cite-string))))) +; +; End of this file. diff --git a/home/emacs/ian.el.~1.5.~ b/home/emacs/ian.el.~1.5.~ new file mode 100644 index 0000000..49838d0 --- /dev/null +++ b/home/emacs/ian.el.~1.5.~ @@ -0,0 +1,373 @@ +; This is my real emacs start-up file (for chiark). +; +(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) +; +; 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 version-control t +; kept-new-versions 4 +; kept-old-versions 4 +; trim-versions-without-asking t) +; +; Various one-liners +(setq require-final-newline "ask") +(if (string= window-system 'x) (load-library "ian-x")) +(load-library "ian-aliases") +; (load-library "auto-pgp") +; (load-library "debian-changelog-mode") +; (if (string= (getenv "TERM") "bbcb32") (setq term-file-prefix nil)) +; (setq explicit-shell-file-name "/usr/local/bin/tcsh") +(setq inhibit-local-variables t) +(setq enable-local-variables 'ask-me) +(setq enable-recursive-minibuffers t) +(setq compile-command "make") +(setq diff-switches "-u") +(display-time) +; +(set-variable 'search-repeat-char 28) +(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)) + (require 'find-alternate-18style) + (defun unset-down-mouse-23 () + (local-set-key [mouse-2] 'mouse-yank-at-click) + (local-unset-key [down-mouse-2]) + (local-unset-key [down-mouse-3]) + (local-unset-key [C-down-mouse-3])) + (add-hook 'vm-mode-hook 'unset-down-mouse-23) + (add-hook 'vm-mail-mode-hook 'unset-down-mouse-23) + (add-hook 'text-mode-hook 'unset-down-mouse-23) + (add-hook 'Info-mode-hook + (function (lambda () + (local-set-key " " 'scroll-up) + (local-set-key "" 'scroll-down)))) + (define-key isearch-mode-map "" 'isearch-repeat-forward) + (define-key isearch-mode-map "" 'isearch-quote-char))) +; +(menu-bar-mode -1) +(defun terminal-keybindings () + "This function should be called by the term-setup-hook mechanism" + (interactive) + ; Set my own keybindings + ; + ; Set keybindings generally (including I-search on C-\) +; (global-set-key " " 'self-insert-command) + (global-set-key "" 'isearch-forward) + (global-set-key " " 'newline-and-indent) + (global-set-key "" 'set-mark-command) + (global-set-key "" 'quoted-insert) + ; + ; Set keybindings on esc-map + (global-set-key "#" 'query-replace-regexp) + (global-set-key "+" 'toggle-truncate-lines) + (global-set-key "g" 'goto-line) + (global-set-key "s" 'isearch-forward-regexp) + (global-set-key "" 'eval-expression) + ; + ; Set keybindings on ^X-map. + (global-set-key "m" 'vm-mail) + (global-set-key "" 'save-buffer) + (global-set-key "" 'toggle-read-only) + (global-set-key "#" 'recover-file) + (global-set-key "\12" 'bury-buffer) + (global-set-key " " 'quicker-compile) + (global-set-key "" 'exchange-point-and-mark) + (global-set-key "" 'load-ange-ftp) + (global-set-key "4" 'scroll-other-window) + (global-set-key "4m" 'vm-mail-other-window) + (global-set-key "9" 'vm-visit-folder) + (global-set-key "8" 'rmail-input) + (global-set-key "p" 'cite-region) + (global-set-key "F" 'mail-formletter) + ; + ; Set keybindings for Sun numeric pad. + (setq esc-bracket-map (make-keymap)) + (define-key esc-bracket-map "D" 'backward-char) + (define-key esc-bracket-map "C" 'forward-char) + (define-key esc-bracket-map "A" 'previous-line) + (define-key esc-bracket-map "B" 'next-line) + (define-key esc-map "[" esc-bracket-map) + (global-set-key "\e[214z" 'beginning-of-buffer) + (global-set-key "\e[220z" 'end-of-buffer) + (global-set-key "\e[216z" 'scroll-down) + (global-set-key "\e[222z" 'scroll-up) + (global-set-key "\e[192z" 'save-buffer) + (global-set-key "\e[194z" 'save-some-buffers) + (global-set-key "\e[195z" 'undo) + (global-set-key "\e[193z" 'call-last-kbd-macro) + (global-set-key "\e[196z" 'switch-to-buffer-other-window) + (global-set-key "\e[197z" 'copy-region-as-kill) + (global-set-key "\e[198z" 'find-file) + (global-set-key "\e[199z" 'yank) + (global-set-key "\e[198z" 'find-alternate-file) + (global-set-key "\e[200z" 'find-file) + (global-set-key "\e[201z" 'kill-region) + (global-set-key "\e[-1z" 'info) + ; + ; Set keybindings for Chiarks' x11emacs + (global-set-key "[5~" 'scroll-down) + (global-set-key "[6~" 'scroll-up) + ; + ; Set keybindings for knackered vt100-like terminal emulators. + (global-set-key "\eOt" 'scroll-down) + (global-set-key "\eOu" 'scroll-up) + (global-set-key "\eOD" 'backward-char) + (global-set-key "\eOC" 'forward-char) + (global-set-key "\eOA" 'previous-line) + (global-set-key "\eOB" 'next-line)) +(setq term-setup-hook 'terminal-keybindings) ; remap keys in due course +; +; 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) +(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 '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 "kcl") +(setq dired-mode-hook + '(lambda () + (define-key dired-mode-map "F" 'dired-find-alternate-file) + (define-key dired-mode-map "X" 'dired-run-file))) +; +; Prevent loading of default init file and do some of the things it did +; (setq inhibit-default-init t) +; +; Additional alist handling function +;(defun alist-remove-elem (s s-list) +; "Delete the element of the alist S-LIST whose car is S" +; (if s-list (if (equal s (car (car s-list))) +; (cdr s-list) +; (cons (car s-list) (alist-remove-elem s (cdr s-list)))) +; (nil))) +; +; Load C++ mode and edit Perl in perl mode +(setq auto-mode-alist + (append '(("\\.[ch]$" . c-mode) + ("\\.[CH]$" . c++-mode) + ("\\.cc$" . c++-mode) + ("\\.hh$" . c++-mode) +; ("\\.tar$" . tar-mode) + ("\\.pl$" . perl-mode) + ("\\.ci$" . tex-mode) + ("\\.Z$" . uncompress-while-visiting)) + auto-mode-alist)) +(setq interpreter-mode-alist + (append '(("sh" . fundamental-mode) + ("bash" . fundamental-mode)) + interpreter-mode-alist)) +; +; Use auto-fill when editing text +(add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1))) +; (add-hook 'text-mode-hook '(lambda () (local-set-key " " 'self-insert-command))) +; +; Set up newline to auto-indent & other stuff for perl, c++ and c modes. +(setq perl-mode-hook '(lambda () + (local-set-key ";" 'self-insert-command))) +(setq c++-mode-hook '(lambda () + (hide-ifdef-mode 1) + (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 " " 'newline-and-indent))) +(setq c-hanging-comment-ender-p nil) +; +(defun vm-mail-other-window () + "Like `vm-mail' command, but display buffer in another window." + (interactive) + (switch-to-buffer-other-window (current-buffer)) + (vm-mail)) +; +; mail precedences +(setq mail-precedence-key-alist + '((?0 . "special-delivery") + (?1 . "air-mail") + (?2 . "first-class") + (?3 . "second-class") + (?5 . "third-class") + (?\ . nil) + (?6 . "bulk") + (?9 . "junk"))) +; +(defun mail-precedence-as-key () + "Set precedence by looking up last command char in mail-precedence-key-alist" + (interactive) + (message "%s" (concat "Precedence [" + (mapconcat '(lambda (c) (char-to-string (car c))) + mail-precedence-key-alist "") + "] ?")) + (let* ((key (read-char)) + (prec (assoc key mail-precedence-key-alist))) + (if prec (mail-precedence (cdr prec)) + (error "mail-precedence-as-key `%s' not found" key)))) +; +(defun mail-precedence-as-key-send-and-exit (arg) + "Set precedence by looking up last command char in mail-precedence-key-alist, +then call send-and-exit." + (interactive "P") + (mail-precedence-as-key) + (execute-kbd-macro "")) +; +(defun mail-precedence (prec) + (save-excursion + (mail-position-on-field "Precedence") + (let ((p (point))) + (beginning-of-line) + (delete-region (point) p) + (if prec + (insert "Precedence: " prec) + (delete-char 1))))) +; +(defun mail-mode-setup-keys () + (local-set-key "" 'mail-precedence-as-key) + (local-set-key "p" 'mail-precedence-as-key-send-and-exit)) +(add-hook 'mail-mode-hook 'mail-mode-setup-keys) +(add-hook 'vm-mail-mode-hook 'mail-mode-setup-keys) +; +(defun vm-mail-other-window () + "Like `vm-mail' command, but display buffer in another window." + (interactive) + (switch-to-buffer-other-window (current-buffer)) + (vm-mail)) +; +(defun mail-formletter () + "Run VM-mail with ,Formletter" + (interactive) + (vm-mail) + (rename-buffer (generate-new-buffer-name "form letter") t) + (delete-region (point-min) (point-max)) + (insert-file (concat vm-folder-directory ",Formletter"))) +; +; This function bound to C-x C-z +(defun load-ange-ftp () + "Load ange-ftp using require, if it isn't loaded already" + (interactive) + (message "Loading ange-ftp...") + (require 'ange-ftp) ; -extended + (message "Loading ange-ftp...done")) +; +; This function bound to M-+ +(defun toggle-truncate-lines () + "Toggle truncation or folding of long lines" + (interactive) + (set-variable 'truncate-lines (not truncate-lines)) + (redraw-display)) +; +; RMAIL stuff +;(setq rmail-file-name "~/mail/RMAIL" +; mail-archive-file-name "~/mail/Outbound" +; rmail-primary-inbox-list '("~/mbox" "~/mail/Outbound" "~/mail/Record" +; "~/mail/Import" "/var/spool/mail/ian") +; rmail-delete-after-output t +; rmail-last-rmail-file "" +; rmail-ignored-headers (concat +; "^Content-Identifier:\\|^X400-[^O][A-Za-z-]+:\\|" +; rmail-ignored-headers)) +; +(defun make-regexps-ignore-non-address (list) + (apply 'append (mapcar + '(lambda (item) + (let ((item (mapconcat + '(lambda (ch) + (let ((s (char-to-string ch))) + (if (string-match "[][.*+?^$\\]" s) + (concat "\\" s) + s))) + item ""))) + (list + (concat "<" item ">") + (concat "^" item " *\\((.*)\\)?$")))) + list))) +; +; BBDB +(setq bbdb-north-american-phone-numbers-p nil + bbdb/mail-auto-create-p t + bbdb-auto-revert-p t + bbdb-notice-auto-save-file-p t + bbdb-message-caching-enabled t) +; +; VM stuff +(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" + vm-reply-subject-prefix "Re: " + vm-folder-directory "~/mail/" + vm-delete-after-saving t + vm-delete-empty-folders t + vm-mutable-windows t + vm-auto-get-new-mail nil + vm-auto-next-message nil + vm-jump-to-new-messages nil + vm-jump-to-unread-messages nil + vm-mime-digest-discard-header-regexp "only-drop-this-header" + vm-preview-lines nil + vm-included-text-prefix "> " + vm-confirm-quit 1 + vm-auto-center-summary t + vm-confirm-new-folders t + vm-circular-folders nil + vm-visit-when-saving 0 + vm-move-after-deleting t + vm-keep-sent-messages t + vm-follow-summary-cursor t + vm-frame-per-composition nil + vm-frame-per-edit nil + vm-frame-per-summary nil + vm-frame-per-folder nil + vm-tale-is-an-idiot t + vm-primary-inbox (concat vm-folder-directory "INBOX") + vm-sinbin-inbox (concat vm-folder-directory "SINBOX") + vm-uninteresting-senders "ian" + vm-reply-ignored-addresses + (make-regexps-ignore-non-address + '("ian@chiark.chu.cam.ac.uk" "ian" "iwj10@cus.cam.ac.uk" + "ian@chiark.greenend.org.uk" + "ijackson@nyx.cs.du.edu" "ijackson@gnu.ai.mit.edu")) + vm-primary-inbox (concat vm-folder-directory "INBOX") + + vm-uninteresting-senders "ian" + vm-reply-ignored-addresses + (make-regexps-ignore-non-address + '("ijackson@chiark.chu.cam.ac.uk" "ijackson" + "iwj10@thor.cam.ac.uk" "iwj10@hermes.cam.ac.uk" "iwj10@cl.cam.ac.uk" + "iwj10@cam.ac.uk" "Ian.Jackson@cl.cam.ac.uk")) + 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-startup-with-summary t diff --git a/home/emacs/ian.el~ b/home/emacs/ian.el~ new file mode 100644 index 0000000..76c6cb2 --- /dev/null +++ b/home/emacs/ian.el~ @@ -0,0 +1,529 @@ +; This is my real emacs start-up file (for chiark). +; + +(defalias 'perl-mode 'cperl-mode) +(setq cperl-invalid-face nil + cperl-indent-level 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 version-control t +; kept-new-versions 4 +; kept-old-versions 4 +; trim-versions-without-asking t) +; +; Various one-liners +(setq require-final-newline "ask") +(if (string= window-system 'x) (load-library "ian-x")) +(load-library "ian-aliases") +; (load-library "auto-pgp") +; (load-library "debian-changelog-mode") +; (if (string= (getenv "TERM") "bbcb32") (setq term-file-prefix nil)) +; (setq explicit-shell-file-name "/usr/local/bin/tcsh") +(setq inhibit-local-variables t) +(setq enable-local-variables 'ask-me) +(setq enable-recursive-minibuffers t) +(setq compile-command "make") +(setq next-line-add-newlines t) +(setq diff-switches "-u") +(setq line-move-visual nil) +(display-time) +; +(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)) + (require 'find-alternate-18style) + (defun unset-down-mouse-23 () + (local-set-key [mouse-2] 'mouse-yank-at-click) + (local-unset-key [down-mouse-2]) + (local-unset-key [down-mouse-3]) + (local-unset-key [C-down-mouse-3])) + (add-hook 'vm-mode-hook 'unset-down-mouse-23) + (add-hook 'vm-mail-mode-hook 'unset-down-mouse-23) + (add-hook 'text-mode-hook 'unset-down-mouse-23) + (add-hook 'Info-mode-hook + (function (lambda () + (local-set-key " " 'scroll-up) + (local-set-key "" 'scroll-down)))) + (define-key isearch-mode-map "" 'isearch-repeat-forward) + (define-key isearch-mode-map "" 'isearch-quote-char))) +; +(menu-bar-mode -1) +(defun terminal-keybindings () + "This function should be called by the term-setup-hook mechanism" + (interactive) + ; Set my own keybindings + ; + ; Set keybindings generally (including I-search on C-\) +; (global-set-key " " 'self-insert-command) + (global-set-key "" 'isearch-forward) +; (global-set-key " " 'newline) + (global-set-key "" 'set-mark-command) + (global-set-key "" 'quoted-insert) + ; + ; Set keybindings on esc-map + (global-set-key "#" 'query-replace-regexp) + (global-set-key "+" 'toggle-truncate-lines) + (global-set-key "g" 'goto-line) + (global-set-key "s" 'isearch-forward-regexp) + (global-set-key "" 'eval-expression) + ; + ; Set keybindings on ^X-map. + (global-set-key "m" 'vm-mail) + (global-set-key "" 'save-buffer) + (global-set-key "" 'toggle-read-only) + (global-set-key "#" 'recover-file) + (global-set-key "\12" 'bury-buffer) + (global-set-key " " 'quicker-compile) + (global-set-key "" 'exchange-point-and-mark) + (global-set-key "" 'load-tramp) + (global-set-key "4" 'scroll-other-window) + (global-set-key "4m" 'vm-mail-other-window) + (global-set-key "9" 'vm-visit-folder) + (global-set-key "8" 'rmail-input) + (global-set-key "p" 'cite-region) + (global-set-key "F" 'mail-formletter) + ; + ; Set keybindings for Sun numeric pad. + (setq esc-bracket-map (make-keymap)) + (define-key esc-bracket-map "D" 'backward-char) + (define-key esc-bracket-map "C" 'forward-char) + (define-key esc-bracket-map "A" 'previous-line) + (define-key esc-bracket-map "B" 'next-line) + (define-key esc-map "[" esc-bracket-map) + (global-set-key "\e[214z" 'beginning-of-buffer) + (global-set-key "\e[220z" 'end-of-buffer) + (global-set-key "\e[216z" 'scroll-down) + (global-set-key "\e[222z" 'scroll-up) + (global-set-key "\e[192z" 'save-buffer) + (global-set-key "\e[194z" 'save-some-buffers) + (global-set-key "\e[195z" 'undo) + (global-set-key "\e[193z" 'call-last-kbd-macro) + (global-set-key "\e[196z" 'switch-to-buffer-other-window) + (global-set-key "\e[197z" 'copy-region-as-kill) + (global-set-key "\e[198z" 'find-file) + (global-set-key "\e[199z" 'yank) + (global-set-key "\e[198z" 'find-alternate-file) + (global-set-key "\e[200z" 'find-file) + (global-set-key "\e[201z" 'kill-region) + (global-set-key "\e[-1z" 'info) + ; + ; Set keybindings for Chiarks' x11emacs + (global-set-key "[5~" 'scroll-down) + (global-set-key "[6~" 'scroll-up) + ; + ; Set keybindings for knackered vt100-like terminal emulators. + (global-set-key "\eOt" 'scroll-down) + (global-set-key "\eOu" 'scroll-up) + (global-set-key "\eOD" 'backward-char) + (global-set-key "\eOC" 'forward-char) + (global-set-key "\eOA" 'previous-line) + (global-set-key "\eOB" 'next-line)) +(setq term-setup-hook 'terminal-keybindings) ; remap keys in due course +; +; 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) +(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 '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 dired-mode-hook + '(lambda () + (define-key dired-mode-map "F" 'dired-find-alternate-file) + (define-key dired-mode-map "X" 'dired-run-file))) +; +; Prevent loading of default init file and do some of the things it did +; (setq inhibit-default-init t) +; +; Additional alist handling function +;(defun alist-remove-elem (s s-list) +; "Delete the element of the alist S-LIST whose car is S" +; (if s-list (if (equal s (car (car s-list))) +; (cdr s-list) +; (cons (car s-list) (alist-remove-elem s (cdr s-list)))) +; (nil))) +; +; Load C++ mode and edit Perl in perl mode +(setq auto-mode-alist + (append '(("\\.[ch]$" . c-mode) + ("\\.[CH]$" . c++-mode) + ("\\.cc$" . c++-mode) + ("\\.hh$" . c++-mode) +; ("\\.tar$" . tar-mode) + ("\\.pl$" . perl-mode) + ("\\.ci$" . tex-mode) + ("\\.asm$" . fundamental-mode) + ("\\.Z$" . uncompress-while-visiting)) + auto-mode-alist)) +(setq interpreter-mode-alist + (append '(("sh" . fundamental-mode) + ("bash" . fundamental-mode)) + interpreter-mode-alist)) +; +; Use auto-fill when editing text +(add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1))) +; (add-hook 'text-mode-hook '(lambda () (local-set-key " " 'self-insert-command))) +; +; Set up newline to auto-indent & other stuff for perl, c++ and c modes. +(setq perl-mode-hook '(lambda () + (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 " " 'newline-and-indent))) +(setq c-hanging-comment-ender-p nil) +; +(defun vm-mail-other-window () + "Like `vm-mail' command, but display buffer in another window." + (interactive) + (switch-to-buffer-other-window (current-buffer)) + (vm-mail)) +; +; mail precedences +(setq mail-precedence-key-alist + '((?0 . "special-delivery") + (?1 . "air-mail") + (?2 . "first-class") + (?3 . "second-class") + (?5 . "third-class") + (?\ . nil) + (?6 . "bulk") + (?9 . "junk"))) +; +(defun mail-precedence-as-key () + "Set precedence by looking up last command char in mail-precedence-key-alist" + (interactive) + (message "%s" (concat "Precedence [" + (mapconcat '(lambda (c) (char-to-string (car c))) + mail-precedence-key-alist "") + "] ?")) + (let* ((key (read-char)) + (prec (assoc key mail-precedence-key-alist))) + (if prec (mail-precedence (cdr prec)) + (error "mail-precedence-as-key `%s' not found" key)))) +; +(defun mail-precedence-as-key-send-and-exit (arg) + "Set precedence by looking up last command char in mail-precedence-key-alist, +then call send-and-exit." + (interactive "P") + (mail-precedence-as-key) + (execute-kbd-macro "")) +; +(defun mail-precedence (prec) + (save-excursion + (mail-position-on-field "Precedence") + (let ((p (point))) + (beginning-of-line) + (delete-region (point) p) + (if prec + (insert "Precedence: " prec) + (delete-char 1))))) +; +(defun mail-mode-setup-keys () + (local-set-key "" 'mail-precedence-as-key) + (local-set-key "p" 'mail-precedence-as-key-send-and-exit)) +(add-hook 'mail-mode-hook 'mail-mode-setup-keys) +(add-hook 'vm-mail-mode-hook 'mail-mode-setup-keys) +; +(defun vm-mail-other-window () + "Like `vm-mail' command, but display buffer in another window." + (interactive) + (switch-to-buffer-other-window (current-buffer)) + (vm-mail)) +; +(defun mail-formletter () + "Run VM-mail with ,Formletter" + (interactive) + (vm-mail) + (rename-buffer (generate-new-buffer-name "form letter") t) + (delete-region (point-min) (point-max)) + (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" + (interactive) + (message "Loading tramp...") + (require 'tramp) ; -extended + (message "Loading tramp...done")) +; +; This function bound to M-+ +(defun toggle-truncate-lines () + "Toggle truncation or folding of long lines" + (interactive) + (set-variable 'truncate-lines (not truncate-lines)) + (redraw-display)) +; +; RMAIL stuff +;(setq rmail-file-name "~/mail/RMAIL" +; mail-archive-file-name "~/mail/Outbound" +; rmail-primary-inbox-list '("~/mbox" "~/mail/Outbound" "~/mail/Record" +; "~/mail/Import" "/var/spool/mail/ian") +; rmail-delete-after-output t +; rmail-last-rmail-file "" +; rmail-ignored-headers (concat +; "^Content-Identifier:\\|^X400-[^O][A-Za-z-]+:\\|" +; rmail-ignored-headers)) +; +(defun make-regexps-ignore-non-address (list) + (apply 'append (mapcar + '(lambda (item) + (let ((item (mapconcat + '(lambda (ch) + (let ((s (char-to-string ch))) + (if (string-match "[][.*+?^$\\]" s) + (concat "\\" s) + s))) + item ""))) + (list + (concat "<" item ">") + (concat "^" item " *\\((.*)\\)?$")))) + list))) +; +; BBDB +(setq bbdb-north-american-phone-numbers-p nil + bbdb/mail-auto-create-p t + bbdb-auto-revert-p t + bbdb-notice-auto-save-file-p t + bbdb-message-caching-enabled t) +; +; VM stuff +;(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" + vm-reply-subject-prefix "Re: " + vm-folder-directory "~/mail/" + vm-delete-after-saving t + vm-delete-empty-folders t + vm-mutable-windows t + vm-auto-get-new-mail nil + vm-auto-next-message nil + vm-jump-to-new-messages nil + vm-jump-to-unread-messages nil + vm-mime-digest-discard-header-regexp "only-drop-this-header" + vm-preview-lines nil + vm-included-text-prefix "> " + vm-confirm-quit 1 + vm-auto-center-summary t + vm-confirm-new-folders t + vm-circular-folders nil + vm-visit-when-saving 0 + vm-move-after-deleting t + vm-keep-sent-messages t + vm-follow-summary-cursor t + vm-frame-per-composition nil + vm-frame-per-edit nil + vm-frame-per-summary nil + vm-frame-per-folder nil + vm-tale-is-an-idiot t + vm-primary-inbox (concat vm-folder-directory "INBOX") + vm-sinbin-inbox (concat vm-folder-directory "SINBOX") + vm-uninteresting-senders "ian" + vm-reply-ignored-addresses + (make-regexps-ignore-non-address + '("ian@chiark.chu.cam.ac.uk" "ian" "iwj10@cus.cam.ac.uk" + "ian@chiark.greenend.org.uk" + "ijackson@nyx.cs.du.edu" "ijackson@gnu.ai.mit.edu")) + vm-primary-inbox (concat vm-folder-directory "INBOX") + + vm-uninteresting-senders "ian" + vm-reply-ignored-addresses + (make-regexps-ignore-non-address + '("ijackson@chiark.chu.cam.ac.uk" "ijackson" + "iwj10@thor.cam.ac.uk" "iwj10@hermes.cam.ac.uk" "iwj10@cl.cam.ac.uk" + "iwj10@cam.ac.uk" "Ian.Jackson@cl.cam.ac.uk")) + 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-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" + vm-mime-8bit-text-transfer-encoding '8bit) +; +(add-hook 'vm-mode-hook + '(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 () +; (interactive) +; (vm "/u/ijackson/mail/INBOX")) +;; +(defun vms () + (interactive) + (vm vm-sinbin-inbox)) +; +(defun make-session () + "Makes this emacs hard to kill by requiring ^X^Cy to kill it +instead of just ^X^C." + (interactive) + (global-unset-key "") + (global-set-key "y" '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 add-insertion-keys (table) + "Adds keybindings according to TABLE. Each element of +TABLE should be a four-element list. + +BINDING should be the key to bind; FUNCTION will be the name of the +function defined to do the insertion; DESCRIPTION will be inserted +into \"Inserts ... .\", and used as the descriptive string for the +generated function; STRING is the string which will actually be +inserted into the buffer when the keystroke is pressed." + (while table + (let* ((head (car table)) + (key (car head)) + (func (nth 1 head)) + (desc (nth 2 head)) + (string (nth 3 head))) + (defalias func + (list + 'lambda () + (concat "Inserts " desc ".") + '(interactive) + (list 'insert string))) + (funcall 'local-set-key key func)) + (setq table (cdr table)))) + +(defun ian-sgml-setup () + (interactive) + (add-insertion-keys + '((" " sgml-insert-new-para "new paragraph markup" "\n

\n") + ("" sgml-insert-tt-emph "tt emph markup" " " "String to insert when citing") +; +(defun cite-region (start end) + "Quote each line in the region with an angle-bracket and space. + +The citation string is taken from cite-string." + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (insert cite-string) + (while + (and + (= (forward-line) 0) + (> (point-max) (point))) + (insert cite-string))))) +; +; End of this file. diff --git a/home/emacs/quicker-compile.el b/home/emacs/quicker-compile.el new file mode 100644 index 0000000..1163ac1 --- /dev/null +++ b/home/emacs/quicker-compile.el @@ -0,0 +1,12 @@ +; Fixup of compile so it doesn't ask unless you want it to. + +(require 'compile) +(provide 'quicker-compile) + +(defun quicker-compile (prompt-for-command) + "Runs compile. Will prompt for the compile command only if given +a prefix argument." + (interactive "P") + (if prompt-for-command + (setq compile-command (read-string "Compile command: " compile-command))) + (compile compile-command)) diff --git a/home/emacs/x-fix-mouse.el b/home/emacs/x-fix-mouse.el new file mode 100644 index 0000000..e676bfe --- /dev/null +++ b/home/emacs/x-fix-mouse.el @@ -0,0 +1,41 @@ +;;; x-fix-mouse.el +;;; +;;; make mouse-based paste ignore the mouse position and use the emacs point +;;; instead. Make cut-text set the mark so the mouse can be used naturally +;;; to select a region (e.g. to indent code). +;;; +;;; Jean-Francois Lamy 1989-09-21 +;;; lamy@ai.utoronto.ca + +(require 'x-mouse); These two lines +(provide 'x-fix-mouse); added by 89iwj@eng.cam.ac.uk + +(defun x-cut-text (arg &optional kill) + "Copy text between point and mouse into window system cut buffer. +Set mark to current mouse position. Save in Emacs kill ring also." + (if (coordinates-in-window-p arg (selected-window)) + (progn + (x-mouse-set-mark arg) + (let ((beg (point)) (end (mark))) + (x-store-cut-buffer (buffer-substring beg end)) + (copy-region-as-kill beg end) + (if kill (delete-region beg end)))) + (message "Mouse not in selected window"))) + +(defun x-paste-text (arg) + "Insert window system cut buffer contents at current point." + (insert (x-get-cut-buffer))) + +(defun x-cut-and-wipe-text (arg) + "Kill text between point and mark; also copy to window system cut buffer." + (x-cut-text arg t)) + +(defun x-cut-text-if-moved (arg &optional kill) + (let ((opoint (point))) + (x-mouse-set-point arg) + (cond + ((not (equal (point) opoint)) + (goto-char opoint) + (x-cut-text arg kill))))) + +;------- End of Forwarded Message