From: akr Date: Wed, 2 Sep 1998 19:20:25 +0000 (+0000) Subject: * ew-dec.el (ew-decode-field-interest-option-order): New X-Git-Tag: doodle-1_9_3~4 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60c93c5b5a6c6f6c3fd3094c51347feee421a1e5;p=elisp%2Fflim.git * 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'. --- diff --git a/ChangeLog b/ChangeLog index b1ca2fd..97e92e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 1998-09-02 Tanaka Akira + * 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 + * 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', diff --git a/ew-dec.el b/ew-dec.el index f8820cb..4a70444 100644 --- a/ew-dec.el +++ b/ew-dec.el @@ -461,6 +461,43 @@ each line is separated by CRLF." (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 @@ -501,6 +538,8 @@ each line is separated by CRLF." 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" @@ -514,7 +553,7 @@ each line is separated by CRLF." (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" @@ -548,4 +587,6 @@ each line is separated by CRLF." (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??= (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)") + ) diff --git a/ew-var.el b/ew-var.el index 2463626..605061a 100644 --- a/ew-var.el +++ b/ew-var.el @@ -179,16 +179,32 @@ ;;; 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))) +