Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 580 lines (567 sloc) 25.044 kb
eba0338 Eli Barzilay Initial import
authored
1 (add-to-list 'load-path
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
2 (concat eli-extras-dir "vm/vm-8.1.93a/lisp"))
eba0338 Eli Barzilay Initial import
authored
3 (add-to-list 'Info-default-directory-list
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
4 (concat eli-extras-dir "vm/vm-8.1.93a/info"))
5
eba0338 Eli Barzilay Initial import
authored
6 (require 'vm)
a9740b7 Eli Barzilay Improve #; highlighting, make the time estimate for email replies more c...
authored
7 (eval-when-compile (require 'cl))
eba0338 Eli Barzilay Initial import
authored
8
9 (setq
10 ;; >> vm
11 vm-assimilate-new-messages-sorted nil
12 vm-init-file (concat main-mail-directory ".vm")
13 vm-preferences-file (concat main-mail-directory ".vm.preferences")
14 vm-folder-directory main-mail-directory
15 vm-primary-inbox (concat main-mail-directory "INBOX")
16 vm-crash-box (concat main-mail-directory "INBOX.crash")
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
17 vm-fetched-message-limit 10
18 vm-index-file-suffix nil ; disable index files
19 ;; vm-spool-files '("/var/spool/mail/eli") ; <-- set automatically
eba0338 Eli Barzilay Initial import
authored
20 vm-spool-file-suffixes '(".spool") ; automatic spools
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
21 vm-crash-box-suffix ".crash" ; crash needed for the above
eba0338 Eli Barzilay Initial import
authored
22 vm-auto-get-new-mail t
23 vm-mail-check-interval 60
24 ;; vm-default-folder-type 'From_
25 ;; vm-default-From_-folder-type 'From_
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
26 ;; vm-trust-From_-with-Content-Length nil
eba0338 Eli Barzilay Initial import
authored
27 vm-default-new-folder-line-ending-type 'lf
28 vm-check-folder-types t
29 vm-convert-folder-types t
30 vm-visible-headers
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
31 '("Resent-"
32 "From:"
33 ;; "Sender:"
34 "To:"
35 "Apparently-To:"
36 "Cc:"
37 "Subject:"
38 "Date:"
39 "Reply-To:")
40 vm-invisible-header-regexp nil
eba0338 Eli Barzilay Initial import
authored
41 vm-highlighted-header-regexp "From:\\|Subject:\\|Reply-To:"
42 vm-preview-lines 0
43 vm-preview-read-messages nil
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
44 vm-word-wrap-paragraphs nil ; why not use emacs word-wrapping?
45 ;; NEWS file says: "Set to nil to enable the usual filling functionality"
46 vm-word-wrap-paragraphs-in-reply nil ; doesn't work well
eba0338 Eli Barzilay Initial import
authored
47 vm-fill-paragraphs-containing-long-lines nil ; cute, but too slow
48 vm-paragraph-fill-column 72
49 vm-display-using-mime t
50 ;; ?? vm-mime-ignore-mime-version t
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
51 ;; ?? vm-mime-require-mime-version-header nil
eba0338 Eli Barzilay Initial import
authored
52 ;; ?? vm-mime-ignore-composite-type-opaque-transfer-encoding t
53 ;; ?? vm-mime-ignore-missing-multipart-boundary t
54 vm-send-using-mime t
55 vm-honor-mime-content-disposition t ; and see below: no images
56 vm-auto-decode-mime-messages t
57 vm-mime-decode-for-preview nil ; no preview lines anyway
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
58 vm-auto-displayed-mime-content-types
59 '("text" "multipart" "message/rfc822") ; no images
60 vm-auto-displayed-mime-content-type-exceptions '("image")
eba0338 Eli Barzilay Initial import
authored
61 vm-mime-internal-content-types t
62 vm-mime-internal-content-type-exceptions '("text/calendar")
63 vm-mime-external-content-types-alist
7ec2e6c Eli Barzilay A smart DWIM return binding for mime objects.
authored
64 '(("text/html" "firefox") ("image" "qiv") ("video" "mplayer"))
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
65 vm-mime-external-content-type-exceptions '()
eba0338 Eli Barzilay Initial import
authored
66 vm-mime-delete-viewer-processes t
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
67 vm-mime-type-converter-alist
68 (cond
69 ;; ((findif 'file-exists-p '("/usr/bin/w3m" "/usr/local/bin/w3m"))
70 ;; ;; use w3m to render html->text
71 ;; (add-to-list 'vm-mime-internal-content-type-exceptions "text/html")
72 ;; '(("text/html" "text/plain" "w3m -T text/html -no-cookie -dump")))
73 ;; ((findif 'file-exists-p '("/usr/bin/lynx" "/usr/local/bin/lynx"))
74 ;; ;; use lynx to render html->text
75 ;; (add-to-list 'vm-mime-internal-content-type-exceptions "text/html")
76 ;; '(("text/html" "text/plain" "lynx -force_html -dump /dev/stdin")))
77 (t nil))
78 vm-mime-alternative-select-method
79 '(favorite-internal "text/plain" "text/html" "text")
80 vm-mime-text/html-handler 'auto-select
81 vm-mime-text/html-blocker "<img[^>]*\\s-src=."
82 vm-mime-text/html-blocker-exceptions '()
eba0338 Eli Barzilay Initial import
authored
83 vm-mime-default-face-charsets t ; just show all, emacs can deal with a lot now
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
84 vm-mime-default-face-charset-exceptions '() ; maybe add spam fonts?
eba0338 Eli Barzilay Initial import
authored
85 vm-mime-use-image-strips nil ; this can be very slow on big messages
86 ;; vm-mime-display-image-strips-incrementally t
87 ;; vm-imagemagick-convert-program "/usr/bin/convert"
88 ;; vm-imagemagick-identify-program "/usr/bin/identify"
89 vm-mime-delete-after-saving nil
90 vm-mime-confirm-delete t
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
91 vm-mime-savable-types '("application" "x-unknown" "application/x-gzip")
92 vm-mime-savable-type-exceptions '("text") ; maybe remove this?
93 vm-mime-deletable-types '("application" "x-unknown" "application/x-gzip")
94 vm-mime-deletable-type-exceptions '("text")
95 vm-mime-parts-display-separator "\n" ; maybe two newlines?
eba0338 Eli Barzilay Initial import
authored
96 ;; vm-mime-8bit-text-transfer-encoding 'quoted-printable
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
97 ;; needed?-- vm-mime-8bit-composition-charset "utf-8" ; avoid 2022-jp encoding
eba0338 Eli Barzilay Initial import
authored
98 vm-mime-composition-armor-from-lines t ; nice to not have `>From's
99 ;; vm-mime-encode-headers-type 'Q
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
100 vm-mime-max-message-size (* 19 1000 1000) ; split bigger messages
101 vm-mime-attachment-save-directory ; saved attachments to some temp
eba0338 Eli Barzilay Initial import
authored
102 (expand-file-name
103 (findif
104 'file-accessible-directory-p
105 (let ((tmps '("tmp/" "temp/" "Temp/" "TMP/")))
106 (append (mapcar (lambda (x) (concat "~/" x)) tmps)
107 (mapcar (lambda (x) (concat main-mail-directory x)) tmps)))
108 "~/"))
109 vm-mime-attachment-source-directory (expand-file-name "~/")
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
110 ;; ?? vm-mime-all-attachments-directory nil
111 vm-mime-yank-attachments t ; leave only buttons (it'd be nice to remove too)
eba0338 Eli Barzilay Initial import
authored
112 vm-infer-mime-types t
113 vm-mime-attachment-infer-type-for-text-attachments nil
114 vm-mime-avoid-folding-content-type t
115 vm-mime-base64-decoder-program "base64-decode"
116 vm-mime-base64-decoder-switches '()
117 vm-mime-base64-encoder-program "base64-encode"
118 vm-mime-base64-encoder-switches '()
119 vm-mime-qp-decoder-program "qp-decode"
120 vm-mime-qp-decoder-switches '()
121 vm-mime-qp-encoder-program "qp-encode"
122 vm-mime-qp-encoder-switches '()
123 vm-mime-uuencode-decoder-program "uudecode"
124 vm-mime-uuencode-decoder-switches '()
125 vm-auto-next-message t
126 vm-honor-page-delimiters nil
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
127 ;; vm-page-continuation-glyph "...press SPACE to see more..." ; prvws & pages
128 vm-expunge-before-quit nil
129 vm-expunge-before-save nil
eba0338 Eli Barzilay Initial import
authored
130 vm-confirm-quit 0
131 vm-confirm-new-folders t
132 vm-delete-empty-folders t
133 ;; ?? vm-folder-file-precious-flag t
134 ;; ?? vm-flush-interval 90
135 vm-visit-when-saving 0
136 vm-virtual-mirror t
137 vm-included-text-prefix mail-yank-prefix
138 vm-keep-sent-messages 1
139 vm-confirm-mail-send nil
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
140 vm-mail-mode-hidden-headers '("References" "In-Reply-To" "X-Mailer")
141 vm-mail-header-insert-date t
142 vm-mail-header-insert-message-id t
143 vm-do-fcc-before-mime-encode nil ; fcc with encoded (includes attachments)
eba0338 Eli Barzilay Initial import
authored
144 vm-reply-subject-prefix "Re: "
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
145 ;; vm-reply-include-presentation nil ; looks like it's not used in the code
d3f41ca Eli Barzilay Avoid bug in experimental feature (vm-include-text-from-presentation)
authored
146 ;; vm-include-text-from-presentation t ; experimental? (this is actually used)
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
147 ;; works, but looks like it will send an image, only it doesn't include it
d3f41ca Eli Barzilay Avoid bug in experimental feature (vm-include-text-from-presentation)
authored
148 ;; UPDATE: breaks replying to multiple emails
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
149 ;; ?? vm-in-reply-to-format "%i"
b43a4d4 Eli Barzilay Include only known types
authored
150 vm-included-mime-types-list
151 '("text/plain" "text/html" "text/enriched" "message/rfc822")
152 ;; could use nil for "all types that are known", but it tends to prefer html
153 ;; and for some html-formatted replies this loses the nested ">"s
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
154 ;; ?? vm-included-text-headers '()
155 ;; ?? vm-included-text-discard-header-regexp nil
eba0338 Eli Barzilay Initial import
authored
156 vm-forwarding-subject-format "[Forwarded from %F] %s"
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
157 ;; ?? vm-forwarded-headers '()
158 ;; ?? vm-unforwarded-header-regexp "none-to-be-dropped"
159 vm-forwarding-digest-type "mime" ; nil => textually include it
160 ;; ?? vm-mime-forward-local-external-bodies nil
161 ;; ?? vm-burst-digest-messages-inherit-labels t
162 vm-digest-preamble-format "%F: %s"
163 vm-digest-center-preamble nil
164 ;; ?? vm-digest-identifier-header-format "X-Digest: %s\n"
165 vm-digest-burst-type "guess"
166 vm-digest-send-type "mime"
167 vm-summary-format "%n%*%a%-12.12F %-3.3m %2d %4S %I%s\n" ; function-S below
168 vm-summary-attachment-indicator "$" ; used with %P - but doesn't work
169 ;; vm-summary-attachment-mime-types '()
170 ;; vm-summary-attachment-mime-type-exceptions '()
171 vm-summary-arrow "->" ; broken: "vm-summary.el" expects this arrow only
eba0338 Eli Barzilay Initial import
authored
172 vm-mouse-track-summary nil ; no annoying highlights
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
173 vm-summary-show-threads nil ; buffer-local anyway
174 vm-summary-thread-indentation-by-references t ; nil = parents in folder
eba0338 Eli Barzilay Initial import
authored
175 vm-summary-thread-indent-level 2
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
176 vm-summary-maximum-thread-indentation 20
eba0338 Eli Barzilay Initial import
authored
177 vm-thread-using-subject t
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
178 vm-sort-threads-by-youngest-date t
eba0338 Eli Barzilay Initial import
authored
179 vm-summary-uninteresting-senders-arrow "To: "
180 vm-auto-center-summary 0
181 vm-subject-ignored-prefix "^ *\\(re: *\\)+"
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
182 vm-subject-ignored-suffix "\\( +[[(]\\(?:fwd\\|forward\\)[])]\\| \\)+$"
eba0338 Eli Barzilay Initial import
authored
183 vm-subject-significant-chars nil
184 vm-folders-summary-database (concat main-mail-directory ".vm.folders.db")
185 vm-folders-summary-format " %12f %4t total, %n new, %u unread, %s spooled\n"
186 vm-folders-summary-directories (list main-mail-directory)
187 vm-mutable-windows t ; change windows, but
188 vm-mutable-frames nil ; no new frames
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
189 vm-raise-frame-at-startup nil ; and don't mess with my windows!
190 vm-frame-per-folder nil ; no frames, no no no.
eba0338 Eli Barzilay Initial import
authored
191 vm-frame-per-summary nil
192 vm-frame-per-folders-summary nil
193 vm-frame-per-composition nil
194 vm-frame-per-edit nil
195 vm-frame-per-help nil
196 vm-frame-per-completion nil
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
197 vm-search-other-frames nil ; not this too
198 ;; ?? vm-image-directory nil
eba0338 Eli Barzilay Initial import
authored
199 vm-popup-menu-on-mouse-3 t
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
200 ;; vm-url-retrieval-methods '(lynx wget fetch curl w3m) ; maybe disable with nil?
201 vm-url-browser 'browse-url ; 'vm-mouse-send-url-to-firefox
eba0338 Eli Barzilay Initial import
authored
202 vm-url-search-limit 24000
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
203 ;; vm-display-xfaces nil ; bleh
eba0338 Eli Barzilay Initial import
authored
204 vm-startup-with-summary t
205 vm-follow-summary-cursor t
206 vm-jump-to-new-messages nil
207 vm-jump-to-unread-messages nil
208 vm-skip-deleted-messages t
209 vm-skip-read-messages nil
210 vm-move-after-deleting 'x
211 vm-move-after-undeleting nil
212 vm-move-after-killing 'x
213 vm-delete-after-saving t
214 vm-delete-after-archiving nil
215 vm-delete-after-bursting t
216 vm-circular-folders nil
217 vm-search-using-regexps nil
218 vm-move-messages-physically nil
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
219 vm-edit-message-mode 'indented-text-mode
220 ;; vm-print-command "lpr"
221 ;; vm-print-command-switches '()
222 ;; ?? vm-strip-reply-headers nil
223 vm-mime-deleted-object-label "[Deleted %f (%d;%t)]\n"
224 vm-emit-messages-for-mime-decoding t ; shows only nontrivial decoding
eba0338 Eli Barzilay Initial import
authored
225 vm-default-folder-permission-bits #o600
226 vm-coding-system-priorities '(utf-8 iso-8859-1 iso-8859-15)
227 vm-mime-ucs-list '(utf-8 ctext escape-quoted)
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
228 ;; vm-drop-buffer-name-chars "[^ a-zA-Z0-9.,_\"'+-]"
229 vm-buffer-name-limit 50
230 vm-summary-enable-thread-folding t ; \
231 vm-summary-show-thread-count t ; > Experimental
232 vm-summary-thread-folding-on-motion t ; /
233 vm-enable-thread-operations t
234 ;; vm-vs-attachment-regexp "^Content-Disposition: attachment"
235 vm-spam-words-file (concat main-mail-directory ".spam-words")
236 vm-vs-spam-score-headers
237 '(("X-Spam-Score:" "[-+]?[0-9]*\\.?[0-9]+" string-to-number)
238 ("X-Spam-Status:" "[-+]?[0-9]*\\.?[0-9]+" string-to-number)
239 ("X-Spam-Level:" "\\*+" length))
240 vm-enable-addons '(check-recipients check-for-empty-subject encode-headers)
241 vm-summary-enable-faces nil ; doesn't seem to work anyway
242 vm-mime-thumbnail-max-geometry "80x80"
243 vm-delete-message-action "vm-next-message"
244 ;; --- IMAP (all experimental)
245 vm-load-headers-only t ; effective only for IMAP
246 vm-imap-max-message-size (* 4 1024 1024)
247 vm-imap-messages-per-session nil
248 vm-imap-bytes-per-session nil
249 ;; vm-imap-expunge-after-retrieving t <-- "when used as a spool file"??
250 ;; vm-imap-auto-expunge-alist '()
251 vm-imap-folder-cache-directory
252 (findif 'file-accessible-directory-p
253 (list (concat main-mail-directory "imap/")))
254 vm-imap-save-to-server t
255 vm-imap-ensure-active-sessions t
256 vm-imap-sync-on-get t ; maybe set this to nil?
257 ;; >> vm/vm-faces
eba0338 Eli Barzilay Initial import
authored
258 vm-highlighted-header-face (simple-make-face '*/h004-bold-underline)
259 vm-mime-button-face (simple-make-face 'cyan1/brown4-bold)
260 vm-summary-highlight-face (simple-make-face 'yellow/purple4-bold)
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
261 vm-highlight-url-face (simple-make-face 'bold-underline)
262 ;; >> vm/vm-summary-faces
263 ;; not working anyway
264 ;; vm-summary-faces-alist
265 ;; '(((or (header "Priority: urgent")
266 ;; (header "Importance: high")
267 ;; (header "X-Priority: 1")
268 ;; (label "!")
269 ;; (label "\\flagged")
270 ;; (header "X-VM-postponed-data:"))
271 ;; vm-summary-high-priority)
272 ;; ((deleted) vm-summary-deleted)
273 ;; ((new) vm-summary-new)
274 ;; ((unread) vm-summary-unread)
275 ;; ((marked) vm-summary-marked)
276 ;; ((replied) vm-summary-replied)
277 ;; ((or (filed) (written)) vm-summary-saved)
278 ;; ((or (forwarded) (redistributed)) vm-summary-forwarded)
279 ;; ((edited) vm-summary-edited)
280 ;; ((outgoing) vm-summary-outgoing)
281 ;; ((any) vm-summary-default))
282 ;; vm/vm-rfaddons
283 vm-fill-long-lines-in-reply-column nil
284 ;; vm-spamassassin-strip-report "spamassassin -d"
285 ;; ?? vm-mail-subject-prefix-replacements
286 ;; ?? '(("\\(\\(re\\|aw\\|antw\\)\\(\\[[0-9]+\\]\\)?:[ \t]*\\)+" . "Re: ")
287 ;; ?? ("\\(\\(fo\\|wg\\)\\(\\[[0-9]+\\]\\)?:[ \t]*\\)+" . "Fo: "))
288 ;; works only with (add-hook 'vm-mail-mode-hook 'vm-mail-subject-cleanup):
289 ;; vm-mail-subject-number-reply nil
290 ;; doesn't look useful:
291 ;; vm-handle-return-receipt-mode 'edit
292 ;; vm-handle-return-receipt-peek 500
293 ;; vm-mime-attach-files-in-directory-default-type nil
294 ;; vm-mime-attach-files-in-directory-default-charset 'guess
295 ;; vm-mime-auto-save-all-attachments-subdir nil
296 vm-mail-prompt-if-subject-empty t ; maybe do a hook that adds "(no subject)"?
297 vm-assimilate-html-command "striptags" ; is it needed with the include thing?
298 vm-assimilate-html-mixed t
299 ;; used only in `vm-mail-mode-citation-clean-up':
300 ;; vm-mail-mode-citation-kill-regexp-alist
301 ;; '(("^\\( > [|{}>:;][^\n]*\n\\)+" . "[...]\n")
302 ;; ("^\\([^|{}>:;]+.*\\)\n > [|{}>:;]*$" . "\\1")
303 ;; ("^ > [|{}>:;]*\n\\([^|{}>:;]\\)" . "\\1")
304 ;; ("^ > [|{}>:;]*\\s-*\n\\( > [|{}>:;]*\\s-*\n\\)+" . " > \n")
305 ;; ("\n\n\n+" . "\n\n")
306 ;; ("^ > --[^\n]*\n\\( > [^\n]*\n\\)+" . "\n")
307 ;; ("^ > ________[^\n]*\n\\( > [^\n]*\n\\)+" . "\n"))
308 vm-summary-attachment-label "$" ; does this have any effect?
309 vm-mail-mode-open-line-regexp "[ \t]*>"
310 ;; used only in `vm-mail-mode-elide-reply-region':
311 ;; vm-mail-mode-elide-reply-region "[...]\n"
312 ;; ??vm-mime-display-internal-multipart/mixed-separater
313 ;; "\n-----------------------------------------------------------------\n"
314 ;; ?? vm-mail-mode-fake-date-p t
eba0338 Eli Barzilay Initial import
authored
315 )
316
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
317 ;; For times in quote attributions
318 (defun eli-reply-time-ago (msg msg-time real-msg-date)
319 (let* ((now-time (current-time))
320 (secs (round (- (time-to-seconds now-time)
321 (time-to-seconds msg-time))))
322 (mins (round secs 60))
323 (hrs (round secs (* 60 60)))
324 ;; days goes by the actual day (my timezone)
325 (days (- (time-to-days now-time) (time-to-days msg-time)))
326 (weeks (round days 7))
327 (msg-date (decode-time msg-time))
328 (dow (nth (nth 6 msg-date) '("Sunday" "Monday" "Tuesday" "Wednesday"
329 "Thursday" "Friday" "Saturday")))
330 (2str (lambda (n)
331 (case n ((1) "One") ((2) "Two") ((3) "Three") ((4) "Four")
332 (t (number-to-string n))))))
333 (cond
a9740b7 Eli Barzilay Improve #; highlighting, make the time estimate for email replies more c...
authored
334 ;; ;; includes negatives -- assume that it's always very recent
335 ;; ((<= secs 45) "A few seconds ago")
336 ;; ;; being precise isn't important
337 ;; ((<= secs 90) "About a minute ago")
338 ((<= mins 2) "Just now")
339 ;; ((<= mins 10) (format "%s minutes ago" (funcall 2str mins)))
340 ((<= mins 8) "A few minutes ago")
341 ;; ((<= mins 30) (format "%s minutes ago"
342 ;; (funcall 2str (* 5 (round mins 5)))))
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
343 ((<= mins 54) (format "%s minutes ago"
344 (funcall 2str (* 10 (round mins 10)))))
345 ((<= mins 75) "An hour ago")
346 ;; can't really say that it's 1 or 2 hours
347 ((<= mins 105) "An hour and a half ago")
348 ((<= hrs 12) (format "%s hours ago" (funcall 2str hrs)))
349 ;; more than this, and we switch to days (based on my timezone)
350 ((<= days 0) "Earlier today")
351 ((<= days 1) "Yesterday")
352 ;; this would be "shilshom"
353 ((<= days 2) (format "%s days ago" (funcall 2str days)))
354 ;; switch to the day's name
355 ((<= days 6) (format "On %s" dow))
356 ;; and now to a count of weeks
357 ((<= days 7) "A week ago")
358 ;; can't really say that it's a week
359 ((<= weeks 1) "More than a week ago")
360 ;; weeks are longer, so say "about"
361 ((<= weeks 3) (format "About %s weeks ago"
362 (downcase (funcall 2str weeks))))
363 ;; note that this counts by days
364 ((<= days 40) "About a month ago")
365 ;; finally switch to the date, same year => drop it
366 ;; (use the time from the message, might be different than in my zone)
367 (t (let ((D (nth 3 real-msg-date))
368 (M (nth 4 real-msg-date))
369 (Y (nth 5 real-msg-date)))
370 (concat
371 "On "
372 (nth (1- M) '("January" "February" "March" "April" "May" "June"
373 "July" "August" "September" "October" "November"
374 "December"))
375 " " (number-to-string D)
376 (if (= 1 (/ D 10)) "th"
377 (case (% D 10) ((1) "st") ((2) "nd") ((3) "rd") (t "th")))
378 (if (= (nth 5 (decode-time)) Y)
379 "" (concat " " (number-to-string Y)))))))))
380 (defun vm-summary-function-R (msg)
381 (let* ((author (vm-full-name-of msg))
382 (msg-time (vm-summary-sprintf "%y-%02M-%02d %h %z" msg))
383 (msg-time* (parse-time-string msg-time))
384 (msg-time (apply 'encode-time msg-time*)))
385 (format "%s, %s wrote:\n"
386 (eli-reply-time-ago msg msg-time msg-time*)
387 author)))
388 (setq vm-included-text-attribution-format "%UR")
389
eba0338 Eli Barzilay Initial import
authored
390 (setq
391 vm-mode-line-format
392 '("" "%&%& "
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
393 (;; "VM " vm-version ": "
394 "VM: "
395 ;; (vm-folder-read-only "read-only ")
eba0338 Eli Barzilay Initial import
authored
396 (vm-folder-read-only "READ-ONLY ")
397 (vm-virtual-folder-definition (vm-virtual-mirror "mirrored "))
398 "%b"
399 (vm-mail-buffer (vm-ml-sort-keys ("" " by " vm-ml-sort-keys)))
400 (vm-message-list
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
401 ;; (" " vm-ml-message-number " (of " vm-ml-highest-message-number ")")
eba0338 Eli Barzilay Initial import
authored
402 (" " vm-ml-message-number "/" vm-ml-highest-message-number)
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
403 ;; (vm-folder-type " (unrecognized folder type)" " (no messages)")
404 (vm-folder-type " (UNRECOGNIZED FOLDER TYPE)" " (no messages)")))
eba0338 Eli Barzilay Initial import
authored
405 (vm-spooled-mail-waiting " Mail")
406 (vm-message-list
407 (" %[ " vm-ml-message-attributes-alist
408 (vm-ml-labels ("; " vm-ml-labels)) " %] ")
409 (" %[%] "))
410 "%p" " " global-mode-string))
411
412 ;; Hack ignored from field using user-mail-address with and without local
413 ;; machine name. This must be done after loading Emacs, since it is only set
414 ;; then.
415 (let ((add (downcase
416 (if (string-match "^\\([^@]*\\)@[^.]*[.]\\(.*\\..*\\)$"
417 user-mail-address)
418 (concat (regexp-quote (match-string 1 user-mail-address))
419 "@\\([a-z]*\\.\\)?"
420 (regexp-quote (match-string 2 user-mail-address)))
421 (regexp-quote user-mail-address)))))
422 (setq vm-summary-uninteresting-senders
423 (if vm-summary-uninteresting-senders
424 (concat "\\(" add "\\|" vm-summary-uninteresting-senders "\\)")
425 add))
426 (add-to-list 'vm-reply-ignored-addresses add))
427
428 ;;; This detects standard signatures and selects them so it is easy to delete
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
429 ;;; them when replying, especially with delsel on. For now, just go there.
430 (defun citation-yank-goto-sig ()
431 "Goto the sig of a cited mail"
eba0338 Eli Barzilay Initial import
authored
432 (interactive)
433 (let ((qprefix (regexp-quote vm-included-text-prefix)) end sig start)
434 (save-excursion
7ec2e6c Eli Barzilay A smart DWIM return binding for mime objects.
authored
435 (goto-char (point-max))
eba0338 Eli Barzilay Initial import
authored
436 (setq end (search-backward-regexp
437 "-- " (and (> (point) 400) (- (point) 400)) t))
438 (setq sig (and end (search-backward-regexp
439 (concat "^" qprefix "\\(-?-?[A-Za-z]+\\.?\\|-- *\\)$")
440 nil t)))
441 (when (and sig (> (count-lines sig end) 5))
442 (goto-char sig)
443 (setq sig nil))
444 (forward-line -1)
445 (while (looking-at "^[>|: \t]*$") (forward-line -1))
446 (forward-line 1)
447 (setq start (point)))
448 (when (and end start (> (1- end) start))
449 ;; (ensure-nomark)
450 (goto-char (1- end))
451 ;; (ensure-mark)
452 (goto-char start))))
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
453 (add-hook 'vm-reply-hook 'citation-yank-goto-sig)
eba0338 Eli Barzilay Initial import
authored
454
455 ;; Keep the mail indication more useful when we're doing stuff
456 (add-hook 'vm-arrived-messages-hook 'display-time-update)
457 (add-hook 'vm-quit-hook 'display-time-update)
458
7ec2e6c Eli Barzilay A smart DWIM return binding for mime objects.
authored
459 ;; A smart DWIM thing for mime objects
460 (defvar eli-vm-textual-block-delimiter-face
461 (simple-make-face 'yellow/h600-bold-underline))
462 (defun eli-vm-mime-operation ()
463 "Ask what to do with the current mime object."
464 (interactive)
465 (let* ((button (vm-mime-run-display-function-at-point 'identity))
466 (layout (vm-extent-property button 'vm-mime-layout))
467 (type (car (vm-mm-layout-type layout)))
468 (isimage (save-match-data (string-match "^image/" type)))
469 (external (let ((vm-mime-external-content-type-exceptions nil))
470 (vm-mime-find-external-viewer type)))
471 (internal (vm-mime-should-display-internal layout))
472 (ch (progn
473 (goto-char (vm-extent-start-position button))
474 (message
475 (concat "[s]ave, [d]elete, view as [i]nline "
476 (if isimage "image" "text")
477 " or"
478 " [e]xternally (with "
479 (prin1-to-string (if external (car external) "cat"))
480 ")"))
481 (downcase (read-char)))))
482 (case ch
483 ((?s)
484 (message "Saving...")
485 (call-interactively 'vm-mime-reader-map-save-message))
486 ((?d)
487 (message "Deleting...")
488 (call-interactively 'vm-delete-mime-object))
489 ((?i)
490 (message "Viewing as inline %s..." (if isimage "image" "text"))
491 (save-excursion
492 (let ((buffer-read-only nil) p)
493 (unless (bolp) (insert "\n"))
494 (setq p (point))
495 (insert "{{{----------")
496 (insert (format "%s" (vm-mm-layout-type layout)))
497 (insert "----------{{{\n")
498 (set-region-face p (point) eli-vm-textual-block-delimiter-face))
499 (if isimage
500 (let ((buffer-read-only nil))
501 (delete-region (vm-extent-start-position button)
502 (vm-extent-end-position button))
503 ;; don't insert the image here ...
504 (insert "\n"))
505 (vm-mime-display-body-as-text button))
506 (let ((buffer-read-only nil))
507 (unless (bolp) (insert "\n"))
508 (setq p (point))
509 (insert "}}}------------------------------}}}\n")
510 (set-region-face p (1- (point))
511 eli-vm-textual-block-delimiter-face)
512 (when isimage
513 ;; ... do it here so it appears between the markers
514 ;; (but don't do it for texts, since we won't know if a
515 ;; newline is needed until the text is there)
516 (goto-char (1- p))
517 (vm-mime-display-generic layout)))))
518 ((?e)
519 (message "Viewing with %s..." (if external (car external) "cat"))
520 (if external
521 (vm-mime-display-external-generic layout)
522 (let (;; HACK1: force it to hop into the window
523 (vm-mutable-windows nil)
524 (prev-win-conf (current-window-configuration)))
525 (vm-mime-pipe-body-to-command "cat" layout)
526 ;; HACK2: restore sanity, instead of an editable buffer
527 (run-with-idle-timer 0.01 nil
528 `(lambda ()
529 (goto-char (point-min))
530 ;; HACK3: exit back to prev conf (and cheat dynamic scope)
531 (view-mode-enter nil
532 (lambda (b)
533 (bury-buffer b)
534 (set-window-configuration ,prev-win-conf))))))))
535 ((?1) (vm-mime-display-internal-application/octet-stream layout))
536 ((?2) (vm-mime-display-generic layout))
537 (t (error "Huh?")))))
538
eba0338 Eli Barzilay Initial import
authored
539 (defun vm-expunge-and-quit ()
540 (interactive)
541 (vm-expunge-folder)
542 (vm-quit))
543
7ec2e6c Eli Barzilay A smart DWIM return binding for mime objects.
authored
544 (define-keys
545 vm-mode-map
eba0338 Eli Barzilay Initial import
authored
546 '("#" vm-expunge-folder)
547 '("Q" vm-expunge-and-quit)
548 '("X" vm-quit-no-change)
549 '("x" vm-expunge-folder)
550 '("\t" vm-move-to-next-button)
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
551 '([(? )] vm-scroll-forward)
552 '([(shift ? )] vm-scroll-backward)
553 '([(control ?j)] vm-scroll-forward-one-line)
554 '([(control ?m)] vm-scroll-forward-one-line)
555 '([(return)] vm-scroll-forward-one-line)
556 '([(control shift ?j)] vm-scroll-backward-one-line)
557 '([(control shift ?m)] vm-scroll-backward-one-line)
558 '([(shift return)] vm-scroll-backward-one-line)
559 '("\\" vm-toggle-thread)
560 '("/" vm-toggle-thread)
7ec2e6c Eli Barzilay A smart DWIM return binding for mime objects.
authored
561 '(save-buffer vm-save-folder)
562 ;;
563 vm-mime-reader-map
564 '([(return)] eli-vm-mime-operation))
7033f1f Eli Barzilay Upgrade vm to 8.1.93a
authored
565
566 (add-hook 'vm-summary-mode-hook
567 ;; HACK: cua-set-rectable-mark cannot be overridden in a normal keymap, so
568 ;; instead the S-return key is bound to `eli-override-cua-set-rectangle-mark'
569 ;; which can be overridden via this buffer local variable
570 (lambda ()
571 (setq eli-override-cua-set-rectangle-mark 'vm-scroll-backward-one-line)))
475fa20 Eli Barzilay Use native emacs word wrapping
authored
572
573 ;; Use word-wrapping
574 (add-hook 'vm-presentation-mode-hook
575 (lambda ()
576 (visual-line-mode 1)
577 (setq truncate-lines nil)
578 (setq word-wrap t)
579 (setq line-move-visual t)))
Something went wrong with that request. Please try again.