1998-09-02 Tanaka Akira <akr@jaist.ac.jp>
+ * ew-dec.el (ew-decode-field-interest-option-order): New
+ function.
+ (ew-decode-field-test): Use
+ `ew-decode-field-interest-option-order'.
+
+ * ew-var.el (ew-option-list): New constant.
+ (ew-save-boolean-options): New function.
+ (ew-restore-boolean-options): New function.
+ (ew-dynamic-options): Use `ew-save-boolean-options'.
+
+1998-09-02 Tanaka Akira <akr@jaist.ac.jp>
+
* ew-data.el (ew-search-sticked-eword): New function.
(ew-separate-eword): Use `ew-search-sticked-eword' to
check `ew-permit-null-encoded-text', `ew-ignore-75bytes-limit',
(not (eq (charsets-to-mime-charset (find-charset-string str)) 'us-ascii)))
;;;
+
+(defun ew-decode-field-interest-option-order (field-name field-body)
+ (let* ((ew-decode-sticked-encoded-word nil)
+ (ew-decode-quoted-encoded-word nil)
+ (ew-ignore-75bytes-limit nil)
+ (ew-ignore-76bytes-limit nil)
+ (ew-permit-sticked-comment nil)
+ (ew-permit-sticked-special nil)
+ (ew-permit-null-encoded-text nil)
+ (decoded (make-vector (lsh 1 (length ew-option-list)) nil))
+ tmp
+ i j k
+ )
+ (aset decoded 0 (list 0 (ew-decode-field field-name field-body)))
+ (setq i 1)
+ (while (< i (length decoded))
+ (ew-restore-boolean-options i)
+ (setq tmp (ew-decode-field field-name field-body))
+ (setq j 0)
+ (while (<= (lsh 1 j) i)
+ (unless (zerop (logand i (lsh 1 j)))
+ (setq k (logand i (lognot (lsh 1 j))))
+ (when (or (not (aref decoded i))
+ (< (car (aref decoded i))
+ (+ (if (equal (cadr (aref decoded k)) tmp) 0 1)
+ (car (aref decoded k)))))
+ (aset decoded i
+ (ew-cons*
+ (+ (if (equal (cadr (aref decoded k)) tmp) 0 1)
+ (car (aref decoded k)))
+ tmp
+ (nth j ew-option-list)
+ (cddr (aref decoded k))))))
+ (setq j (1+ j)))
+ (setq i (1+ i)))
+ (reverse (cddr (aref decoded (1- (length decoded)))))))
+
(defun ew-decode-field-test (field-name field-body)
(interactive
(list
ew-permit-null-encoded-text
))
d1 d2)
+ (when (<= 16 (prefix-numeric-value current-prefix-arg))
+ (setq options (ew-decode-field-interest-option-order field-name field-body)))
(setq d1 (ew-decode-field-no-cache field-name field-body))
(insert field-name ":" field-body "\n"
(make-string 76 ?-) "\n"
(setq d1 d2))
(setq options (cdr options)))
(insert (make-string 76 ?-) "\n")
- (when current-prefix-arg
+ (when (<= 4 (prefix-numeric-value current-prefix-arg))
(mapcar
(lambda (frag)
(insert (format "%-15s %S\n"
(ew-decode-field-test "Subject" " =?xUS-ASCII?Q??=?xUS-ASCII?Q?a?=")
(ew-decode-field-test "Subject" " =?+US-ASCII?Q??=?+US-ASCII?Q?a?=")
+(ew-decode-field "From"" ()=?+US-ASCII?Q??=?+US-ASCII?Q?a?= =?US-ASCII?Q??= <akr@foo> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)")
+
)
;;; utilities for variables.
+(defconst ew-option-list
+ '(ew-decode-sticked-encoded-word
+ ew-decode-quoted-encoded-word
+ ew-ignore-75bytes-limit
+ ew-ignore-76bytes-limit
+ ew-permit-sticked-comment
+ ew-permit-sticked-special
+ ew-permit-null-encoded-text))
+
+(defun ew-save-boolean-options ()
+ (let ((tmp 1) (opts ew-option-list) (val 0))
+ (while opts
+ (when (symbol-value (car opts)) (setq val (logior val tmp)))
+ (setq tmp (lsh tmp 1)
+ opts (cdr opts)))
+ val))
+
+(defun ew-restore-boolean-options (val)
+ (let ((tmp 1) (opts ew-option-list))
+ (while opts
+ (set (car opts) (not (zerop (logand val tmp))))
+ (setq tmp (lsh tmp 1)
+ opts (cdr opts)))))
+
(defun ew-dynamic-options ()
(cons
ew-default-mime-charset
- (logior
- (if ew-decode-sticked-encoded-word 1 0)
- (if ew-decode-quoted-encoded-word 2 0)
- (if ew-ignore-75bytes-limit 4 0)
- (if ew-ignore-76bytes-limit 8 0)
- (if ew-permit-sticked-comment 16 0)
- (if ew-permit-sticked-special 32 0)
- (if ew-remove-bare-crlf 64 0)
- (if ew-permit-null-encoded-text 128 0)
- )))
+ (ew-save-boolean-options)))
+