Debian Codegraph @

mew-vars2.el

raw ◀ ▶
1 Debian patch touch this file
1 ;;; mew-vars2.el
2
3 ;; Author: Kazu Yamamoto <[email protected]>
4 ;; Created: Feb 1, 1999
5
6 ;;; Code:
7
8 (require 'mew-vars)
9
10 ;;; (1) Variables closer to constant.
11 ;;; (2) Variables for soft-coding.
12 ;;; (3) Difficult options with some macros.
13 ;;; Use mew-add-first, mew-insert-after, mew-replace-with,
14 ;;; and mew-remove-entry to modify the variables.
15
16 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 ;;;
18 ;;; Marks
19 ;;;
20
21 (defvar mew-mark-review ?*)
22 (defvar mew-mark-escape ?$)
23 (defvar mew-mark-delete ?D)
24 (defvar mew-mark-unlink ?X)
25 (defvar mew-mark-refile ?o)
26 (defvar mew-mark-read mew-sp)
27 (defvar mew-mark-unread ?U)
28 (defvar mew-mark-tmp ?\0) ;; temporary use only.
29 (defvar mew-mark-default-walk mew-mark-review)
30 (defvar mew-mark-walk mew-mark-default-walk)
31 (defvar mew-mark-duplicated mew-mark-delete)
32 (defvar mew-mark-show-list (list mew-mark-read mew-mark-unread mew-mark-review))
33 (defvar mew-mark-show-list2 (list mew-mark-unread mew-mark-review))
34
35 (defvar mew-summary-mark-undo-marks
36 `(,mew-mark-delete ,mew-mark-unlink ,mew-mark-refile ,mew-mark-read)
37 "*A list of marks to be canceled by '\\<mew-summary-mode-map>\\[mew-summary-mark-undo-all]'.")
38
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 ;;;
41 ;;; Field Magic
42 ;;;
43
44 (defvar mew-reply-string "Re: ")
45 (defvar mew-reply-regex
46 "Re\\(\\|[*^]?[0-9]+\\|\\[[0-9]+\\]\\|([0-9]+)\\)[:>] *"
47 "Regexp of various Re: expression in Subject:")
48 (defvar mew-forward-string "Fw: ")
49 (defvar mew-forward-regex "\\(Fw\\|Fwd\\|Forward\\): *"
50 "Regexp of various Fw: expression in Subject:")
51 (defvar mew-was-regex " *[[(] *\\(was[^a-z]\\|Re:\\).*[])] *$"
52 "Regexp of various (was ...) expression in Subject:")
53
54 (defvar mew-subject-simplify-replace-alist
55 `(;; (REGEXP . NEW) --- NEW may be nil for deletion (same to "")
56 ;; replace multiple Re: and Fw: into single Re:
57 (,(concat "^" ;; regexp
58 mew-reply-regex
59 "\\("
60 mew-reply-regex
61 "\\|"
62 mew-forward-regex
63 "\\)*")
64 mew-reply-string) ;; new text
65 ;; replace multiple Fw: and Re: into single Fw:
66 (,(concat "^" ;; regexp
67 mew-forward-regex
68 "\\("
69 mew-reply-regex
70 "\\|"
71 mew-forward-regex
72 "\\)*")
73 mew-forward-string) ;; new text
74 ;; delete extra string (no new text means delete)
75 (,mew-was-regex nil)) ;; regexp
76 "*Replacement alist to simplify Subject: field body
77 Each element is cons cell whose car is REGEXP to replace,
78 cdr is new text.")
79
80 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
81 ;;;
82 ;;; Error
83 ;;;
84
85 (defvar mew-error-unknown-charset "**UNKNOWN CHARSET**")
86 (defvar mew-error-broken-string "**BROKEN STRING**")
87 (defvar mew-error-invalid-b-encoding " **B ENCODING ERROR** ")
88 (defvar mew-error-invalid-q-encoding " **Q ENCODING ERROR** ")
89 (defvar mew-error-no-subject "** no subject **")
90 (defvar mew-error-broken-address "**BROKEN ADDRESS**")
91
92 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
93 ;;;
94 ;;; Files
95 ;;;
96
97 ;; In each folder
98
99 (defvar mew-summary-cache-file ".mew-summary"
100 "Cache file for Summary mode contents.")
101
102 (defvar mew-summary-touch-file ".mew-mtime"
103 "Time-stamp file for message folders.")
104
105 ;; Under mew-conf-path
106
107 (defcustom mew-addrbook-file "Addrbook"
108 "*A file which contains AddrBook information."
109 :group 'mew-addrbook
110 :type 'string)
111
112 (defvar mew-alias-auto-file ".mew-alias")
113
114 (defvar mew-refile-msgid-file ".mew-refile-msgid-alist")
115
116 (defvar mew-refile-from-file ".mew-refile-from-alist")
117
118 (defvar mew-smtp-log-file "Smtplog")
119 (defvar mew-nntp-log-file "Nntplog")
120 (defvar mew-refile-log-file "Refilelog")
121
122 ;; xxx Home
123
124 (defvar mew-fib-item-file "~/.mew-fib")
125
126 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
127 ;;;
128 ;;; Modes
129 ;;;
130
131 (defvar mew-folder-mode 448 ;; decimal for octal 0700
132 "Secure file mode for folders. 448(0700 in octal) is STRONGLY
133 recommended for privacy reasons.")
134
135 (defvar mew-file-mode-mask 432 ;; decimal for octal 0660
136 "Secure file mode mask. 432(0660 in octal) is STRONGLY recommended
137 for privacy reasons.")
138
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
140 ;;;
141 ;;; Separators
142 ;;;
143
144 (defvar mew-path-separator "/")
145 (defvar mew-regex-drive-letter (file-name-as-directory "^[a-zA-Z]:"))
146 (defvar mew-regex-file-absolute (format "^[~%s]" mew-path-separator))
147 (defvar mew-header-separator "----")
148 (defvar mew-eoh nil) ;; set by mew-regex-setup
149 (defvar mew-lwsp "^[ \t]")
150 (defvar mew-lwsp+ "^[ \t]+")
151 (defvar mew-address-separator ":, \t\n")
152 (defvar mew-page-delimiter "^\^L")
153 (defvar mew-keyval "^\\([^ \t:]+:?\\)[ \t]*")
154 ;; "^\\([^ \t:]+:?\\)[ \t]*\\(.*\\)$" faces a stupid error.
155 ;; "$" does not mean end-of-line if the second match is empty, sigh.
156
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
158 ;;;
159 ;;; Explanation string in messages
160 ;;;
161
162 (defvar mew-bcc-subject "A blind carbon copy")
163 (defvar mew-bcc-body "This is a blind carbon copy.\n")
164
165 (defvar mew-field-comment "(modified by Mew)")
166
167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
168 ;;;
169 ;;; Addrbook
170 ;;;
171
172 (defvar mew-addrbook-switch
173 '((shortname mew-addrbook-shortname-get)
174 (address identity)
175 (username mew-addrstr-extract-user)
176 (nickname mew-addrbook-nickname-get)
177 (name mew-addrbook-name-get))
178 "Function database to get each field of Addrbook.
179 'shortname, 'address, 'username, 'nickname, and 'name is defined.")
180
181 (defun mew-addrbook-func (key)
182 (mew-alist-get-value (assq key mew-addrbook-switch)))
183
184 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
185 ;;;
186 ;;; MIME types
187 ;;;
188
189 (defun mew-ct-textp (ct)
190 (string-match "^Text" (capitalize ct)))
191
192 (defun mew-ct-imagep (ct)
193 (string-match "^Image" (capitalize ct)))
194
195 (defun mew-ct-modelp (ct)
196 (string-match "^Model" (capitalize ct)))
197
198 (defun mew-ct-multipartp (ct)
199 (string-match "^Multipart" (capitalize ct)))
200
201 (defun mew-ct-alternativep (ct)
202 (string-match "^Multipart/Alternative" (capitalize ct)))
203
204 (defun mew-ct-partialp (ct)
205 (string-match "^Message/Partial" (capitalize ct)))
206
207 (defun mew-ct-messagep (ct)
208 (string-match "^Message" (capitalize ct)))
209
210 (defun mew-ct-linebasep (ct)
211 (or (mew-ct-textp ct)
212 (mew-case-equal ct mew-ct-aps)
213 (mew-case-equal ct mew-ct-msg))) ;; xxx mew-ct-messagep?
214
215 (defvar mew-mime-content-type-multipart-list
216 `(,mew-ct-mlm ,mew-ct-mla)
217 "Candidate of 'Content-Type: Multipart/' when CT: is changed
218 in draft buffer.")
219
220 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
221 ;;;
222 ;;; Completion
223 ;;;
224
225 (defconst mew-custom-type-of-field-completion
226 '(list (list string function)))
227
228 (defcustom mew-field-completion-switch
229 '(("To:" mew-complete-address)
230 ("Cc:" mew-complete-address)
231 ("Dcc:" mew-complete-address)
232 ("Bcc:" mew-complete-address)
233 ("Reply-To:" mew-complete-address)
234 ("Fcc:" mew-complete-fcc-folder)
235 ("Resent-To:" mew-complete-address)
236 ("Resent-Cc:" mew-complete-address)
237 ("Resent-Dcc:" mew-complete-address)
238 ("Resent-Bcc:" mew-complete-address)
239 ("Resent-Fcc:" mew-complete-fcc-folder)
240 ("Newsgroups:" mew-complete-newsgroups)
241 ("Followup-To:" mew-complete-newsgroups))
242 "*Completion function alist concerned with the key."
243 :group 'mew-complete
244 :type mew-custom-type-of-field-completion)
245
246 (defcustom mew-field-circular-completion-switch
247 '(("To:" mew-circular-complete-domain)
248 ("Cc:" mew-circular-complete-domain)
249 ("Dcc:" mew-circular-complete-domain)
250 ("Bcc:" mew-circular-complete-domain)
251 ("Reply-To:" mew-circular-complete-domain)
252 ("Resent-To:" mew-circular-complete-domain)
253 ("Resent-Cc:" mew-circular-complete-domain)
254 ("Resent-Dcc:" mew-circular-complete-domain)
255 ("Resent-Bcc:" mew-circular-complete-domain)
256 ("From:" mew-circular-complete-from)
257 ("Resent-From:" mew-circular-complete-from))
258 "*Circular completion function alist concerned with the key."
259 :group 'mew-complete
260 :type mew-custom-type-of-field-completion)
261
262 (defcustom mew-field-expansion-switch
263 '(("To:" mew-expand-address)
264 ("Cc:" mew-expand-address)
265 ("Dcc:" mew-expand-address)
266 ("Bcc:" mew-expand-address)
267 ("Reply-To:" mew-expand-address)
268 ("Resent-To:" mew-expand-address)
269 ("Resent-Cc:" mew-expand-address)
270 ("Resent-Dcc:" mew-expand-address)
271 ("Resent-Bcc:" mew-expand-address))
272 "*Expansion function alist concerned with the key."
273 :group 'mew-complete
274 :type mew-custom-type-of-field-completion)
275
276 (defun mew-field-get-func (key switch)
277 (mew-alist-get-value (mew-assoc-match key switch 0)))
278
279 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
280 ;;;
281 ;;; MIME control
282 ;;;
283
284 (defvar mew-content-type mew-ct-txt
285 "*The default Content-Type: for a file whose suffix is unknown.")
286
287 (defvar mew-mime-content-type nil
288 "\\<mew-summary-mode-map>Database for MIME content type.
289 This is a list of entries which consist of <content-type>,
290 <regular expression of file suffix>, <content-transfer-encoding>,
291 <symbol for visualizer>, <symbol for icon>, <auxiliary data>.
292
293 Here is an example:
294
295 (\"image/png\" \"\\\\.png$\" mew-b64 mew-prog-image mew-icon-image png)
296
297 This database is used both when visualizing and composing. For
298 example, when visualizing, a visualizer is chosen according to
299 its <content-type>. When composing, content-type is selected
300 according to the suffix of the file to be attached with <regular
301 expression of file suffix>.
302
303 For <content-transfer-encoding>, 'nil', 'mew-b64', or 'mew-qp'
304 should be specified. 'mew-b64' and 'mew-qp' means Base64 and
305 Quoted-Printable, respectively. This is used as an appropriate
306 content-transfer-encoding when composing.
307
308 Each symbol specified at <symbol for visualizer> should have a value
309 whose format is one of followings:
310
311 - \"prog\"
312 \"prog\" is an external program.
313 (1) The program name is displayed.
314 (2) \"prog\" is executed asynchronously.
315 - func
316 <func> is a function.
317 (1) <func> is called.
318 (2) <func> is called.
319 - (\"prog\" args async)
320 \"prog\" is an external program.
321 <args> is a list of arguments for the external program.
322 <async>
323 If nil, the external program is called synchronously.
324 If t, the external program is called asynchronously.
325 (1) The program name is displayed.
326 (2) \"prog\" is executed asynchronously with <args>.
327 - (nil \"prog\")
328 Equivalent to \"prog\".
329 - (nil (\"prog\" args async))
330 Equivalent to (\"prog\" args async).
331 - (nil func2)
332 (1) Displayed 'type \\[mew-summary-execute-external]'.
333 (2) <func2> is called.
334 - (func1 func2)
335 (1) <func1> is called.
336 (2) <func2> is called.
337 If the original content-type is Application/Octet-Stream,
338 you are asked to choose <func1> or <func2>.
339 - (func1 \"prog\")
340 (1) <func1> is called.
341 (2) \"prog\" is executed asynchronously.
342 If the original content-type is Application/Octet-Stream,
343 you are asked to choose <func1> or \"prog\".
344 - (func1 (\"prog\" args async))
345 (1) <func1> is called.
346 (2) \"prog\" is executed asynchronously with <args>.
347 If the original content-type is Application/Octet-Stream,
348 you are asked to choose <func1> or \"prog\".
349
350 Note that (1) indicates the action for '\\[mew-summary-display]' and
351 \(2) indicates the action for '\\[mew-summary-execute-external]'.
352
353 If you want to add an entry for new content-type, please let the author
354 know. Such an entry should be shared by all users and be included in
355 the next version of Mew.")
356
357 (defun mew-ctdb-by-ct (ct)
358 (mew-assoc-match2 ct mew-mime-content-type 0))
359
360 (defun mew-ctdb-by-file (file)
361 (mew-assoc-match2 file mew-mime-content-type 1))
362
363 (defun mew-ctdb-ct (attr)
364 (and (nth 0 attr) (mew-capitalize (nth 0 attr))))
365
366 (defun mew-ctdb-regex (attr)
367 (nth 1 attr))
368
369 (defun mew-ctdb-cte (attr)
370 (symbol-value (nth 2 attr)))
371
372 (defun mew-ctdb-prog (attr)
373 (let ((val (symbol-value (nth 3 attr))))
374 (if (and (listp val) (eq 'if (car val)))
375 (eval val)
376 val)))
377
378 (defun mew-ctdb-icon (attr)
379 (symbol-value (nth 4 attr)))
380
381 (defun mew-mime-image-format-name (ct)
382 (nth 5 (mew-ctdb-by-ct ct)))
383
384 (defvar mew-mime-content-type-for-ooffice nil
385 "A list of (content-type suffix) for OpenOffice.org to be prepended
386 'mew-mime-content-type'")
387
388 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
389 ;;;
390 ;;; MIME Content-Disposition:
391 ;;;
392
393 (defvar mew-mime-content-disposition
394 '(("text" "inline" t)
395 ("image" "inline" t)
396 ("message" "inline" nil)
397 ("multipart" nil nil)
398 (t "attachment" t))
399 "(content-type inline/attachment filename)")
400
401 (defun mew-cdpdb-by-ct (ct)
402 (mew-assoc-match2 ct mew-mime-content-disposition 0))
403
404 (defun mew-cdpdb-val (attr)
405 (nth 1 attr))
406
407 (defun mew-cdpdb-file (attr)
408 (nth 2 attr))
409
410 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
411 ;;;
412 ;;; Privacy
413 ;;;
414
415 (defcustom mew-privacy-database
416 `((pgp-signature ((,mew-ct-mls ,mew-ct-pgs)) "PS")
417 (pgp-encryption ((,mew-ct-mle ,mew-ct-pge)) "PE")
418 (pgp-signature-encryption
419 ((,mew-ct-mls ,mew-ct-pgs) (,mew-ct-mle ,mew-ct-pge)) "PSPE")
420 (pgp-encryption-signature
421 ((,mew-ct-mle ,mew-ct-pge) (,mew-ct-mls ,mew-ct-pgs)) "PEPS")
422 (smime-signature ((,mew-ct-smm ,mew-ct-smm-sig)) "SS")
423 (smime-encryption ((,mew-ct-smm ,mew-ct-smm-enc)) "SE")
424 (smime-signature-encryption
425 ((,mew-ct-smm ,mew-ct-smm-sig) (,mew-ct-smm ,mew-ct-smm-enc)) "SSSE")
426 (smime-encryption-signature
427 ((,mew-ct-smm ,mew-ct-smm-enc) (,mew-ct-smm ,mew-ct-smm-sig)) "SESS"))
428 "*Alist of key, a list of privacy Content-Type, and its mark."
429 :group 'mew-privacy
430 :type 'sexp)
431
432 (defun mew-pcdb-services ()
433 (mapcar 'car mew-privacy-database))
434
435 (defun mew-pcdb-by-service (service)
436 (assq service mew-privacy-database))
437
438 (defun mew-pcdb-ct (pcdb)
439 (nth 1 pcdb))
440
441 (defun mew-pcdb-mark (pcdb)
442 (nth 2 pcdb))
443
444 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
445 ;;;
446 ;;; Multipart/Alternative
447 ;;;
448
449 (defvar mew-mime-multipart-alternative-list
450 `(,mew-ct-txt ".*"))
451
452 (defun mew-multipart-alternative-preference (part)
453 (let ((ct (mew-syntax-get-value (mew-syntax-get-ct part) 'cap)))
454 (mew-member-match ct mew-mime-multipart-alternative-list)))
455
456 (defvar mew-mime-external-body-list
457 '("anon-ftp" "url" "mail-server"))
458
459 (defun mew-mime-external-body-preference (part)
460 (let* ((ctl (mew-syntax-get-ct part))
461 (ct (mew-syntax-get-value ctl 'cap))
462 (access-type (mew-syntax-get-param ctl "access-type")))
463 (if (and (string= ct mew-ct-ext) (stringp access-type))
464 (mew-member-match access-type mew-mime-external-body-list))))
465
466 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
467 ;;;
468 ;;; Field database
469 ;;;
470
471 ;; strictly, content-* are necessary but they are not practical.
472 (defvar mew-field-database
473 `((,mew-to: mailbox struct)
474 (,mew-cc: mailbox struct)
475 (,mew-from: mailbox struct)
476 (,mew-apparently-to: mailbox struct)
477 (,mew-bcc: mailbox struct)
478 (,mew-dcc: mailbox struct)
479 (,mew-reply-to: mailbox struct)
480 (,mew-resent-to: mailbox struct)
481 (,mew-resent-cc: mailbox struct)
482 (,mew-resent-from: mailbox struct)
483 (,mew-mv: mime struct)
484 (,mew-subj: text text)
485 (,mew-keywords: comma-text text)
486 (,mew-received: unstruct unstruct)
487 (,mew-message-id: unstruct unstruct)
488 (,mew-references: unstruct unstruct)
489 (,mew-in-reply-to: unstruct unstruct)
490 (,mew-x-face: unstruct unstruct)
491 (,mew-face: unstruct unstruct)
492 ("Authentication-Results:" unstruct struct2) ;; capitalized
493 ("Domainkey-Signature:" unstruct unstruct) ;; capitalized
494 ("Dkim-Signature:" unstruct unstruct)) ;; capitalized
495 "(field enc dec)")
496
497 (defun mew-field-type-for-encoding (key)
498 (or (nth 1 (assoc (mew-capitalize key) mew-field-database)) 'unstruct))
499
500 (defun mew-field-type-for-decoding (key)
501 (or (nth 2 (assoc (mew-capitalize key) mew-field-database)) 'text))
502
503 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
504 ;;;
505 ;;; Theme
506 ;;;
507
508 (defvar mew-theme-file nil
509 "The file name which contains theme.")
510
511 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
512 ;;;
513 ;;; Highlight header
514 ;;;
515
516 (defcustom mew-field-spec
517 '(("^Resent-\\(Sender\\|From\\|To\\|Cc\\|Date\\)" t
518 mew-face-header-important
519 mew-face-header-important)
520 ("^Subject:$" t
521 mew-face-header-important
522 mew-face-header-subject)
523 ("^From:$" t
524 mew-face-header-important
525 mew-face-header-from)
526 ("^\\(To\\|Apparently-To\\):$" t
527 mew-face-header-important
528 mew-face-header-to)
529 ("^\\(Cc\\|Dcc\\|Bcc\\):$" t
530 mew-face-header-important
531 mew-face-header-to)
532 ("^Newsgroups:$" t
533 mew-face-header-important
534 mew-face-header-to)
535 ("^Date:$" t
536 mew-face-header-important
537 mew-face-header-date)
538 ("^Sender:$" t)
539 ("^Reply-To:$" t)
540 ("^\\(X-Mailer\\|User-Agent\\):$" t)
541 ("^X-Mew:$" t
542 mew-face-header-important
543 mew-face-header-xmew)
544 ("^\\(Received\\|Return-Path\\|Errors-To\\):$" nil)
545 ("^\\(Path\\|Distribution\\|Xref\\):$" nil)
546 ("^NNTP-Posting-" nil)
547 ("^\\(Message-Id\\|Posted\\|In-Reply-To\\|References\\|Precedence\\):$" nil)
548 ("^DomainKey-Signature:$" nil)
549 ("^DKIM-Signature:$" nil)
550 ("^ARC-" nil)
551 ("^Received-SPF:$" nil)
552 ("^Autocrypt:$" nil)
553 ("^Authentication-Results:$"
554 mew-authentication-results
555 mew-face-header-important
556 mew-face-header-xmew
557 ("hardfail" mew-face-header-xmew-bad
558 "fail" mew-face-header-xmew-bad
559 "softfail" mew-face-header-xmew-bad))
560 ("^Delivered-" nil)
561 ("^List-" nil) ;; RFC 2369
562 ;; ("^Content-" t)
563 ("^\\(Mime-Version\\|Lines\\):$" nil)
564 ("^From$" nil)
565 ("^Status:$" nil)
566 ("^Face:$" nil
567 mew-face-header-private
568 mew-face-header-marginal)
569 ("^\\(X\\|Original\\)-" nil
570 mew-face-header-private
571 mew-face-header-marginal))
572 "*An alist of field spec for Message mode. Each spec
573 consists of field-regular-expression, visible-p, face-for-key,
574 and face-for-value. Fields whose visible-p is t are displayed in
575 Message mode in the defined order. Fields whose visible-p is nil are
576 hidden in Message mode. Type DEL to see them. Fields not matched
577 to field-regular-expressions are operated by the value of
578 'mew-field-other-visible'. If face-for-key is omitted,
579 'mew-face-header-key' is used. If face-for-value is not
580 present, mew-face-header-marginal is used."
581 :group 'mew-highlight
582 :type '(alist :key-type regexp
583 :value-type
584 (choice (list boolean)
585 (list boolean face face))))
586
587 ;; cons the position to the spec.
588 (defun mew-nspec-by-key (key)
589 (mew-assoc-match3 key mew-field-spec 0))
590
591 (defun mew-nspec-n (nspec)
592 (nth 0 nspec))
593
594 (defun mew-nspec-visiblep (nspec)
595 (nth 2 nspec))
596
597 (defun mew-nspec-keyface (nspec)
598 (nth 3 nspec))
599
600 (defun mew-nspec-valface (nspec)
601 (nth 4 nspec))
602
603 (defun mew-nspec-extraface (nspec)
604 (nth 5 nspec))
605
606 (defun mew-authentication-results (val)
607 (save-match-data
608 (or (string-match "=hardfail" val)
609 (string-match "=fail" val)
610 (string-match "=softfail" val))))
611
612 (mew-defstruct header-color field key val)
613 (defvar mew-header-color-alist nil)
614
615 ;; See also mew-face-make-spec.
616
617 (defun mew-header-color-base (field key-color val-color bold)
618 (unless val-color (setq val-color key-color))
619 (let ((face-key (intern (concat "mew-face-color-" key-color (if bold "-bold"))))
620 (face-val (intern (concat "mew-face-color-" val-color (if bold "-bold")))))
621 (unless (facep face-key)
622 (make-empty-face face-key)
623 (face-spec-set face-key (list (mew-face-spec-func t (mew-face-spec-primitive key-color bold)))))
624 (unless (facep face-val)
625 (make-empty-face face-val)
626 (face-spec-set face-val (list (mew-face-spec-func t (mew-face-spec-primitive val-color bold)))))
627 (setq mew-header-color-alist
628 (cons (list (capitalize field) face-key face-val) mew-header-color-alist))))
629
630 (defun mew-header-color (field key-color &optional val-color)
631 "Set the color of FIELD key to KEY-COLOR.
632 And set the color of FIELD value to VAL-COLOR.
633 If VAL-COLOR is omitted, set the color of FIELD value to KEY-COLOR."
634 (mew-header-color-base field key-color val-color nil))
635
636 (defun mew-header-color-bold (field key-color &optional val-color)
637 "Set the color of FIELD key to KEY-COLOR.
638 And set the color of FIELD value to VAL-COLOR.
639 If VAL-COLOR is omitted, set the color of FIELD value to KEY-COLOR.
640 The style becomes bold."
641 (mew-header-color-base field key-color val-color t))
642
643 (defun mew-key-face (key nspec)
644 (or (mew-header-color-get-key (assoc key mew-header-color-alist))
645 (mew-nspec-keyface nspec)
646 'mew-face-header-key))
647
648 (defun mew-val-face (key nspec)
649 (or (mew-header-color-get-val (assoc key mew-header-color-alist))
650 (mew-nspec-valface nspec)
651 'mew-face-header-marginal))
652
653 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
654 ;;;
655 ;;; Highlight body
656 ;;;
657
658 (defvar mew-highlight-body-regex-comment "^#+.*")
659
660 (defvar mew-highlight-body-regex-cite
661 "^\\(\\([ \t]\\{,7\\}\\([>:|]\\|\\w+\\([._-]+\\w+\\)*>+\\)\\)+\\).*")
662
663 (defcustom mew-highlight-body-prefix-width 20
664 "*Maximum string width assume prefix for fancy highlight a body."
665 :group 'mew-highlight
666 :type 'integer)
667
668 (defvar mew-highlight-body-cite-faces
669 '(mew-face-body-cite1
670 mew-face-body-cite2
671 mew-face-body-cite3
672 mew-face-body-cite4
673 mew-face-body-cite5))
674
675 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
676 ;;;
677 ;;; Highlight mark
678 ;;;
679
680 (defvar mew-highlight-mark-keywords
681 `((,mew-mark-review mew-face-mark-review)
682 (,mew-mark-escape mew-face-mark-escape)
683 (,mew-mark-delete mew-face-mark-delete)
684 (,mew-mark-unlink mew-face-mark-unlink)
685 (,mew-mark-refile mew-face-mark-refile)
686 (,mew-mark-unread mew-face-mark-unread))
687 "A list of mark-face pair to used in Summary/Virtual mode.")
688
689 (defun mew-highlight-mark-get-face (mark)
690 (mew-alist-get-value (assoc mark mew-highlight-mark-keywords)))
691
692 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
693 ;;;
694 ;;; Mark spec
695 ;;;
696
697 (defvar mew-mark-afterstep-spec
698 `((,mew-mark-review 0 0 0 0 0 0 0)
699 (,mew-mark-escape 0 0 0 0 0 0 0)
700 (,mew-mark-read 0 0 0 0 0 0 0)
701 (,mew-mark-delete 2 0 2 0 0 0 0)
702 (,mew-mark-unlink 2 0 2 0 0 0 0)
703 (,mew-mark-refile 2 0 2 0 0 0 0))
704 "*A list of cursor action spec.
705 The cursor action spec is a list of a mark and seven cursor
706 actions after marking.
707
708 0th (the first element of a list) is a mark value. A mark value is
709 ASCII code of the mark. For example, the value of the '*' mark
710 \(mew-mark-review) is 42.
711
712 Seven values following a mark value means as follows:
713
714 1st is the case of no mark.
715 2nd is the case where the new mark is equal to the old one.
716 3rd is the case where level of the new mark is greater than that of the
717 old one.
718 4th, 5th, and 6th is the case where levels are equal.
719 4th and 5th is the case that the old mark has state.
720 4th means that the old mark is overrode.
721 5th means that the old mark remains.
722 6th is the case that the old mark does not have state.
723 7th is the case where level of the new mark is smaller than that of the
724 old one.
725
726 The value of cursor actions means as follows:
727
728 0 means staying.
729 1 means moving according to the direction,
730 2 means moving according to the direction
731 then displaying the next message.
732
733 For more detail, see mew-mark-put-mark and mew-mark-afterstep.")
734
735 (defun mew-markas-nth (mark case)
736 (nth case (assoc mark mew-mark-afterstep-spec)))
737
738 (defvar mew-mark-spec
739 `((,mew-mark-read "read" 0 nil nil nil nil nil)
740 (,mew-mark-unread "unread" 0 nil nil nil nil nil)
741 (,mew-mark-review "review" 1 nil nil nil nil nil)
742 (,mew-mark-escape "escape" 1 nil nil nil nil nil)
743 (,mew-mark-delete "delete" 2 nil t nil mew-mark-exec-delete nil)
744 (,mew-mark-unlink "unlink" 2 nil t nil mew-mark-exec-unlink nil)
745 (,mew-mark-refile "refile" 2 t mew-mark-kill-refile mew-mark-unrefile
746 mew-mark-exec-refile mew-mark-sanity-refile))
747 "*A list of lists which consists of
748 mark, name, level, statefullp, kill-line-p,
749 undo-func, exec-func, and sanity-fucn.")
750
751 ;;
752
753 (defun mew-mark-get-all-marks ()
754 "Collecting all defined marks."
755 (mapcar 'car mew-mark-spec))
756
757 (defun mew-markdb-by-mark (mark)
758 (assoc mark mew-mark-spec))
759
760 (defun mew-markdb-name (mark)
761 (nth 1 (mew-markdb-by-mark mark)))
762
763 (defun mew-markdb-level (mark)
764 (nth 2 (mew-markdb-by-mark mark)))
765
766 (defun mew-markdb-statefullp (mark)
767 (nth 3 (mew-markdb-by-mark mark)))
768
769 (defun mew-markdb-killp (mark)
770 (nth 4 (mew-markdb-by-mark mark)))
771
772 (defun mew-markdb-func-undo (mark)
773 (nth 5 (mew-markdb-by-mark mark)))
774
775 (defun mew-markdb-func-exec (mark)
776 (nth 6 (mew-markdb-by-mark mark)))
777
778 (defun mew-markdb-func-sanity (mark)
779 (nth 7 (mew-markdb-by-mark mark)))
780
781 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
782 ;;;
783 ;;; Inbox action
784 ;;;
785
786 (defvar mew-inbox-action-alist nil
787 "*This variable controls actions when retrieving messages.
788 Currently this works when '\\<mew-summary-mode-map>\\[mew-summary-retrieve]'.
789 You can put any marks, typically 'o' and 'D' according to message
790 headers.
791
792 This value must be a list of entries. An entry is a list whose first
793 element is a field defined in 'mew-scan-fields'.
794
795 If the second element is a list, the first element of the list must be
796 a mark (e.g. ?D) or a string which is a comma separated folders (e.g
797 \"+foo,+bar\" for ?o). Other elements of the list are regular
798 expressions to be matched to the value of the field.
799
800 With the following configuration, Mew marks messages whose Subject:
801 matches \"adult\" or \"money\" with 'D'. And Mew marks messages whose
802 Subject is \"daily log\" with 'o' to be refiled \"+log\". Also Mew
803 marks messages whose Content-Type: contains \"gb2312\" with 'D'.
804
805 \(setq mew-inbox-action-alist
806 '((\"Subject:\"
807 (?D \"adult\" \"money\")
808 (\"+log\" \"daily log\"))
809 (\"Content-Type:\"
810 (?D \"gb2312\"))))
811
812 If the second element of the entry is a symbol, it will be called as a
813 function which returns nil or a mark or a string.
814
815 If you are using 'spamassassin' which adds the \"X-Spam-Flag:\" field
816 to messages and puts them in your mailbox, configure as follows:
817
818 \(setq mew-spam: \"X-Spam-Flag:\")
819
820 \(defun mew-spam-assassin (val)
821 (let ((case-fold-search t))
822 (if (string-match \"yes\" val) ?D)))
823
824 \(setq mew-inbox-action-alist
825 '((\"X-Spam-Flag:\" mew-spam-assassin)))
826
827 With this configuration, messages with the \"X-Spam-Flag:\" whose
828 value is \"Yes\" are automatically marked with 'D' since the
829 'mew-spam-assassin' function returns 'D' marks when the value is
830 \"Yes\".
831
832 If you are using 'bogofilter' which adds the \"X-Bogosity:\" field
833 to messages and puts them to your mailbox, configure as follows:
834
835 \(setq mew-spam: \"X-Bogosity:\")
836
837 \(defun mew-spam-bogofilter (val)
838 (let ((case-fold-search t))
839 (if (string-match \"yes\" val) ?D)))
840
841 \(setq mew-inbox-action-alist
842 '((\"X-Bogosity:\" mew-spam-bogofilter)))
843 ")
844
845 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
846 ;;;
847 ;;; Proto
848 ;;;
849
850 (defvar mew-proto mew-folder-local)
851
852 (defvar mew-proto-spec
853 ;; key go refile flush
854 '(("+" "+" "+" "+")
855 ("$" "+" nil "+")
856 ("%" "%" "%" "+")
857 ("*" nil nil nil)
858 ("-" "-" nil "-")))
859
860 (defun mew-proto-to-body (fld n)
861 (if (mew-folder-virtualp fld)
862 (setq fld (mew-folder-basename fld)))
863 (setq fld (mew-case:folder-folder fld))
864 (let ((proto (mew-folder-prefix fld)))
865 (unless (member proto mew-folder-prefixes)
866 (setq proto (mew-proto))) ;; default proto
867 (nth n (assoc proto mew-proto-spec))))
868
869 (defun mew-proto-to-go (fld)
870 (mew-proto-to-body fld 1))
871
872 (defun mew-proto-to-refile (fld)
873 (mew-proto-to-body fld 2))
874
875 (defun mew-proto-to-flush (fld)
876 (mew-proto-to-body fld 3))
877
878 (defun mew-proto-inbox-folder (proto &optional case)
879 (or proto (setq proto (mew-proto case)))
880 (cond
881 ((mew-folder-popp proto) mew-pop-inbox-folder)
882 ((mew-folder-imapp proto) (mew-imap-inbox-folder case))
883 ((mew-folder-nntpp proto) (mew-nntp-newsgroup case))
884 (t ;; local
885 (mew-inbox-folder case))))
886
887 (defun mew-proto-queue-folder (proto &optional case)
888 (or proto (setq proto (mew-proto case)))
889 (cond
890 ((mew-folder-nntpp proto) (mew-postq-folder case))
891 (t (mew-queue-folder case))))
892
893 (defun mew-proto-friend-folder (proto &optional case)
894 (cond
895 ((mew-folder-imapp proto) (mew-imap-friend-folder case))
896 (t ;; local
897 mew-friend-folder)))
898
899 (defun mew-proto-friend-folder-list (proto &optional case)
900 (cond
901 ((mew-folder-imapp proto) (mew-imap-friend-folder-list case))
902 (t ;; local
903 (mew-local-friend-folder-list))))
904
905 (defun mew-proto-folder-alist (proto &optional case)
906 (cond
907 ((mew-folder-popp proto) (mew-pop-folder-alist))
908 ((mew-folder-imapp proto) (mew-imap-folder-alist case))
909 ((mew-folder-nntpp proto) (mew-nntp-folder-alist case))
910 (t ;; local
911 (mew-local-folder-alist))))
912
913 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
914 ;;;
915 ;;; Config
916 ;;;
917
918 (defcustom mew-config-alist nil
919 "*Alist of config. This is a list of
920 (<case> (<key> <value>) (<key> <value>) ...).
921 - <case> is a string of case.
922 - <key> is a symbol of Mew value with the 'mew-' prefix removed.
923 - <value> is a string.
924
925 Currently, the following keys are supported:
926 name, user, mail-domain,
927 cc, fcc, dcc, reply-to, organization, header-alist, proto,
928 smtp-server, smtp-port, smtp-ssh-server, smtp-ssl, smtp-ssl-port,
929 smtp-user, smtp-auth-list,
930 smtp-msgid-user, smtp-msgid-domain, smtp-helo-domain, smtp-mail-from,
931 pop-server, pop-port, pop-ssh-server, pop-ssl, pop-ssl-port,
932 pop-user, pop-auth, pop-auth-list,
933 pop-size, pop-header-only, pop-delete, pop-body-lines,
934 pop-proxy-server, pop-proxy-port,
935 imap-server, imap-port, imap-ssh-server, imap-ssl, imap-ssl-port,
936 imap-user, imap-auth, imap-auth-list,
937 imap-size, imap-header-only, imap-delete,
938 imap-trash-folder, imap-queue-folder, imap-spam-field, imap-spam-word,
939 imap-proxy-server, imap-proxy-port,
940 nntp-server, nntp-port, nntp-ssh-server, nntp-ssl, nntp-ssl-port,
941 nntp-user, nntp-size, nntp-header-only,
942 nntp-msgid-user, nntp-msgid-domain,
•943 ssl-cert-directory, ssl-verify-level, ssl-algorithm-priority,
944 ssl-client-keycert-list, ssl-trustfiles,
945 inbox-folder, queue-folder, postq-folder,
946 mailbox-type, mbox-command, mbox-command-arg,
947 signature-file, content-type, refile-guess-alist,
948 spam-prog, spam-prog-args, ham-prog, ham-prog-args,
949 use-old-pgp, pgp-signer, smime-signer, privacy-method,
950 protect-privacy-always, protect-privacy-always-type,
951 protect-privacy-encrypted, protect-privacy-encrypted-type,
952 protect-privacy-with-old-pgp-signature
953
954 from = name <user@mail-domain>
955 message-id = *random*.smtp-msgid-user@smtp-msgid-domain
956 message-id = *random*.nntp-msgid-user@nntp-msgid-domain
957
958 An example is as follows:
959
960 \(setq mew-config-alist
961 '((mew
962 (mail-domain \"example.org\")
963 (inbox-folder \"+inbox-mew\"))
964 (keio
965 (cc \"[email protected]\")
966 (user \"pooh\")
967 (mail-domain \"example.net\"))
968 (default
969 (name \"Kazu Yamamoto\")
970 (mail-domain \"example.jp\"))))
971 "
972 ;; bcc can be used but not recommended
973 :group 'mew-env
974 :type '(alist :key-type string
975 :value-type (repeat (cons string string))))
976
977 (defun mew-cfent-by-case (case)
978 (if (null case)
979 (or (assoc mew-case-default mew-config-alist)
980 (assoc (intern mew-case-default) mew-config-alist))
981 (or (assoc case mew-config-alist)
982 (assoc (intern case) mew-config-alist))))
983
984 (provide 'mew-vars2)
985
986 ;;; Copyright Notice:
987
988 ;; Copyright (C) 2000-2015 Mew developing team.
989 ;; All rights reserved.
990
991 ;; Redistribution and use in source and binary forms, with or without
992 ;; modification, are permitted provided that the following conditions
993 ;; are met:
994 ;;
995 ;; 1. Redistributions of source code must retain the above copyright
996 ;; notice, this list of conditions and the following disclaimer.
997 ;; 2. Redistributions in binary form must reproduce the above copyright
998 ;; notice, this list of conditions and the following disclaimer in the
999 ;; documentation and/or other materials provided with the distribution.
1000 ;; 3. Neither the name of the team nor the names of its contributors
1001 ;; may be used to endorse or promote products derived from this software
1002 ;; without specific prior written permission.
1003 ;;
1004 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
1005 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1006 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1007 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
1008 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1009 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1010 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
1011 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
1012 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1013 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
1014 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1015
1016 ;;; mew-vars2.el ends here