Commit | Line | Data |
---|---|---|
f617db13 MW |
1 | ;;; -*-emacs-lisp-*- |
2 | ;;; | |
3 | ;;; Configuration for VM | |
4 | ||
6b3f86c6 MW |
5 | (setq vm-reply-subject-prefix "Re: " |
6 | vm-included-text-prefix "> " | |
7 | vm-included-text-attribution-format "%F <%f> wrote:\n\n" | |
8 | vm-folder-directory "~/Mail/" | |
9 | vm-startup-with-summary t | |
10 | vm-skip-deleted-messages nil | |
11 | vm-circular-folders nil | |
12 | vm-preview-lines nil | |
13 | vm-highlighted-header-regexp "^From\\|^Subject" | |
370d4c8d | 14 | vm-movemail-program "movemail-hack" |
6b3f86c6 MW |
15 | vm-delete-after-saving t |
16 | vm-move-after-deleting t | |
12e2ef0f | 17 | vm-delete-empty-folders nil) |
6b3f86c6 | 18 | |
7445ca65 MW |
19 | (and (eq (terminal-coding-system) 'utf-8) |
20 | (add-to-list 'vm-mime-default-face-charsets "utf-8")) | |
21 | ||
a7e3398f MW |
22 | (setq vm-mime-qp-encoder-program nil |
23 | vm-mime-qp-decoder-program nil | |
24 | vm-mime-base64-encoder-program nil | |
25 | vm-mime-base64-decoder-program nil) | |
6b3f86c6 | 26 | |
f617db13 MW |
27 | (setq vm-visible-headers '("resent-from:" "from:" "reply-to:" "sender:" |
28 | "to:" "apparently-to:" "cc:" | |
29 | "subject:" "date:" | |
30 | "delivered-to:" "return-path:")) | |
6b3f86c6 | 31 | |
18eb979f | 32 | (setq vm-reply-ignored-addresses bbdb-user-mail-names) |
f617db13 MW |
33 | |
34 | (defvar mdw-mailing-lists | |
35 | '("hibachi-dealers-members@chiark\\.greenend\\.org\\.uk")) | |
36 | ||
37 | (setq vm-mime-external-content-types-alist | |
773d8b62 MW |
38 | '(("image/jpeg" "xdg-open") |
39 | ("image/jpg" "xdg-open") | |
40 | ("image/gif" "xdg-open") | |
41 | ("image/bmp" "xdg-open") | |
42 | ("image/tiff" "xdg-open") | |
43 | ("application/postscript" "xdg-open") | |
44 | ("application/pdf" "xdg-open"))) | |
f617db13 | 45 | |
773d8b62 | 46 | (setq vm-url-browser "sensible-browser") |
f617db13 MW |
47 | |
48 | (setq vm-frame-parameter-alist | |
4b05ce02 MW |
49 | '((folder ((width . 81) (height . 33))) |
50 | (summary ((width . 81) (height . 33))) | |
e4a505a0 | 51 | (primary-summary ((width . 81) (height . 33))))) |
f617db13 MW |
52 | |
53 | (setq vm-auto-folder-alist | |
739cf036 MW |
54 | '(("delivered-to" ("root@" . "admin")) |
55 | ("from" ("Cron Daemon" . "admin")))) | |
f617db13 | 56 | |
f617db13 MW |
57 | (defun join-strings (del strings) |
58 | (with-output-to-string | |
59 | (if (null strings) | |
60 | nil | |
61 | (princ (car strings)) | |
62 | (setq strings (cdr strings)) | |
63 | (while strings | |
64 | (princ del) | |
65 | (princ (car strings)) | |
66 | (setq strings (cdr strings)))))) | |
cc643e69 | 67 | |
f617db13 MW |
68 | (defun mdw-vm-fix-mailing-lists () |
69 | (save-restriction | |
70 | (save-excursion | |
71 | (or (vm-mail-mode-get-header-contents "Resent-To:") | |
72 | (vm-mail-mode-get-header-contents "Resent-Cc:") | |
73 | (vm-mail-mode-get-header-contents "Resent-Bcc:") | |
74 | (let ((mailing-list-regex (concat "\\<\\(" | |
75 | (join-strings "\\|" | |
76 | mdw-mailing-lists) | |
77 | "\\)\\>")) | |
78 | (to (vm-mail-mode-get-header-contents "To:")) | |
79 | (cc (vm-mail-mode-get-header-contents "Cc:"))) | |
80 | (if (or (and to (string-match mailing-list-regex to)) | |
81 | (and cc (string-match mailing-list-regex cc))) | |
82 | (let ((addrs (nconc (and to (vm-parse-addresses to)) | |
83 | (and cc (vm-parse-addresses cc)))) | |
84 | (new nil)) | |
85 | (while addrs | |
86 | (if (string-match mailing-list-regex (car addrs)) | |
87 | (setq new (cons (car addrs) new))) | |
88 | (setq addrs (cdr addrs))) | |
89 | (vm-mail-mode-remove-header "Cc:") | |
90 | (vm-mail-mode-remove-header "To:") | |
91 | (widen) | |
92 | (goto-char (point-min)) | |
93 | (insert (format "To: %s\n" (join-strings ", " new)))))))))) | |
94 | ||
95 | (add-hook 'vm-reply-hook 'mdw-vm-fix-mailing-lists) | |
c3600620 MW |
96 | |
97 | (defun mdw-mark-as-spam () | |
98 | (interactive) | |
99 | (save-window-excursion | |
100 | (vm-pipe-message-to-command "userv spamd spam" 1)) | |
101 | (vm-delete-message 1)) | |
102 | (define-key vm-summary-mode-map "/" 'mdw-mark-as-spam) |