a16c41c4ec96404438a78a2f8acab43be7578cdb
[elisp/flim.git] / ew-var.el
1 (provide 'ew-var)
2
3 ;;; user customizable variables.
4
5 (defvar ew-decode-sticked-encoded-word nil)
6 (defvar ew-decode-quoted-encoded-word nil)
7 (defvar ew-ignore-75bytes-limit nil)
8 (defvar ew-ignore-76bytes-limit nil)
9 (defvar ew-permit-sticked-comment nil)
10 (defvar ew-permit-sticked-special nil)
11
12 ;;; anonymous function to decode ground string.
13 ;; NOTE: STR is CRLF-form and it should return as CRLF-form.
14 (defvar ew-decode-us-ascii (lambda (str) (decode-coding-string str 'iso-latin-1-unix)))
15
16 ;;;
17 (defvar ew-decode-field-syntax-alist
18 '(("from"               ew-scan-unibyte-std11 . ew:tag-mailbox+-tok)
19   ("sender"             ew-scan-unibyte-std11 . ew:tag-mailbox-tok)
20   ("to"                 ew-scan-unibyte-std11 . ew:tag-address+-tok)
21   ("resent-to"          ew-scan-unibyte-std11 . ew:tag-address+-tok)
22   ("cc"                 ew-scan-unibyte-std11 . ew:tag-address+-tok)
23   ("resent-cc"          ew-scan-unibyte-std11 . ew:tag-address+-tok)
24   ("bcc"                ew-scan-unibyte-std11 . ew:tag-address*-tok)
25   ("resent-bcc"         ew-scan-unibyte-std11 . ew:tag-address*-tok)
26   ("message-id"         ew-scan-unibyte-std11)
27   ("resent-message-id"  ew-scan-unibyte-std11)
28   ("in-reply-to"        ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*-tok)
29   ("references"         ew-scan-unibyte-std11 . ew:tag-phrase-msg-id*-tok)
30   ("keywords"           ew-scan-unibyte-std11 . ew:tag-phrase*-tok)
31   ("subject"            ew-scan-unibyte-unstructured)
32   ("comments"           ew-scan-unibyte-unstructured)
33   ("encrypted"          ew-scan-unibyte-std11)
34   ("date"               ew-scan-unibyte-std11)
35   ("reply-to"           ew-scan-unibyte-std11 . ew:tag-address+-tok)
36   ("received"           ew-scan-unibyte-std11)
37   ("resent-reply-to"    ew-scan-unibyte-std11 . ew:tag-address+-tok)
38   ("resent-from"        ew-scan-unibyte-std11 . ew:tag-mailbox+-tok)
39   ("resent-sender"      ew-scan-unibyte-std11 . ew:tag-mailbox-tok)
40   ("resent-date"        ew-scan-unibyte-std11)
41   ("return-path"        ew-scan-unibyte-std11)
42   ("mime-version"       ew-scan-unibyte-std11)
43   ("content-type"       ew-scan-unibyte-mime)
44   ("content-transfer-encoding"  ew-scan-unibyte-mime)
45   ("content-id"         ew-scan-unibyte-mime)
46   ("content-description"        ew-scan-unibyte-unstructured)
47 ))
48
49 (defvar ew-decode-field-default-syntax '(ew-scan-unibyte-unstructured))
50
51 ;;; constants.
52
53 (defconst ew-token-regexp "[-!#-'*+0-9A-Z^-~]+")
54 (defconst ew-encoded-text-regexp "[!->@-~]+")
55 (defconst ew-encoded-word-regexp
56   (concat (regexp-quote "=?")
57           "\\(" ew-token-regexp "\\)"
58           (regexp-quote "?")
59           "\\(" ew-token-regexp "\\)"
60           (regexp-quote "?")
61           "\\(" ew-encoded-text-regexp "\\)"
62           (regexp-quote "?=")))
63
64 ;;; utilities for variables.
65
66 (defun ew-dynamic-options ()
67   (list
68    ew-decode-sticked-encoded-word
69    ew-decode-quoted-encoded-word
70    ew-ignore-75bytes-limit
71    ew-ignore-76bytes-limit
72    ew-permit-sticked-comment
73    ew-permit-sticked-special))