~vm/vm/vmpc-prompt

390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
1
;;; .vm --- Example ~/.vm
2
;;;
453.1.19 by Robert Widhopf-Fenk
Added emacs-lisp-mode tag to example.vm.
3
;;; -*- emacs-lisp -*-
4
;;;
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
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
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
22
;;; You may use this file as a starting point for setting up and customizing
23
;;; VM to your own needs.
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
24
25
;;*****************************************************************************
458 by Robert Widhopf-Fenk
Added (setq mail-user-agent 'vm-user-agent).
26
;; Make VM your default mail agent in Emacs
27
(setq mail-user-agent 'vm-user-agent)
28
29
;;*****************************************************************************
642 by Uday S Reddy
Updated README files.
30
31
;; Two ways of using VM:
32
;; - downloading mail to local folders
33
;; - reading mail on mail servers from anywhere on the internet
34
35
;; For local folders, set these variables:
36
37
(setq vm-folder-directory "~/mail")
544.5.1 by Brent Goodrick
Correct and clarify installation instructions and example usage
38
39
(setq 
642 by Uday S Reddy
Updated README files.
40
 ;; vm-primary-inbox is the filesystem path to where VM stores
41
 ;; downloaded messages: 
544.5.1 by Brent Goodrick
Correct and clarify installation instructions and example usage
42
 vm-primary-inbox "~/INBOX"
43
 ;; vm-crash-box is where messages are stored temporarily as it is moved into
642 by Uday S Reddy
Updated README files.
44
 ;; your primary inbox file (vm-primary-inbox). Here we just tack on a
45
 ;; .crash to name it separately:
544.5.1 by Brent Goodrick
Correct and clarify installation instructions and example usage
46
 vm-crash-box (concat vm-primary-inbox ".crash"))
47
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
48
;; vm-spool-files is a list of lists, each sublist should be of the form
49
;;   (INBOX SPOOLNAME CRASHBOX)
50
(setq vm-spool-files
51
      (list
52
       ;; You can drop mail to the same inbox from different spool files.
53
       (list vm-primary-inbox "/var/spool/mail/username1" vm-crash-box)
54
       (list vm-primary-inbox "/var/spool/mail/username2" vm-crash-box)
55
       ;; Another spool file
56
       (list "spam" (expand-file-name "~spam/drop")
57
             (concat vm-folder-directory "spam.crash"))
58
       ;; POP
642 by Uday S Reddy
Updated README files.
59
       (list "gmail.pop" 
60
	     "pop:pop.google.com:110:pass:YourEmailAddress:*"
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
61
             (concat vm-folder-directory "gmail.pop.crash"))
62
       ;; POP-SSL 
642 by Uday S Reddy
Updated README files.
63
       (list "gmail.pop" 
64
	     "pop-ssl:pop.google.com:995:pass:YourEmailAddress:*"
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
65
             (concat vm-folder-directory "gmail.pop.crash"))
66
       ;; IMAP
642 by Uday S Reddy
Updated README files.
67
       (list "gmail.imap" 
68
	     "imap:imap.google.com:143:inbox:login:YourEmailAddress:*"
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
69
             (concat vm-folder-directory "gmail.imap.crash"))
70
       ))
71
       
642 by Uday S Reddy
Updated README files.
72
;; For server folders, set these variables:
73
74
(setq vm-primary-inbox
75
      ;; use one of these two
76
      ;; for POP server 
77
      "pop:pop.google.com:110:pass:YourEmailAddress:*"
78
      ;; for IMAP server 
79
      "imap:imap.google.com:143:inbox:login:YourEmailAddress:*"
80
      )
81
82
(setq vm-pop-folder-cache-directory "~/mailcache")
83
(setq vm-imap-folder-cache-directory "~/mailcache")
84
85
(setq vm-pop-folder-alist
86
      ;; for other POP servers
87
      '(("pop:pop3.blueyonder.co.uk:110:pass:YourEmailAddress:*" 
88
	 "blueyonder")
89
	("pop:mailhost.cs.bham.ac.uk:110:pass:YourEmailAddress:*" 
90
	 "bham")))
91
(setq vm-imap-account-alist
92
      ;; for other IMAP servers
93
      '(("imap:imap4.blueyonder.co.uk:143:*:login:YourEmailAddress:*" 
94
	 "blueyonder")
95
	("imap:mailhost.cs.bham.ac.uk:143:*:login:YourEmailAddress:*" 
96
	 "bham")
97
	))
98
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
99
;;*****************************************************************************
100
;; Summary 
101
102
;; See the recipients for emails you sent instead of yourself.
103
(setq vm-summary-uninteresting-senders 
104
      (regexp-opt '("@robf.de" "Robert Widhopf-Fenk")))
105
106
;; Change the summary format by setting `vm-summary-format'.
107
;; Run "M-x vm-fix-my-summary!!! RET" to fix existing summaries.
108
109
;;*****************************************************************************
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
110
;; Viewing messages
111
;;
112
;; HTML messages can be converted to text or the w3 resp. w3m Emacs viewers
113
;; can be used for displaying. 
114
115
(setq  vm-mime-type-converter-alist
116
      '(("text/html" "text/plain" "lynx -force_html -dump /dev/stdin")
117
        ("message/delivery-status"  "text/plain")
118
        ("application/zip"  "text/plain" "listzip")
119
        ("application/x-zip-compressed"  "text/plain" "zipinfo /dev/stdin")
120
        ("application/x-www-form-urlencoded"  "text/plain")
121
        ("message/disposition-notification"  "text/plain")
122
        ("application/mac-binhex40" "application/octet-stream" "hexbin -s"))
123
124
      
125
;; Set up w3m (you should check if it exists)
126
(require 'vm-w3m)
127
(setq vm-included-mime-types-list
128
      '("text/plain" "text/html" "text/enriched" "message/rfc822"))
129
130
;;*****************************************************************************
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
131
;; Composing email
132
133
(setq mail-default-headers "From: Robert Widhopf-Fenk <hack@robf.de>\n")
134
135
(vmpc-my-identities "me@company1.nil" "me@home.nil" "me@alterego.nil")
136
(require 'vm-pcrisis)
137
138
;;*****************************************************************************
139
;; A hook function to setup mail-composing buffers
140
(defun robf-vm-mail-mode-hook ()
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
141
  "Robert Widhopf-Fenks `vm-mail-mode-hook'."
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
142
  (interactive)
143
144
  (when (string-match "received" (buffer-name))
145
    (make-local-variable 'vm-confirm-quit)
146
    (setq vm-confirm-quit t))
147
  
148
  (setq fill-column 60
149
        comment-start "> "
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
150
        indent-line-function 'indent-relative-maybe)
151
  
152
  ;; mark lines longer than `fill-column' chars red 
153
  (add-to-list 'mail-font-lock-keywords
154
               (list (concat "^" (make-string fill-column ?.)
155
                             "\\(.+$\\)")
156
                     '(1 font-lock-warning-face t)))
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
157
  
158
  (ispell-change-dictionary "deutsch8")
159
160
  (font-lock-mode 1)
161
  (turn-on-auto-fill)
162
  (turn-on-filladapt-mode)
163
  (flyspell-mode 1)
164
;  (enriched-mode 1)
165
;  (auto-capitalize-mode)
166
;  (vm-mail-subject-prefix-cleanup)
167
  )
168
169
(add-hook 'vm-mail-mode-hook 'robf-vm-mail-mode-hook)
170
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
171
;; Do you like boxquotes? 
172
(require 'boxquote)
173
174
(defun boxquote-region-and-edit-title (s e)
175
  (interactive "r")
176
  (boxquote-region s e)
177
  (call-interactively 'boxquote-title))
178
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
179
;;*****************************************************************************
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
180
;; Sending email via SMTP.
181
;;
544.5.1 by Brent Goodrick
Correct and clarify installation instructions and example usage
182
;; This is not done by VM, but by separate packages.  The standard package is
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
183
;; smtpmail.el and it should come with your Emacs. If you have more than one
184
;; email address and have to send them using different SMTP servers, the you
185
;; might want to take a look at esmtpmail.el a fork from smtpmail.el targeted
186
;; to deal with personal crisis support.
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
187
(require 'esmtpmail)
188
(setq send-mail-function 'esmtpmail-send-it
189
      esmtpmail-default-smtp-server "smtp.someprovider.com"
190
      ;; trace buffers help debugging problems 
191
      esmtpmail-debug-info t)
192
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
193
;; Select the SMTP server based on the From: header, i.e. the email address of
194
;; the author.  There are also other authentication  methods, see the docs.
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
195
(setq esmtpmail-send-it-by-alist 
196
      (list
197
       '("YourEmaiAddress1" "SMTPSERVER1"
198
         (vm-pop-login "pop:SMTPSERVER1:110:pass:YourEmailAddress:*"))
199
       '("YourEmaiAddress2" "SMTPSERVER2"
200
         (vm-after-pop "pop:SMTPSERVER2:110:pass:YourEmailAddress:*"))))
201
202
;;*****************************************************************************
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
203
;; Feed mail to a local queue if you are offline
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
204
(require 'feedmail)
205
206
(setq send-mail-function 'vm-mail-send-or-feed-it
207
      feedmail-enable-queue t
208
      feedmail-ask-before-queue nil
209
      feedmail-buffer-eating-function 'feedmail-buffer-to-smtpmail
210
      feedmail-queue-directory (expand-file-name "~/Mail/QUEUE"))
211
212
(define-key vm-mode-map "Qr"     'feedmail-run-the-queue)
213
(define-key vm-mode-map "Qc"     'vm-smtp-server-online-p)
214
(define-key vm-mode-map "Qw"     'feedmail-queue-reminder-medium)
215
216
(setq auto-mode-alist (cons '("\\.fqm$" . mail-mode) auto-mode-alist))
217
413 by Robert Widhopf-Fenk
Pimped the example.vm a bit.
218
;; Check the queue on startup 
390 by Robert Widhopf-Fenk
A nice example ~/.vm file.
219
(when (and (> (car (feedmail-look-at-queue-directory
220
                    feedmail-queue-directory)) 0))
221
  (feedmail-queue-reminder-medium)
222
  (sit-for 2)
223
  (if (y-or-n-p "Send messages now? ")
224
      (feedmail-run-the-queue)))
225
226
;;*****************************************************************************
227
;; BBDB - the address book for Emacs
228
(require 'bbdb)
229
(require 'bbdb-autoloads)
230
(bbdb-initialize 'vm 'sendmail)
231
(bbdb-insinuate-vm)
232
233
;; create records for people you reply to
234
(add-hook 'vm-reply-hook 'bbdb-force-record-create)
235
236
;;*****************************************************************************
237
;; Now change some keyboard bindings 
238
(define-key vm-mode-map [(meta up)]    'vm-previous-unread-message)
239
(define-key vm-mode-map [(meta down)]  'vm-next-unread-message)
240
(define-key vm-mode-map "\C- "  'vm-scroll-backward)
241
(define-key vm-mode-map " "     'vm-scroll-forward)
242
(define-key vm-mode-map "c"     'vm-continue-what-message-other-frame)
243
(define-key vm-mode-map "C"     'vm-continue-postponed-message)
244
(define-key vm-mode-map "R"     'vm-reply-other-frame)
245
(define-key vm-mode-map "r"     'vm-reply-include-text-other-frame)
246
(define-key vm-mode-map "\C-R"  'vm-followup-other-frame)
247
(define-key vm-mode-map "\C-r"  'vm-followup-include-text-other-frame)
248
(define-key vm-mode-map "f"     'vm-forward-message-other-frame)
249
(define-key vm-mode-map "m"     'vm-toggle-mark)
250
(define-key vm-mode-map "d"     'vm-delete-message-action)
251
(define-key vm-mode-map "s"     'vm-virtual-save-message)
252
(define-key vm-mode-map "w"     'vm-save-message-preview)
253
(define-key vm-mode-map "lr"    'vm-delete-message-labels)
254
(define-key vm-mode-map "li"    'rf-vm-label-toggle-important)
255
(define-key vm-mode-map "ls"    'rf-vm-label-toggle-spam)
256
(define-key vm-mode-map "W"     'vm-save-message-sans-headers)
257
(define-key vm-mode-map "W"     (make-sparse-keymap))
258
(define-key vm-mode-map "WW"    'vm-apply-window-configuration)
259
(define-key vm-mode-map "WS"    'vm-save-window-configuration)
260
(define-key vm-mode-map "WD"    'vm-delete-window-configuration)
261
(define-key vm-mode-map "W?"    'vm-window-help)
262
(define-key vm-mode-map "x"     'vm-expunge-folder)
263
(define-key vm-mode-map "X"     'vm-expunge-pop-messages)
264
(define-key vm-mode-map "#"     nil)
265
(define-key vm-mode-map "/"      'bbdb)
266
(define-key vm-mode-map [(control return)] 'vm-edit-init-file)
267
(define-key vm-mode-map "S"     'vm-save-everything)
268
(define-key vm-mode-map "\C-a"  'vm-mime-auto-save-all-attachments)
269
(define-key vm-mode-map "VO"    'vm-virtual-omit-message)
270
(define-key vm-mode-map "VU"    'vm-virtual-update-folders)
271
(define-key vm-mode-map [(control s)] 'isearch-forward)
272
(define-key vm-mode-map "o"     'vm-switch-to-folder)
273
274
(define-key vm-summary-mode-map [(control up)] 'previous-line)
275
(define-key vm-summary-mode-map [(control down)] 'next-line)
276
(define-key vm-summary-mode-map [(control s)] 'vm-isearch-forward)
277
278
(define-key vm-mail-mode-map [tab] 'indent-relative)
279
(define-key vm-mail-mode-map [(control tab)] 'mail-interactive-insert-alias)
280
(define-key vm-mail-mode-map [return] 'newline-and-indent)
281
(define-key vm-mail-mode-map "\C-c\C-i" 'vm-serial-yank-mail)
282
(define-key vm-mail-mode-map "\C-c\C-o" 'vm-serial-expand-tokens)
283
(define-key vm-mail-mode-map [(control c) (control I)] 'vm-serial-insert-token)
284
(define-key vm-mail-mode-map [(control meta delete)] 'kill-this-buffer)
285
(define-key vm-mail-mode-map "\C-c\C-c" 'vm-mail-mode-comment-region)
286
(define-key vm-mail-mode-map "\C-c\C-d" 'vm-mail-mode-elide-reply-region)
287
(define-key vm-mail-mode-map "\C-c\C-k" 'vm-mail-mode-citation-clean-up)
288
(define-key vm-mail-mode-map "\C-c\C-a" 'vm-mime-attach-file)
289
(define-key vm-mail-mode-map "\C-c\C-b" 'boxquote-region-and-edit-title)
290
291
;;; Local Variables: ***
292
;;; mode:emacs-lisp ***
293
;;; End: ***
294
295
;;; .vm ends here