chiark / gitweb /
dot/vm: Make `vm-reply-ignored-addresses' be a list.
[profile] / dot / vm
1 ;;; -*-emacs-lisp-*-
2 ;;;
3 ;;; Configuration for VM
4
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"
14       vm-movemail-program "movemail-hack"
15       vm-delete-after-saving t
16       vm-move-after-deleting t
17       vm-delete-empty-folders nil)
18
19 (and (eq (terminal-coding-system) 'utf-8)
20      (add-to-list 'vm-mime-default-face-charsets "utf-8"))
21
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)
26
27 (setq vm-visible-headers '("resent-from:" "from:" "reply-to:" "sender:"
28                            "to:" "apparently-to:" "cc:"
29                            "subject:" "date:"
30                            "delivered-to:" "return-path:"))
31
32 (setq vm-reply-ignored-addresses (cons bbdb-user-mail-names nil))
33
34 (defvar mdw-mailing-lists
35   '("hibachi-dealers-members@chiark\\.greenend\\.org\\.uk"))
36
37 (setq vm-mime-external-content-types-alist
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")))
45
46 (setq vm-url-browser "sensible-browser")
47
48 (setq vm-frame-parameter-alist
49       '((folder ((width . 81) (height . 33)))
50         (summary ((width . 81) (height . 33)))
51         (primary-summary ((width . 81) (height . 33)))))
52
53 (setq vm-auto-folder-alist
54       '(("delivered-to" ("root@" . "admin"))
55         ("from" ("Cron Daemon" . "admin"))))
56
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))))))
67
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)
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)