;;;; .emacs ; $dotat: rcfiles/emacs,v 1.84 2002/12/11 05:21:47 fanf2 Exp $ ;; {{{ careful about doing things (defmacro noerr (form) `(condition-case nil ,form (error nil))) ;; }}} ;; {{{ load some lisp stuff (setq load-path (cons "~/misc/lisp" load-path)) (load "dired") (load "ange-ftp") (load "python-mode") ;; }}} ;; {{{ miscellaneous stuff ;; turns all yes or no prompts into y or n prompts (fset 'yes-or-no-p 'y-or-n-p) ;(transient-mark-mode 1) (setq scroll-step 1) (setq next-line-add-newlines nil) (setq require-final-newline t) (setq truncate-partial-width-windows nil) (set-default 'show-trailing-whitespace t) (set-default 'indicate-empty-lines t) (standard-display-european 1) ;(load "iso-syntax") (set-input-mode (car (current-input-mode)) (nth 1 (current-input-mode)) 0) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (put 'eval-expression 'disabled nil) ;; }}} ;; {{{ automatic choice of mode (auto-compression-mode 1) (setq auto-mode-alist (append '( ("\\.el$" . emacs-lisp-mode) ("\\.article\\|\\.letter\\|^/tmp/snd\\|^/tmp/mutt-" . text-mode) ("\\.vm" . emacs-lisp-mode) ("/rcfiles/emacs" . emacs-lisp-mode) ("\\.p[lm]$" . cperl-mode) ("\\.l$" . c-mode) ) auto-mode-alist)) ;; }}} ;; {{{ mode line format ;(line-number-mode 1) ;(column-number-mode 1) ;(setq display-time-day-and-date nil) ;(display-time) (setq-default mode-line-modified '("-%1*%1+")) (setq-default mode-line-buffer-id '("- " mode-line-buffer-identification " -")) (setq-default mode-line-buffer-identification '("%b")) (setq-default mode-line-position '("- %P -- L%l -- C%c -")) (setq-default mode-line-mode '("- %[(" mode-name mode-line-process minor-mode-alist "%n" ")%] -")) (setq-default mode-line-global-mode '(global-mode-string ("- " global-mode-string " -"))) (setq-default default-mode-line-format '("" mode-line-modified mode-line-buffer-id mode-line-position mode-line-mode mode-line-global-mode "-%-")) ;; }}} ;; {{{ CVS (setq vc-default-back-end "CVS") (setq vc-initial-comment t) (setq diff-switches "-u") ;; }}} ;; {{{ X ;; see x resources ;;(tool-bar-mode -1) ;;(scroll-bar-mode -1) ;; mentioned in the X resources but also needed for terminals (menu-bar-mode -1) ;; needed for emacs-21 and doesn't work in earlier versions (noerr (blink-cursor-mode -1)) (setq frame-title-format "%b") (setq default-frame-alist '((auto-raise . nil) (auto-lower . nil) (left . 2) (top . 2) )) (setq initial-frame-alist default-frame-alist) (setq x-pointer-shape 152) ; I bar (setq x-sensitive-text-pointer-shape 60) ; hand (setq mouse-yank-at-point t) ;; }}} ;; {{{ C (load "cc-mode") (defun fanf-else-if-magic (arg) "Correct the layout of a C else if sequence that is split between two lines" (save-excursion (beginning-of-line) (skip-chars-forward " \t") (let* ((else-point (cdr arg)) (if-point (point))) (if (and (eq 'substatement (car arg)) (or (string= "if " (buffer-substring if-point (+ if-point 3))) (string= "if(" (buffer-substring if-point (+ if-point 3)))) (or (string= "else" (buffer-substring else-point (+ else-point 4))) (string= "} else" (buffer-substring else-point (+ else-point 6))))) 0 c-basic-offset)))) (setq c-font-lock-extra-types '("bool" "inline" "FILE" "fd_set" "jmp_buf" "va_list" "\\sw+_t" "t_\\sw+")) (setq c-default-style "knf") ;; {{{ (c-add-style "knf" (c-add-style "knf" '((c-basic-offset . 8) (c-backslash-column . 72) (c-comment-only-line-offset . 0) (c-label-minimum-indentation . 0) (c-cleanup-list . ()) (c-hanging-braces-alist . ()) (c-hanging-colons-alist . ()) (c-offsets-alist . ((string . c-lineup-dont-change) ;; Relpos: Beg of previous line. (c . c-lineup-C-comments) ;; Relpos: Beg of the comment. (defun-open . 0) ;; Relpos: Boi at the func decl start when inside classes, bol ;; at the func decl start when at top level. (defun-close . 0) ;; Relpos: Boi at the func decl start. (defun-block-intro . +) ;; Relpos: Boi at the block open. (class-open . 0) ;; Relpos: Boi at the class decl start. (class-close . 0) ;; Relpos: Boi at the class decl start. (inline-open . +) ;; Relpos: None for functions (inclass got the relpos then), ;; boi at the lambda start for lambdas. (inline-close . 0) ;; Relpos: For functions: Boi at the func decl start. For ;; lambdas: At the block open if it's at boi, at the boi of the ;; lambda start otherwise. (func-decl-cont . +) ;; Relpos: Boi at the func decl start. (knr-argdecl-intro . +) ;; Relpos: Boi at the current line. (knr-argdecl . 0) ;; Relpos: Boi at the argdecl intro line. (topmost-intro . 0) ;; Relpos: Bol at the last line of previous construct. (topmost-intro-cont . 0) ;; Relpos: Boi at the topmost intro line. (member-init-intro . +) ;; Relpos: Boi at the func decl arglist open. (member-init-cont . c-lineup-multi-inher) ;; Relpos: Beg of the first member init. (inher-intro . +) ;; Relpos: Java: Boi at the class decl start. Otherwise: Boi ;; of current line (a bug?), unless it begins with an inher ;; start colon, in which case boi of previous line is used. (inher-cont . c-lineup-multi-inher) ;; Relpos: Java: At the implements/extends keyword start. ;; Otherwise: At the inher start colon, or boi at the class ;; decl start if the first inherit clause hangs and it's not a ;; func-local inherit clause (when does that occur?). (block-open . 0) ;; Relpos: Inexpr statement: Boi at the the preceding ;; paren. Otherwise: None. (block-close . 0) ;; Relpos: At the open brace if it's at boi. Otherwise boi at ;; the start of the statement the open brace hangs on, or boi ;; at the preceding paren for inexpr statements. (brace-list-open . 0) ;; Relpos: Boi at the brace list decl start, but a starting ;; "typedef" token is ignored. (brace-list-close . 0) ;; Relpos: Boi at the brace list open. (brace-list-intro . +) ;; Relpos: Boi at the brace list open. (brace-list-entry . 0) ;; Relpos: At the first non-ws char after the open paren if the ;; first token is on the same line, otherwise boi at that ;; token. ;(brace-entry-open . 0) ; emacs-20 incompat ;; Relpos: Same as brace-list-entry. (statement . 0) ;; Relpos: After a ';' in the condition clause of a for ;; statement: At the first token after the starting paren. ;; Otherwise: Boi at the start of the closest non-hanging ;; previous statement, but after any switch label. (statement-cont . *) ;; Relpos: After the first token in the condition clause of a ;; for statement: At the first token after the starting paren. ;; On the first line in a continued expression that starts with ;; a stream op and there's no stream op on the previous line: ;; Boi of previous line. Otherwise: Boi at the beginning of ;; the statement, but after any type of label. (statement-block-intro . +) ;; Relpos: At the block start if it's at boi, otherwise boi at ;; the start of the statement the open brace hangs on, or boi ;; at the preceding paren for inexpr statements. (statement-case-intro . +) ;; Relpos: At the label keyword (always at boi). (statement-case-open . +) ;; Relpos: At the label keyword (always at boi). (substatement . fanf-else-if-magic) ;; Relpos: Boi at the containing statement or else clause. (substatement-open . 0) ;; Relpos: Boi at the containing statement or else clause. (case-label . 0) ;; Relpos: At the switch block start if it's at boi, otherwise ;; boi at the start of the switch condition clause. (access-label . -) ;; Relpos: Eol (a bug?). (label . 0) ;; Relpos: At the start of the containing block if it's at boi, ;; otherwise boi at the start of the sexp before the block. (do-while-closure . 0) ;; Relpos: Boi at the corresponding while keyword. (else-clause . 0) ;; Relpos: Boi at the corresponding if keyword. ;(catch-clause . 0) ; emacs-20 incompat ;; Relpos: Boi at the previous try or catch keyword in the try ;; statement. (comment-intro . c-lineup-comment) ;; Relpos: None. (arglist-intro . *) ;; Relpos: Boi at the open paren, or at the first non-ws after ;; the open paren of the surrounding sexp, whichever is later. (arglist-cont . *) ;; Relpos: At the first token after the open paren. (arglist-cont-nonempty . *) ;; Relpos: Boi at the open paren, or at the first non-ws after ;; the open paren of the surrounding sexp, whichever is later. (arglist-close . *) ;; Relpos: Boi at the open paren, or at the first non-ws after ;; the open paren of the surrounding sexp, whichever is later. (stream-op . c-lineup-streamop) ;; Relpos: Boi at the first stream op in the statement. (inclass . +) ;; Relpos: At the class open brace if it's at boi, otherwise ;; boi at the class decl start. (cpp-macro . -1000) ; instead of emacs-21's [0] ;; Relpos: None. (cpp-macro-cont . +) ;; Relpos: At the macro start (always at boi). (friend . 0) ;; Relpos: None. (objc-method-intro . -1000) ; instead of emacs-21's [0] ;; Relpos: Boi. (objc-method-args-cont . c-lineup-ObjC-method-args) ;; Relpos: At the method start (always at boi). (objc-method-call-cont . c-lineup-ObjC-method-call) ;; Relpos: At the open bracket. (extern-lang-open . 0) ;; Relpos: Boi at the extern keyword. (extern-lang-close . 0) ;; Relpos: Boi at the corresponding extern keyword. (inextern-lang . +) ;; Relpos: At the extern block open brace if it's at boi, ;; otherwise boi at the extern keyword. (namespace-open . 0) ;; Relpos: Boi at the namespace keyword. (namespace-close . 0) ;; Relpos: Boi at the corresponding namespace keyword. (innamespace . +) ;; Relpos: At the namespace block open brace if it's at boi, ;; otherwise boi at the namespace keyword. (template-args-cont . +) ; instead of (c-lineup-template-args +) ;; Relpos: Boi at the decl start. ; (inlambda . c-lineup-inexpr-block) ; emacs-20 incompat ;; Relpos: None. ; (lambda-intro-cont . +) ; emacs-20 incompat ;; Relpos: Boi at the lambda start. ; (inexpr-statement . 0) ; emacs-20 incompat ;; Relpos: None. ; (inexpr-class . +) ; emacs-20 incompat ;; Relpos: None. )))) ;; }}} ;; {{{ (c-add-style "exim" (c-add-style "exim" '((c-basic-offset . 2) (c-backslash-column . 72) (c-comment-only-line-offset . 0) (c-label-minimum-indentation . 0) (c-cleanup-list . ()) (c-hanging-braces-alist . ()) (c-hanging-colons-alist . ()) (c-offsets-alist . ((string . c-lineup-dont-change) ;; Relpos: Beg of previous line. (c . c-lineup-C-comments) ;; Relpos: Beg of the comment. (defun-open . 0) ;; Relpos: Boi at the func decl start when inside classes, bol ;; at the func decl start when at top level. (defun-close . 0) ;; Relpos: Boi at the func decl start. (defun-block-intro . 0) ;; Relpos: Boi at the block open. (class-open . 0) ;; Relpos: Boi at the class decl start. (class-close . 0) ;; Relpos: Boi at the class decl start. (inline-open . 0) ;; Relpos: None for functions (inclass got the relpos then), ;; boi at the lambda start for lambdas. (inline-close . 0) ;; Relpos: For functions: Boi at the func decl start. For ;; lambdas: At the block open if it's at boi, at the boi of the ;; lambda start otherwise. (func-decl-cont . +) ;; Relpos: Boi at the func decl start. (knr-argdecl-intro . +) ;; Relpos: Boi at the current line. (knr-argdecl . 0) ;; Relpos: Boi at the argdecl intro line. (topmost-intro . 0) ;; Relpos: Bol at the last line of previous construct. (topmost-intro-cont . 0) ;; Relpos: Boi at the topmost intro line. (member-init-intro . +) ;; Relpos: Boi at the func decl arglist open. (member-init-cont . c-lineup-multi-inher) ;; Relpos: Beg of the first member init. (inher-intro . +) ;; Relpos: Java: Boi at the class decl start. Otherwise: Boi ;; of current line (a bug?), unless it begins with an inher ;; start colon, in which case boi of previous line is used. (inher-cont . c-lineup-multi-inher) ;; Relpos: Java: At the implements/extends keyword start. ;; Otherwise: At the inher start colon, or boi at the class ;; decl start if the first inherit clause hangs and it's not a ;; func-local inherit clause (when does that occur?). (block-open . 0) ;; Relpos: Inexpr statement: Boi at the the preceding ;; paren. Otherwise: None. (block-close . 0) ;; Relpos: At the open brace if it's at boi. Otherwise boi at ;; the start of the statement the open brace hangs on, or boi ;; at the preceding paren for inexpr statements. (brace-list-open . 0) ;; Relpos: Boi at the brace list decl start, but a starting ;; "typedef" token is ignored. (brace-list-close . 0) ;; Relpos: Boi at the brace list open. (brace-list-intro . +) ;; Relpos: Boi at the brace list open. (brace-list-entry . 0) ;; Relpos: At the first non-ws char after the open paren if the ;; first token is on the same line, otherwise boi at that ;; token. ;(brace-entry-open . 0) ; emacs-20 incompat ;; Relpos: Same as brace-list-entry. (statement . 0) ;; Relpos: After a ';' in the condition clause of a for ;; statement: At the first token after the starting paren. ;; Otherwise: Boi at the start of the closest non-hanging ;; previous statement, but after any switch label. (statement-cont . +) ;; Relpos: After the first token in the condition clause of a ;; for statement: At the first token after the starting paren. ;; On the first line in a continued expression that starts with ;; a stream op and there's no stream op on the previous line: ;; Boi of previous line. Otherwise: Boi at the beginning of ;; the statement, but after any type of label. (statement-block-intro . 0) ;; Relpos: At the block start if it's at boi, otherwise boi at ;; the start of the statement the open brace hangs on, or boi ;; at the preceding paren for inexpr statements. (statement-case-intro . 0) ;; Relpos: At the label keyword (always at boi). (statement-case-open . +) ;; Relpos: At the label keyword (always at boi). (substatement . fanf-else-if-magic) ;; Relpos: Boi at the containing statement or else clause. (substatement-open . +) ;; Relpos: Boi at the containing statement or else clause. (case-label . 0) ;; Relpos: At the switch block start if it's at boi, otherwise ;; boi at the start of the switch condition clause. (access-label . -) ;; Relpos: Eol (a bug?). (label . 0) ;; Relpos: At the start of the containing block if it's at boi, ;; otherwise boi at the start of the sexp before the block. (do-while-closure . 0) ;; Relpos: Boi at the corresponding while keyword. (else-clause . 0) ;; Relpos: Boi at the corresponding if keyword. ;(catch-clause . 0) ; emacs-20 incompat ;; Relpos: Boi at the previous try or catch keyword in the try ;; statement. (comment-intro . c-lineup-comment) ;; Relpos: None. (arglist-intro . +) ;; Relpos: Boi at the open paren, or at the first non-ws after ;; the open paren of the surrounding sexp, whichever is later. (arglist-cont . +) ;; Relpos: At the first token after the open paren. (arglist-cont-nonempty . +) ;; Relpos: Boi at the open paren, or at the first non-ws after ;; the open paren of the surrounding sexp, whichever is later. (arglist-close . +) ;; Relpos: Boi at the open paren, or at the first non-ws after ;; the open paren of the surrounding sexp, whichever is later. (stream-op . c-lineup-streamop) ;; Relpos: Boi at the first stream op in the statement. (inclass . +) ;; Relpos: At the class open brace if it's at boi, otherwise ;; boi at the class decl start. (cpp-macro . -1000) ; instead of emacs-21's [0] ;; Relpos: None. (cpp-macro-cont . +) ;; Relpos: At the macro start (always at boi). (friend . 0) ;; Relpos: None. (objc-method-intro . -1000) ; instead of emacs-21's [0] ;; Relpos: Boi. (objc-method-args-cont . c-lineup-ObjC-method-args) ;; Relpos: At the method start (always at boi). (objc-method-call-cont . c-lineup-ObjC-method-call) ;; Relpos: At the open bracket. (extern-lang-open . 0) ;; Relpos: Boi at the extern keyword. (extern-lang-close . 0) ;; Relpos: Boi at the corresponding extern keyword. (inextern-lang . +) ;; Relpos: At the extern block open brace if it's at boi, ;; otherwise boi at the extern keyword. (namespace-open . 0) ;; Relpos: Boi at the namespace keyword. (namespace-close . 0) ;; Relpos: Boi at the corresponding namespace keyword. (innamespace . +) ;; Relpos: At the namespace block open brace if it's at boi, ;; otherwise boi at the namespace keyword. (template-args-cont . +) ; instead of (c-lineup-template-args +) ;; Relpos: Boi at the decl start. ; (inlambda . c-lineup-inexpr-block) ; emacs-20 incompat ;; Relpos: None. ; (lambda-intro-cont . +) ; emacs-20 incompat ;; Relpos: Boi at the lambda start. ; (inexpr-statement . 0) ; emacs-20 incompat ;; Relpos: None. ; (inexpr-class . +) ; emacs-20 incompat ;; Relpos: None. )))) ;; }}} ;; {{{ (defun c-std-to-yacc (defun fanf-hyphens-to-underscores (chars) (let ((chars- (concat "^-" chars))) (while (progn (skip-chars-forward chars-) (if (not (eq ?- (following-char))) nil (delete-char 1) (insert "_") t))))) (defun fanf-std-to-yacc () "Convert grammer from the C standard into yacc syntax" (interactive) (re-search-forward "^ *(\\([0-9.]*\\)) *") (replace-match "/* std. sec. \\1 */\n\n") (fanf-hyphens-to-underscores ":") (insert "\n: ") (delete-region (point) (+ (point) 2)) (while (not (eq ?\n (following-char))) (let ((bol (point))) (skip-chars-forward " ") (delete-region bol (point)) (fanf-hyphens-to-underscores "\n") (forward-char) (insert "| "))) (delete-region (point) (- (point) 2)) (insert ";\n")) ;; }}} ;; }}} ;; {{{ perl (setq interpreter-mode-alist (append '( ("perl" . cperl-mode) ("perl5" . cperl-mode) ) interpreter-mode-alist)) (setq cperl-indent-level 8) (setq cperl-label-offset -4) (setq cperl-min-label-indent 0) (setq cperl-continued-statement-offset 4) ;; }}} ;; {{{ sgml (setq sgml-quick-keys t) ; in order to make psgml coexist happily with sgml-mode, ; we need to munge it like this: ; ; for file in *.el ; do ; mv $file $file.gaga ; sed -e 's/\([^p-]\)sgml-/\1psgml-/g;s/^sgml-/psgml-/' < $file.gaga > $file ; done (noerr (load "psgml")) (load "sgml-mode") ; Set both of these to cover different levels of psgml symbol renaming. (setq sgml-set-face t) (setq psgml-set-face t) (setq psgml-markup-faces '((comment . font-lock-comment-face) (doctype . font-lock-builtin-face) (end-tag . font-lock-keyword-face) (ignored . italic) (ms-end . bold) (ms-start . bold) (pi . font-lock-builtin-face) (sgml . font-lock-builtin-face) (start-tag . font-lock-keyword-face) (entity . font-lock-function-name-face) (shortref . font-lock-function-name-face))) (defun sgml-insert-comment () "Insert an SGML comment." (interactive) (insert "") (backward-char 4)) (define-key sgml-mode-map "!" 'sgml-insert-comment) ; remove the http: from the quick href anchor (define-skeleton html-href-anchor "HTML anchor tag with href attribute." nil "") (define-skeleton html-ordered-list "HTML ordered list tags." nil ?< "ol>" \n "
  • " _ \n "") (define-skeleton html-unordered-list "HTML unordered list tags." nil ?< "ul>" \n "
  • " _ \n "") (define-skeleton html-paragraph "HTML paragraph tag." nil (if (bolp) nil ?\n) \n "

    " _ "

    ") ; prevent tags from splitting lines (setq html-tag-alist (cons '("code") html-tag-alist)) ;; }}} ;; {{{ Man (setq Man-mode-line-format default-mode-line-format) (setq Man-notify-method 'pushy) ;; }}} ;; {{{ shell (setq shell-prompt-pattern "^:[ 0-9]*; ") (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) (set 'comint-buffer-maximum-size 1024) (add-hook 'comint-output-filter-functions 'comint-truncate-buffer) (setq sh-indentation 8) (setq sh-basic-offset 8) (setq sh-learn-basic-offset t) (setq sh-indent-comment t) (setq sh-indent-for-then 0) (setq sh-indent-for-do 0) (setq sh-indent-after-do '+) (setq sh-indent-for-case-label 0) (setq sh-indent-for-case-alt '+) (setq sh-indent-after-switch 0) ;; }}} ;; {{{ mail ;; see also ~/.vm ;(load "vm") (put 'rmail 'disabled t) (setq mail-header-separator "-- \n") ;; {{{ signature stuff (defun fanf-new-signature () (interactive) (save-excursion (set-buffer (get-buffer-create " signature")) (call-process "~/bin/randsig" nil t) (setq mail-signature (buffer-string)) (kill-buffer (current-buffer)))) (fanf-new-signature) (add-hook 'mail-setup-hook 'fanf-new-signature) ;; }}} ;; {{{ abbreviations (add-hook 'mail-setup-hook 'mail-abbrevs-setup) (add-hook 'mail-setup-hook '(lambda () (substitute-key-definition 'next-line 'mail-abbrev-next-line mail-mode-map global-map) (substitute-key-definition 'end-of-buffer 'mail-abbrev-end-of-buffer mail-mode-map global-map) )) (define-mail-abbrev "dotat" "Tony Finch ") (define-mail-abbrev "lspace" "Tony Finch ") (define-mail-abbrev "inch" "Tony Finch ") (define-mail-abbrev "chiark" "Tony Finch ") (define-mail-abbrev "dave" "Dave Williams ") (define-mail-abbrev "peterk" "Peter Kiggins ") (define-mail-abbrev "dme" "Dave Edmondson ") (define-mail-abbrev "mike" "Mike Bristow ") (define-mail-abbrev "noise" "Not signal ") (define-mail-abbrev "wibble" "Wobble ") (define-mail-abbrev "cugcr" "The Guild ") (define-mail-abbrev "183" "Mark Ynys-Mon , Paul Rose , Tony King , Tony Finch ") (define-mail-abbrev "trn" "TRN users ") (define-mail-abbrev "libwww" "libwww-perl@ics.uci.edu") (define-mail-abbrev "colin" "Colin Smythe ") ;; }}} ;; }}} ;; {{{ global key bindings ;; {{{ fix the behaviour of home and end (global-set-key [home] 'beginning-of-buffer) (global-set-key [end] 'end-of-buffer) (global-set-key [C-home] 'beginning-of-line) (global-set-key [C-end] 'end-of-line) ;; }}} ;; {{{ make the page-down and page-up keys inverses (defun forward-screen () "Move point down by the height of the window" (interactive) (next-line (/ (* (window-height) 3) 5)) ) (defun backward-screen () "Move point down by the height of the window" (interactive) (previous-line (/ (* (window-height) 3) 5)) ) (substitute-key-definition 'scroll-up 'forward-screen (current-global-map)) (substitute-key-definition 'scroll-down 'backward-screen (current-global-map)) ;; }}} ;; {{{ correct behaviour of delete (off) ;(global-set-key [delete] 'delete-char) ;(global-set-key [backspace] 'backward-delete-char) ;; }}} ;; {{{ correct behaviour of tab (off) ;(global-set-key "\C-i" 'self-insert-command) ;(global-set-key [S-iso-lefttab] 'indent-for-tab-command) ;; }}} ;; {{{ make emacs harder to kill (off) ;(global-set-key "\C-x\C-c" 'undefined) ;; }}} ;; {{{ list-buffers (defun list-buffers (&optional files-only) "Display a list of names of existing buffers. The list is displayed in a buffer named `*Buffer List*'. Note that buffers with names starting with spaces are omitted. Non-null optional arg FILES-ONLY means mention only file buffers. The M column contains a * for buffers that are modified. The R column contains a % for buffers that are read-only." (interactive "P") (switch-to-buffer (list-buffers-noselect files-only))) ;; }}} (global-set-key "\C-c," 'goto-line) ;; }}} ;; {{{ server (setq server-temp-file-regexp "fanf/.\\(article\\|letter\\)\\|^/tmp/mutt-") (cond ((noerr (load "gnuserv-compat")) (gnuserv-start) (global-set-key "\C-c\C-c" 'gnuserv-edit)) (t (server-start) (global-set-key "\C-c\C-c" 'server-edit))) ;; }}} ;; {{{ info (load "info") (setq Info-fontify-maximum-menu-size 1000000) ;; {{{ Info-other-frame (defun Info-other-frame (&optional file) "Start *info* mode in another frame." (interactive (if current-prefix-arg (list (read-file-name "Info file name: " nil nil t)))) (let ((pop-up-frames t) (buffer (current-buffer))) (pop-to-buffer buffer t) (raise-frame (window-frame (selected-window))) (info file))) ;; }}} ;; {{{ Info-uniquify-buffer (defun Info-uniquify-buffer () "Rename an *info* buffer uniquely." (rename-buffer "*info*" 't)) ;; }}} ;; {{{ Info-rename-buffer (defun Info-rename-buffer (suffix) "Rename an *info* buffer according to the user's choice." (interactive "sBuffer name suffix: ") (rename-buffer (concat "*info-" suffix "*"))) ;; }}} ;; {{{ Info-search-again (defun Info-search-again (regexp) "Search an info file with a better user-interface than Info-search." (interactive (list (if Info-search-history (car Info-search-history) (read-string "Regexp search: " nil 'Info-search-history)))) (Info-search regexp)) ;; }}} (global-set-key "\C-x5i" 'Info-other-frame ) (add-hook 'Info-mode-hook 'Info-uniquify-buffer) (define-key Info-mode-map "s" 'Info-search-again) (define-key Info-mode-map "S" 'Info-search) (define-key Info-mode-map "r" 'Info-rename-buffer) ;; }}} ;; {{{ fill (add-hook 'text-mode-hook 'turn-on-auto-fill) (setq adaptive-fill-mode t) (setq adaptive-fill-regexp "\\(-- \\|// \\|[;*#> \t]*\\)") (setq sentence-end-double-space nil) ;; }}} ;; {{{ folding ;; {{{ key bindings (setq folding-default-keys-function 'folding-bind-fanf-keys) (defun folding-bind-fanf-keys () "Tony Finch's folding mode key bindings" (define-key folding-mode-map [?\C-f] 'folding-forward-char) (define-key folding-mode-map [?\C-b] 'folding-backward-char) (define-key folding-mode-map [?\C-e] 'folding-end-of-line) (define-key folding-mode-map [?\C-c ?\C-f] 'folding-fold-region) (define-key folding-mode-map [?\C-c ?\C-[] 'folding-shift-in) (define-key folding-mode-map [?\C-c ?\C-\]] 'folding-shift-out) (define-key folding-mode-map [?\C-c ?\C--] 'folding-show-current-entry) (define-key folding-mode-map [?\C-c ?\C-=] 'folding-hide-current-entry) (define-key folding-mode-map [?\C-c ?\\] 'folding-region-open-close) (define-key folding-mode-map [?\C-c ?-] 'folding-show-current-subtree) (define-key folding-mode-map [?\C-c ?=] 'folding-hide-current-subtree) (define-key folding-mode-map [?\C-c ?[] 'folding-open-buffer) (define-key folding-mode-map [?\C-c ?\]] 'folding-whole-buffer) (define-key folding-mode-map [?\C-c ?'] 'folding-show-all) (define-key folding-mode-map [?\C-c ?n] 'folding-display-name) (define-key folding-mode-map [?\C-c ?/] 'folding-goto-line) (define-key folding-mode-map [?\C-c ?\C-v] 'folding-pick-move) (define-key folding-mode-map [?\C-c ?v] 'folding-previous-visible-heading) ) ;; }}} (load "folding") (folding-mode-add-find-file-hook) ;; }}} ;; {{{ colours (load "font-lock") ;; {{{ see x resources ;(set-background-color "black") ;(set-foreground-color "lightgrey") ;(set-border-color "white") ;(set-cursor-color "white") ;(set-mouse-color "white") ;; }}} ;; {{{ mail, vm, vm-summary ;(setq mail-font-lock-keywords ; '( ; ("^Subject:" . font-lock-type-face) ; ("^Reply-[Tt]o:.*$" . font-lock-function-name-face) ; ("^[>: ]*[>:][>: ]*.*$" . font-lock-comment-face) ; quote ; ("^\\(From\\|Sender\\):" . font-lock-function-name-face) ; ("^\\(In-[Rr]eply-[Tt]o\\|Date\\):" . font-lock-comment-face) ; ("^\\(To\\|Apparently-[Tt]o\\|[Cc][Cc]\\):" . font-lock-variable-name-face) ; )) ;(setq vm-font-lock-keywords mail-font-lock-keywords) ;(setq vm-summary-font-lock-keywords ; '( ; ("^D" . font-lock-string-face) ; Deleted ; ("^[NU]" . font-lock-type-face) ; Unread ; ("\\( : ..:.. ... .. ... : \\)" 1 font-lock-comment-face) ; Date ; ("\\( : \\)" 1 font-lock-comment-face) ; colons ; ) ; ) ;; }}} ;; {{{ shell ;(setq shell-font-lock-keywords ; (list (cons shell-prompt-pattern 'font-lock-type-face) ; (list (concat shell-prompt-pattern "\\([^\n]*\\)$") 1 'font-lock-string-face) ; '("^[a-z]*@[a-z.]*:.*$" . font-lock-type-face) ; '("^[-dl][-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT] .*$" . font-lock-comment-face) ; )) ;; }}} ;; {{{ default faces (modify-face 'default "lightgrey" "black" nil nil nil nil) (modify-face 'underline "lightgrey" "black" nil nil nil t) ;(modify-face 'bold "white" "black" nil t nil nil) ;(modify-face 'italic "lightgrey" "black" nil t nil t) ;(modify-face 'bold-italic "white" "black" nil t nil t) ;(modify-face 'highlight "white" "forestgreen" nil t nil nil) (modify-face 'modeline "white" "grey50" nil nil nil nil) ;(modify-face 'region "white" "navy" nil t nil nil) ;(modify-face 'secondary-selection "lightgrey" "navy" nil t nil nil) ;; }}} ;; {{{ info faces ;(setq Info-mode-hook ; '(lambda () ; (modify-face 'info-menu-5 "white" "black" nil t nil t) ; (modify-face 'info-node "white" "black" nil t nil nil) ; (modify-face 'info-xref "white" "black" nil t nil nil) ; )) ;; }}} ;; {{{ font lock faces ;(setq font-lock-face-attributes ; '( ; foreground back boldp italicp underlinep ; (font-lock-comment-face "mistyrose" "black" t nil nil) ; (font-lock-function-name-face "gold" "black" t nil nil) ; (font-lock-keyword-face "orange" "black" t nil t) ; (font-lock-reference-face "lavender" "black" t nil t) ; (font-lock-string-face "deepskyblue" "black" t nil nil) ; (font-lock-type-face "palegreen" "black" t nil nil) ; (font-lock-variable-name-face "wheat" "black" t nil nil) ; )) ;; }}} ;; {{{ font lock defaults tweaked for vm ;(setq font-lock-defaults-alist ; keywords for fontification keywords only case fold syntax table syntax fn. ; (append '((vm-summary-mode vm-summary-font-lock-keywords t nil nil nil) ; (vm-mode vm-font-lock-keywords t nil nil nil)) ; font-lock-defaults-alist)) ;; }}} ;(set-default-font "7x13bold") (setq font-lock-maximum-decoration t) (setq font-lock-maximum-size nil) (global-font-lock-mode t) ; For some reason, the "global" doesn't work for VM buffers (add-hook 'vm-mode-hook 'turn-on-font-lock) (add-hook 'vm-summary-mode-hook 'turn-on-font-lock) ; yuck yuck yuck, that was horrid ;; {{{ hilit (commented out) ;(cond (window-system ; (setq hilit-mode-enable-list '(not text-mode) ; hilit-background-mode 'dark ; hilit-inhibit-hooks nil ; hilit-inhibit-rebinding nil) ; (require 'hilit19))) ;; }}} ;; }}} ;; {{{ dired (defun dired-find-file-other-frame () "In dired, visit this file or directory in another frame." (interactive) (find-file-other-frame (file-name-sans-versions (dired-get-filename) t))) (define-key dired-mode-map "e" 'dired-find-file-other-frame) ;; }}} ; EOF