Import XE riece pkg Makefile/package-info.in
[packages] / xemacs-packages / vm / example.vm
1 ;;; .vm --- Example ~/.vm
2 ;;;
3 ;;; -*- emacs-lisp -*-
4 ;;;
5 ;;; Copyright (C) 2007 Robert Widhopf-Fenk
6 ;;;
7 ;;; This program is free software; you can redistribute it and/or modify
8 ;;; it under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 1, or (at your option)
10 ;;; any later version.
11 ;;;
12 ;;; This program is distributed in the hope that it will be useful,
13 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with this program; if not, write to the Free Software
19 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 ;;;
21
22 ;;; You may use this file as a starting point for setting up and customizing
23 ;;; VM to your own needs.
24
25 ;;*****************************************************************************
26 ;; Make VM your default mail agent in Emacs
27 (setq mail-user-agent 'vm-user-agent)
28
29 ;;*****************************************************************************
30 ;; Folders and spool files, this is where your mail comes from.
31
32 ;; vm-spool-files is a list of lists, each sublist should be of the form
33 ;;   (INBOX SPOOLNAME CRASHBOX)
34
35 (setq vm-spool-files
36       (list
37        ;; You can drop mail to the same inbox from different spool files.
38        (list vm-primary-inbox "/var/spool/mail/username1" vm-crash-box)
39        (list vm-primary-inbox "/var/spool/mail/username2" vm-crash-box)
40        ;; Another spool file
41        (list "spam" (expand-file-name "~spam/drop")
42              (concat vm-folder-directory "spam.crash"))
43        ;; POP
44        (list "gmail.pop" "pop:pop.google.com:110:pass:YourEmailAddress:*"
45              (concat vm-folder-directory "gmail.pop.crash"))
46        ;; POP-SSL 
47        (list "gmail.pop" "pop-ssl:pop.google.com:995:pass:YourEmailAddress:*"
48              (concat vm-folder-directory "gmail.pop.crash"))
49        ;; IMAP
50        (list "gmail.imap" "imap:imap.google.com:143:inbox:login:YourEmailAddress:*"
51              (concat vm-folder-directory "gmail.imap.crash"))
52        ))
53        
54 ;;*****************************************************************************
55 ;; Summary 
56
57 ;; See the recipients for emails you sent instead of yourself.
58 (setq vm-summary-uninteresting-senders 
59       (regexp-opt '("@robf.de" "Robert Widhopf-Fenk")))
60
61 ;; Change the summary format by setting `vm-summary-format'.
62 ;; Run "M-x vm-fix-my-summary!!! RET" to fix existing summaries.
63
64 ;;*****************************************************************************
65 ;; Viewing messages
66 ;;
67 ;; HTML messages can be converted to text or the w3 resp. w3m Emacs viewers
68 ;; can be used for displaying. 
69
70 (setq  vm-mime-type-converter-alist
71       '(("text/html" "text/plain" "lynx -force_html -dump /dev/stdin")
72         ("message/delivery-status"  "text/plain")
73         ("application/zip"  "text/plain" "listzip")
74         ("application/x-zip-compressed"  "text/plain" "zipinfo /dev/stdin")
75         ("application/x-www-form-urlencoded"  "text/plain")
76         ("message/disposition-notification"  "text/plain")
77         ("application/mac-binhex40" "application/octet-stream" "hexbin -s"))
78
79       
80 ;; Set up w3m (you should check if it exists)
81 (require 'vm-w3m)
82 (setq vm-included-mime-types-list
83       '("text/plain" "text/html" "text/enriched" "message/rfc822"))
84
85 ;;*****************************************************************************
86 ;; Composing email
87
88 (setq mail-default-headers "From: Robert Widhopf-Fenk <hack@robf.de>\n")
89
90 (vmpc-my-identities "me@company1.nil" "me@home.nil" "me@alterego.nil")
91 (require 'vm-pcrisis)
92
93 ;;*****************************************************************************
94 ;; A hook function to setup mail-composing buffers
95 (defun robf-vm-mail-mode-hook ()
96   "Robert Widhopf-Fenks `vm-mail-mode-hook'."
97   (interactive)
98
99   (when (string-match "received" (buffer-name))
100     (make-local-variable 'vm-confirm-quit)
101     (setq vm-confirm-quit t))
102   
103   (setq fill-column 60
104         comment-start "> "
105         indent-line-function 'indent-relative-maybe)
106   
107   ;; mark lines longer than `fill-column' chars red 
108   (add-to-list 'mail-font-lock-keywords
109                (list (concat "^" (make-string fill-column ?.)
110                              "\\(.+$\\)")
111                      '(1 font-lock-warning-face t)))
112   
113   (ispell-change-dictionary "deutsch8")
114
115   (font-lock-mode 1)
116   (turn-on-auto-fill)
117   (turn-on-filladapt-mode)
118   (flyspell-mode 1)
119 ;  (enriched-mode 1)
120 ;  (auto-capitalize-mode)
121 ;  (vm-mail-subject-prefix-cleanup)
122   )
123
124 (add-hook 'vm-mail-mode-hook 'robf-vm-mail-mode-hook)
125
126 ;; Do you like boxquotes? 
127 (require 'boxquote)
128
129 (defun boxquote-region-and-edit-title (s e)
130   (interactive "r")
131   (boxquote-region s e)
132   (call-interactively 'boxquote-title))
133
134 ;;*****************************************************************************
135 ;; Sending email via SMTP.
136 ;;
137 ;; This is not done by VM, by by separate packages.  The standard package is
138 ;; smtpmail.el and it should come with your Emacs. If you have more than one
139 ;; email address and have to send them using different SMTP servers, the you
140 ;; might want to take a look at esmtpmail.el a fork from smtpmail.el targeted
141 ;; to deal with personal crisis support.
142 (require 'esmtpmail)
143 (setq send-mail-function 'esmtpmail-send-it
144       esmtpmail-default-smtp-server "smtp.someprovider.com"
145       ;; trace buffers help debugging problems 
146       esmtpmail-debug-info t)
147
148 ;; Select the SMTP server based on the From: header, i.e. the email address of
149 ;; the author.  There are also other authentication  methods, see the docs.
150 (setq esmtpmail-send-it-by-alist 
151       (list
152        '("YourEmaiAddress1" "SMTPSERVER1"
153          (vm-pop-login "pop:SMTPSERVER1:110:pass:YourEmailAddress:*"))
154        '("YourEmaiAddress2" "SMTPSERVER2"
155          (vm-after-pop "pop:SMTPSERVER2:110:pass:YourEmailAddress:*"))))
156
157 ;;*****************************************************************************
158 ;; Feed mail to a local queue if you are offline
159 (require 'feedmail)
160
161 (setq send-mail-function 'vm-mail-send-or-feed-it
162       feedmail-enable-queue t
163       feedmail-ask-before-queue nil
164       feedmail-buffer-eating-function 'feedmail-buffer-to-smtpmail
165       feedmail-queue-directory (expand-file-name "~/Mail/QUEUE"))
166
167 (define-key vm-mode-map "Qr"     'feedmail-run-the-queue)
168 (define-key vm-mode-map "Qc"     'vm-smtp-server-online-p)
169 (define-key vm-mode-map "Qw"     'feedmail-queue-reminder-medium)
170
171 (setq auto-mode-alist (cons '("\\.fqm$" . mail-mode) auto-mode-alist))
172
173 ;; Check the queue on startup 
174 (when (and (> (car (feedmail-look-at-queue-directory
175                     feedmail-queue-directory)) 0))
176   (feedmail-queue-reminder-medium)
177   (sit-for 2)
178   (if (y-or-n-p "Send messages now? ")
179       (feedmail-run-the-queue)))
180
181 ;;*****************************************************************************
182 ;; BBDB - the address book for Emacs
183 (require 'bbdb)
184 (require 'bbdb-autoloads)
185 (bbdb-initialize 'vm 'sendmail)
186 (bbdb-insinuate-vm)
187
188 ;; create records for people you reply to
189 (add-hook 'vm-reply-hook 'bbdb-force-record-create)
190
191 ;;*****************************************************************************
192 ;; Now change some keyboard bindings 
193 (define-key vm-mode-map [(meta up)]    'vm-previous-unread-message)
194 (define-key vm-mode-map [(meta down)]  'vm-next-unread-message)
195 (define-key vm-mode-map "\C- "  'vm-scroll-backward)
196 (define-key vm-mode-map " "     'vm-scroll-forward)
197 (define-key vm-mode-map "c"     'vm-continue-what-message-other-frame)
198 (define-key vm-mode-map "C"     'vm-continue-postponed-message)
199 (define-key vm-mode-map "R"     'vm-reply-other-frame)
200 (define-key vm-mode-map "r"     'vm-reply-include-text-other-frame)
201 (define-key vm-mode-map "\C-R"  'vm-followup-other-frame)
202 (define-key vm-mode-map "\C-r"  'vm-followup-include-text-other-frame)
203 (define-key vm-mode-map "f"     'vm-forward-message-other-frame)
204 (define-key vm-mode-map "m"     'vm-toggle-mark)
205 (define-key vm-mode-map "d"     'vm-delete-message-action)
206 (define-key vm-mode-map "s"     'vm-virtual-save-message)
207 (define-key vm-mode-map "w"     'vm-save-message-preview)
208 (define-key vm-mode-map "lr"    'vm-delete-message-labels)
209 (define-key vm-mode-map "li"    'rf-vm-label-toggle-important)
210 (define-key vm-mode-map "ls"    'rf-vm-label-toggle-spam)
211 (define-key vm-mode-map "W"     'vm-save-message-sans-headers)
212 (define-key vm-mode-map "W"     (make-sparse-keymap))
213 (define-key vm-mode-map "WW"    'vm-apply-window-configuration)
214 (define-key vm-mode-map "WS"    'vm-save-window-configuration)
215 (define-key vm-mode-map "WD"    'vm-delete-window-configuration)
216 (define-key vm-mode-map "W?"    'vm-window-help)
217 (define-key vm-mode-map "x"     'vm-expunge-folder)
218 (define-key vm-mode-map "X"     'vm-expunge-pop-messages)
219 (define-key vm-mode-map "#"     nil)
220 (define-key vm-mode-map "/"      'bbdb)
221 (define-key vm-mode-map [(control return)] 'vm-edit-init-file)
222 (define-key vm-mode-map "S"     'vm-save-everything)
223 (define-key vm-mode-map "\C-a"  'vm-mime-auto-save-all-attachments)
224 (define-key vm-mode-map "VO"    'vm-virtual-omit-message)
225 (define-key vm-mode-map "VU"    'vm-virtual-update-folders)
226 (define-key vm-mode-map [(control s)] 'isearch-forward)
227 (define-key vm-mode-map "o"     'vm-switch-to-folder)
228
229 (define-key vm-summary-mode-map [(control up)] 'previous-line)
230 (define-key vm-summary-mode-map [(control down)] 'next-line)
231 (define-key vm-summary-mode-map [(control s)] 'vm-isearch-forward)
232
233 (define-key vm-mail-mode-map [tab] 'indent-relative)
234 (define-key vm-mail-mode-map [(control tab)] 'mail-interactive-insert-alias)
235 (define-key vm-mail-mode-map [return] 'newline-and-indent)
236 (define-key vm-mail-mode-map "\C-c\C-i" 'vm-serial-yank-mail)
237 (define-key vm-mail-mode-map "\C-c\C-o" 'vm-serial-expand-tokens)
238 (define-key vm-mail-mode-map [(control c) (control I)] 'vm-serial-insert-token)
239 (define-key vm-mail-mode-map [(control meta delete)] 'kill-this-buffer)
240 (define-key vm-mail-mode-map "\C-c\C-c" 'vm-mail-mode-comment-region)
241 (define-key vm-mail-mode-map "\C-c\C-d" 'vm-mail-mode-elide-reply-region)
242 (define-key vm-mail-mode-map "\C-c\C-k" 'vm-mail-mode-citation-clean-up)
243 (define-key vm-mail-mode-map "\C-c\C-a" 'vm-mime-attach-file)
244 (define-key vm-mail-mode-map "\C-c\C-b" 'boxquote-region-and-edit-title)
245
246 ;;; Local Variables: ***
247 ;;; mode:emacs-lisp ***
248 ;;; End: ***
249
250 ;;; .vm ends here