3 ;;; Configuration for VM
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
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)
19 (and (eq (terminal-coding-system) 'utf-8)
20 (add-to-list 'vm-mime-default-face-charsets "utf-8"))
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)
27 (setq vm-visible-headers '("resent-from:" "from:" "reply-to:" "sender:"
28 "to:" "apparently-to:" "cc:"
30 "delivered-to:" "return-path:"))
32 (setq vm-reply-ignored-addresses bbdb-user-mail-names)
34 (defvar mdw-mailing-lists
35 '("hibachi-dealers-members@chiark\\.greenend\\.org\\.uk"))
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")))
46 (setq vm-url-browser "sensible-browser")
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)))))
53 (setq vm-auto-folder-alist
54 '(("delivered-to" ("root@" . "admin"))
55 ("from" ("Cron Daemon" . "admin"))))
57 (defun join-strings (del strings)
58 (with-output-to-string
62 (setq strings (cdr strings))
66 (setq strings (cdr strings))))))
68 (defun mdw-vm-fix-mailing-lists ()
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 "\\<\\("
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))))
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:")
92 (goto-char (point-min))
93 (insert (format "To: %s\n" (join-strings ", " new))))))))))
95 (add-hook 'vm-reply-hook 'mdw-vm-fix-mailing-lists)
97 (defun mdw-mark-as-spam ()
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)