tigrc: Assume commits are UTF-8 now.
[profile] / vm
1 ;;; -*-emacs-lisp-*-
2 ;;;
3 ;;; Configuration for VM
4
5 (let ((path exec-path))
6 (while path
7 (let ((try (expand-file-name "movemail" (car path))))
8 (if (file-executable-p try)
9 (setenv "REAL_MOVEMAIL" try))
10 (setq path (cdr path)))))
11
12 (setq vm-reply-subject-prefix "Re: "
13 vm-included-text-prefix "> "
14 vm-included-text-attribution-format "%F <%f> wrote:\n\n"
15 vm-folder-directory "~/Mail/"
16 vm-startup-with-summary t
17 vm-skip-deleted-messages nil
18 vm-circular-folders nil
19 vm-preview-lines nil
20 vm-highlighted-header-regexp "^From\\|^Subject"
21 vm-movemail-program "movemail-hack"
22 vm-delete-after-saving t
23 vm-move-after-deleting t
24 vm-delete-empty-folders)
25
26 (setq vm-mime-qp-encoder-program "mimencode"
27 vm-mime-qp-encoder-switches '("-q")
28 vm-mime-qp-decoder-program "mimencode"
29 vm-mime-qp-decoder-switches '("-q" "-u")
30 vm-mime-base64-encoder-program "mimencode"
31 vm-mime-base64-encoder-switches '("-b")
32 vm-mime-base64-decoder-program "mimencode"
33 vm-mime-base64-decoder-switches '("-b" "-u"))
34
35 (setq vm-visible-headers '("resent-from:" "from:" "reply-to:" "sender:"
36 "to:" "apparently-to:" "cc:"
37 "subject:" "date:"
38 "delivered-to:" "return-path:"))
39
40 (setq vm-reply-ignored-addresses '("mdw@excessus\\.demon\\.co\\.uk"
41 "mdw@nsict\\.org" "mdw@eh\\.org"
42 "mdw@ncipher\\.com"
43 "mwooding@ncipher\\.com"
44 "submit@bugs\\.ncipher\\.com"
45 "mdw@chiark\\.greenend\\.org\\.uk"
46 "mdw@distorted\\.org\\.uk"
47 "mdw@metalzone\\.distorted\\.org\\.uk"
48 "tux@nsict\\.org"))
49
50 (defvar mdw-mailing-lists
51 '("hibachi-dealers-members@chiark\\.greenend\\.org\\.uk"))
52
53 (setq vm-mime-external-content-types-alist
54 '(("image/jpeg" "display")
55 ("image/jpg" "display")
56 ("image/gif" "display")
57 ("image/bmp" "display")
58 ("image/tiff" "display")
59 ("application/postscript" "evince")
60 ("application/pdf" "evince")))
61
62 (setq vm-url-browser "firefox")
63
64 (setq vm-frame-parameter-alist
65 '((folder ((width . 81) (height . 33)))
66 (summary ((width . 81) (height . 33)))
67 (primary-summary ((width . 81) (height . 33)))))
68
69 (setq vm-auto-folder-alist
70 '(("delivered-to" ("root@" . "admin"))
71 ("from" ("Cron Daemon" . "admin"))))
72
73 (defun join-strings (del strings)
74 (with-output-to-string
75 (if (null strings)
76 nil
77 (princ (car strings))
78 (setq strings (cdr strings))
79 (while strings
80 (princ del)
81 (princ (car strings))
82 (setq strings (cdr strings))))))
83
84 (defun mdw-vm-fix-mailing-lists ()
85 (save-restriction
86 (save-excursion
87 (or (vm-mail-mode-get-header-contents "Resent-To:")
88 (vm-mail-mode-get-header-contents "Resent-Cc:")
89 (vm-mail-mode-get-header-contents "Resent-Bcc:")
90 (let ((mailing-list-regex (concat "\\<\\("
91 (join-strings "\\|"
92 mdw-mailing-lists)
93 "\\)\\>"))
94 (to (vm-mail-mode-get-header-contents "To:"))
95 (cc (vm-mail-mode-get-header-contents "Cc:")))
96 (if (or (and to (string-match mailing-list-regex to))
97 (and cc (string-match mailing-list-regex cc)))
98 (let ((addrs (nconc (and to (vm-parse-addresses to))
99 (and cc (vm-parse-addresses cc))))
100 (new nil))
101 (while addrs
102 (if (string-match mailing-list-regex (car addrs))
103 (setq new (cons (car addrs) new)))
104 (setq addrs (cdr addrs)))
105 (vm-mail-mode-remove-header "Cc:")
106 (vm-mail-mode-remove-header "To:")
107 (widen)
108 (goto-char (point-min))
109 (insert (format "To: %s\n" (join-strings ", " new))))))))))
110
111 (add-hook 'vm-reply-hook 'mdw-vm-fix-mailing-lists)
112
113 (defun mdw-mark-as-spam ()
114 (interactive)
115 (save-window-excursion
116 (vm-pipe-message-to-command "userv spamd spam" 1))
117 (vm-delete-message 1))
118 (define-key vm-summary-mode-map "/" 'mdw-mark-as-spam)