From a7ef9fab327836625557cfd1811a0584a00f93d9 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 19 Aug 1998 08:44:05 +0000 Subject: [PATCH] * DOODLE-TIPS: Add desctiptions about byte-compile warnings. * ew-data.el (ew-mark-phrase): Does not update right end of fragments separation. * ew-dec.el (ew-mark): Wait `ew-parse-error-sit-for-seconds' seconds after parse error. * ew-line.el (ew-tab-to-space): New function. (ew-crlf-generic): New function. (ew-crlf-line-generic): Rewrited. (ew-lf-generic): New function. (ew-lf-line-generic): Rewrited. (ew-crlf-convert): New function. (ew-crlf-line-convert): Rewrited. (ew-lf-convert): New function. (ew-lf-line-convert): Rewrited. (ew-crlf-fold): New function. (ew-lf-fold): New function. (ew-crlf-refold): New function. (ew-lf-refold): New function. * ew-parse.el: Parser actions are now accesible to a lookahead token. * ew-var.el (ew-parse-error-sit-for-seconds): New variable. * eword-decode.el: Enable debug code `rotate-memo'. (eword-decode-header): Refold decoded field. (eword-decode-and-fold-structured-field): Use `ew-crlf-refold'. * lr-driver.el (lr-parse): Provides a lookahead token to parser actions. * mmbuffer.el (insert-decoded-header): Refold decoded field. --- ChangeLog | 38 +++++++++ DOODLE-TIPS | 2 + ew-data.el | 3 +- ew-dec.el | 11 ++- ew-line.el | 244 ++++++++++++++++++++++++++++++++++++++----------------- ew-parse.el | 194 +++++++++++++++++++++---------------------- ew-var.el | 2 + eword-decode.el | 83 ++++++++----------- lr-driver.el | 2 +- mmbuffer.el | 22 ++--- 10 files changed, 366 insertions(+), 235 deletions(-) diff --git a/ChangeLog b/ChangeLog index cdb54b1..6bc40fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +1998-08-19 Tanaka Akira + + * DOODLE-TIPS: Add desctiptions about byte-compile warnings. + + * ew-data.el (ew-mark-phrase): Does not update right end of + fragments separation. + + * ew-dec.el (ew-mark): Wait `ew-parse-error-sit-for-seconds' + seconds after parse error. + + * ew-line.el (ew-tab-to-space): New function. + (ew-crlf-generic): New function. + (ew-crlf-line-generic): Rewrited. + (ew-lf-generic): New function. + (ew-lf-line-generic): Rewrited. + (ew-crlf-convert): New function. + (ew-crlf-line-convert): Rewrited. + (ew-lf-convert): New function. + (ew-lf-line-convert): Rewrited. + (ew-crlf-fold): New function. + (ew-lf-fold): New function. + (ew-crlf-refold): New function. + (ew-lf-refold): New function. + + * ew-parse.el: Parser actions are now accesible to a lookahead + token. + + * ew-var.el (ew-parse-error-sit-for-seconds): New variable. + + * eword-decode.el: Enable debug code `rotate-memo'. + (eword-decode-header): Refold decoded field. + (eword-decode-and-fold-structured-field): Use `ew-crlf-refold'. + + * lr-driver.el (lr-parse): Provides a lookahead token to parser + actions. + + * mmbuffer.el (insert-decoded-header): Refold decoded field. + 1998-08-18 Tanaka Akira * DOODLE-TIPS: Change `gnus-unstructured-field-decoder' and diff --git a/DOODLE-TIPS b/DOODLE-TIPS index fe51fbb..4a616e7 100644 --- a/DOODLE-TIPS +++ b/DOODLE-TIPS @@ -24,3 +24,5 @@ field name information. (let ((ew-ignore-76bytes-limit t)) (ew-cut-cr-lf (ew-decode-field "From" (ew-lf-to-crlf string) 'ew-cut-cr-lf))) (eword-decode-unstructured-field-body (std11-unfold-string string) 'must-unfold)))) + +* Ignore warnings about args-eword-* when byte-compiling. diff --git a/ew-data.el b/ew-data.el index afa2754..5b9f91a 100644 --- a/ew-data.el +++ b/ew-data.el @@ -116,8 +116,7 @@ '(ew:atom-tok ew:qs-texts-tok) '(ew:atom-tok))) - (setq frag1 (get (get frag1 'prev-frag) 'next-frag)) - (setq frag2 (get (get frag2 'next-frag) 'prev-frag))) + (setq frag1 (get (get frag1 'prev-frag) 'next-frag))) (while (not (eq frag1 frag2)) (unless (ew-comment-frag-p frag2) (put frag2 'decode 'ew-decode-phrase)) diff --git a/ew-dec.el b/ew-dec.el index 58bc740..c678c75 100644 --- a/ew-dec.el +++ b/ew-dec.el @@ -83,9 +83,14 @@ instead of its argument." (let ((tlist (cons (list (symbol-value tag)) (ew-pair-list anchor)))) ;;(insert (format "%s" tlist)) (ew-parse - (lambda () (if (null tlist) '(0) - (prog1 (car tlist) (setq tlist (cdr tlist))))) - (lambda (msg tok) (message "%s%s : %s" msg tok anchor))))) + (lambda () + (if (null tlist) + (cons 0 anchor) + (prog1 (car tlist) (setq tlist (cdr tlist))))) + (lambda (msg tok) + (message "%s%s : %s" msg tok anchor) + (when (< 0 ew-parse-error-sit-for-seconds) + (sit-for ew-parse-error-sit-for-seconds)))))) (defun ew-decode-none (anchor frag end eword-filter) (while (not (eq frag end)) diff --git a/ew-line.el b/ew-line.el index c23132c..831d508 100644 --- a/ew-line.el +++ b/ew-line.el @@ -7,6 +7,22 @@ (put 'ew-lf-line-generic 'lisp-indent-function 1) (put 'ew-lf-line-convert 'lisp-indent-function 1) +(defun ew-tab-to-space (str) + (let ((i 0) (j 0) (l (length str)) result) + (while (< j l) + (when (equal (aref str j) ?\t) + (setq result (ew-rcons* + result + (substring str i j) + " ") + i j)) + (setq j (1+ j))) + (when (< i l) + (setq result (ew-rcons* + result + (substring str i)))) + (apply 'concat (nreverse result)))) + (defun ew-lf-to-crlf (str) (let ((i 0) (j 0) (l (length str)) result) (while (< j l) @@ -115,124 +131,204 @@ (defun ew-cut-cr (str) (ew-cut-generic str '(?\r))) (defun ew-cut-lf (str) (ew-cut-generic str '(?\n))) -(defmacro ew-crlf-line-generic-define () +(defmacro ew-crlf-generic-define () (let ((str (make-symbol "str")) (others-fun (make-symbol "others-fun")) (fold-fun (make-symbol "fold-fun")) - (crlf-fun (make-symbol "crlf-fun")) - (bare-cr-fun (make-symbol "bare-cr-fun")) - (bare-lf-fun (make-symbol "bare-lf-fun")) + (nl-fun (make-symbol "nl-fun")) + (cr-fun (make-symbol "cr-fun")) + (lf-fun (make-symbol "lf-fun")) (p (make-symbol "p")) (q (make-symbol "q")) (r (make-symbol "r"))) - `(defun ew-crlf-line-generic - (,str ,others-fun ,fold-fun ,crlf-fun ,bare-cr-fun ,bare-lf-fun) + `(defun ew-crlf-generic + (,str ,others-fun ,fold-fun ,nl-fun ,cr-fun ,lf-fun) (let ((,p 0) (,q (length ,str)) ,r) (while (< ,p ,q) (setq ,r ,p) (lex-scan-unibyte ,str ,p ,q ((+ [^ "\r\n"]) (when ,others-fun (funcall ,others-fun ,r ,p))) ((?\r ?\n [" \t"]) (when ,fold-fun (funcall ,fold-fun ,r ,p))) - ((?\r ?\n) (when ,crlf-fun (funcall ,crlf-fun ,r ,p))) - ((?\r) (when ,bare-cr-fun (funcall ,bare-cr-fun ,r ,p))) - ((?\n) (when ,bare-lf-fun (funcall ,bare-lf-fun ,r ,p))) + ((?\r ?\n) (when ,nl-fun (funcall ,nl-fun ,r ,p))) + ((?\r) (when ,cr-fun (funcall ,cr-fun ,r ,p))) + ((?\n) (when ,lf-fun (funcall ,lf-fun ,r ,p))) (() (error "something wrong")))) ,q)))) +(ew-crlf-generic-define) +(defmacro ew-crlf-line-generic-define () + (let ((str (make-symbol "str")) + (others-fun (make-symbol "others-fun")) + (fold-fun (make-symbol "fold-fun")) + (nl-fun (make-symbol "nl-fun")) + (p (make-symbol "p")) + (q (make-symbol "q")) + (r (make-symbol "r"))) + `(defun ew-crlf-line-generic + (,str ,others-fun ,fold-fun ,nl-fun) + (let ((,p 0) (,q (length ,str)) ,r) + (while (< ,p ,q) + (setq ,r ,p) + (lex-scan-unibyte ,str ,p ,q + (() (error "something wrong")) + (((* [^ "\r\n"]) + (* (+ ?\r) [^ "\r\n"] (* [^ "\r"])) + (* ?\r) + (?\r ?\n [" \t"])) + (when (and ,others-fun (< ,r (- ,p 3))) (funcall ,others-fun ,r (- ,p 3))) + (when ,fold-fun (funcall ,fold-fun (- ,p 3) ,p))) + (((* [^ "\r\n"]) + (* (+ ?\r) [^ "\r\n"] (* [^ "\r"])) + (* ?\r) + (?\r ?\n)) + (when (and ,others-fun (< ,r (- ,p 2))) (funcall ,others-fun ,r (- ,p 2))) + (when ,nl-fun (funcall ,nl-fun (- ,p 2) ,p))) + (((* [^ "\r\n"]) + (* (+ ?\r) [^ "\r\n"] (* [^ "\r"])) + (* ?\r)) + (when ,others-fun (funcall ,others-fun ,r ,p))))) + ,q)))) (ew-crlf-line-generic-define) -(defmacro ew-crlf-line-convert-define () +(defmacro ew-lf-generic-define () (let ((str (make-symbol "str")) (others-fun (make-symbol "others-fun")) (fold-fun (make-symbol "fold-fun")) - (crlf-fun (make-symbol "crlf-fun")) - (bare-cr-fun (make-symbol "bare-cr-fun")) - (bare-lf-fun (make-symbol "bare-lf-fun")) - (index (make-symbol "index")) - (result (make-symbol "result")) - (start (make-symbol "starx")) - (end (make-symbol "end"))) - `(defun ew-crlf-line-convert - (,str ,others-fun ,fold-fun ,crlf-fun ,bare-cr-fun ,bare-lf-fun) - (let ((,index 0) ,result) - (when (> (ew-crlf-line-generic - ,str - ,@(mapcar - (lambda (fun) - `(when ,fun - (lambda (,start ,end) - (when (< ,index ,start) - (setq ,result - (ew-rcons* ,result - (substring ,str ,index ,start)))) - (setq ,result - (ew-rcons* ,result - (funcall ,fun - (substring ,str ,start ,end))) - ,index ,end)))) - (list others-fun fold-fun crlf-fun bare-cr-fun bare-lf-fun))) - ,index) - (setq ,result - (ew-rcons* ,result - (substring ,str ,index)))) - (apply 'concat (nreverse ,result)))))) - -(ew-crlf-line-convert-define) + (nl-fun (make-symbol "nl-fun")) + (cr-fun (make-symbol "cr-fun")) + (p (make-symbol "p")) + (q (make-symbol "q")) + (r (make-symbol "r"))) + `(defun ew-lf-generic + (,str ,others-fun ,fold-fun ,nl-fun ,cr-fun) + (let ((,p 0) (,q (length ,str)) ,r) + (while (< ,p ,q) + (setq ,r ,p) + (lex-scan-unibyte ,str ,p ,q + ((+ [^ "\r\n"]) (when ,others-fun (funcall ,others-fun ,r ,p))) + ((?\n [" \t"]) (when ,fold-fun (funcall ,fold-fun ,r ,p))) + ((?\n) (when ,nl-fun (funcall ,nl-fun ,r ,p))) + ((?\r) (when ,cr-fun (funcall ,cr-fun ,r ,p))) + (() (error "something wrong")))) + ,q)))) +(ew-lf-generic-define) (defmacro ew-lf-line-generic-define () (let ((str (make-symbol "str")) (others-fun (make-symbol "others-fun")) (fold-fun (make-symbol "fold-fun")) - (lf-fun (make-symbol "lf-fun")) + (nl-fun (make-symbol "nl-fun")) (p (make-symbol "p")) (q (make-symbol "q")) (r (make-symbol "r"))) `(defun ew-lf-line-generic - (,str ,others-fun ,fold-fun ,lf-fun) + (,str ,others-fun ,fold-fun ,nl-fun) (let ((,p 0) (,q (length ,str)) ,r) (while (< ,p ,q) (setq ,r ,p) (lex-scan-unibyte ,str ,p ,q - ((+ [^ "\n"]) (when ,others-fun (funcall ,others-fun ,r ,p))) - ((?\n [" \t"]) (when ,fold-fun (funcall ,fold-fun ,r ,p))) - ((?\n) (when ,lf-fun (funcall ,lf-fun ,r ,p))) - (() (error "something wrong")))) + (() (error "something wrong")) + ((+ [^ "\n"]) + (when ,others-fun (funcall ,others-fun ,r ,p))) + ((?\n [" \t"]) + (when ,fold-fun (funcall ,fold-fun ,r ,p))) + (?\n + (when ,nl-fun (funcall ,nl-fun ,r ,p))))) ,q)))) - (ew-lf-line-generic-define) -(defmacro ew-lf-line-convert-define () +(defmacro ew-generic-convert-define (name generic &rest funcs) (let ((str (make-symbol "str")) - (others-fun (make-symbol "others-fun")) - (fold-fun (make-symbol "fold-fun")) - (lf-fun (make-symbol "lf-fun")) + (funcs-vars (mapcar (lambda (func) (make-symbol (symbol-name func))) funcs)) (index (make-symbol "index")) (result (make-symbol "result")) + (tmp (make-symbol "tmp")) (start (make-symbol "starx")) (end (make-symbol "end"))) - `(defun ew-lf-line-convert - (,str ,others-fun ,fold-fun ,lf-fun) - (let ((,index 0) ,result) - (when (> (ew-lf-line-generic - ,str - ,@(mapcar - (lambda (fun) - `(when ,fun - (lambda (,start ,end) - (when (< ,index ,start) - (setq ,result - (ew-rcons* ,result - (substring ,str ,index ,start)))) - (setq ,result - (ew-rcons* ,result - (funcall ,fun - (substring ,str ,start ,end))) - ,index ,end)))) - (list others-fun fold-fun lf-fun))) + `(defun ,name + (,str ,@funcs-vars) + (let ((,index 0) ,result ,tmp) + (when (> (,generic + ,str + ,@(mapcar + (lambda (fun) + `(when ,fun + (lambda (,start ,end) + (setq ,tmp (funcall ,fun (substring ,str ,start ,end))) + (when ,tmp + (when (< ,index ,start) + (setq ,result + (ew-rcons* ,result + (substring ,str ,index ,start)))) + (setq ,result (ew-rcons* ,result ,tmp) + ,index ,end))))) + funcs-vars)) ,index) (setq ,result (ew-rcons* ,result (substring ,str ,index)))) (apply 'concat (nreverse ,result)))))) +(ew-generic-convert-define ew-crlf-convert ew-crlf-generic others-fun fold-fun nl-fun cr-fun lf-fun) +(ew-generic-convert-define ew-crlf-line-convert ew-crlf-line-generic others-fun fold-fun nl-fun) +(ew-generic-convert-define ew-lf-convert ew-lf-generic others-fun fold-fun nl-fun cr-fun) +(ew-generic-convert-define ew-lf-line-convert ew-lf-line-generic others-fun fold-fun nl-fun) + +(defmacro ew-fold-define (name convert nl) + `(defun ,name (str start-column line-length) + (let ((column start-column)) + (,convert str + (lambda (line) + (let ((start 0) + (end (length line)) + result tmp fold width) + (while (and (< start end) + (progn + (when (<= column 1) + (setq tmp (sref line start) + result (ew-rcons* result (char-to-string tmp)) + column (+ column (char-width tmp)) + start (char-next-index tmp start))) + (string-match "[ \t]" line start))) + (setq tmp (substring line start (match-beginning 0)) + width (string-width tmp) + result (ew-rcons* result tmp) + column (+ column width) + start (match-beginning 0)) + (if (<= line-length column) + (progn + (when (and fold (not (= line-length column))) + (setcdr fold (cons (car fold) (cdr fold))) + (setcar fold ,nl) + (setq column (+ width + (if (eq (cdr result) fold) + 0 + (string-width (cadr result)))))) + (if (<= line-length column) + (setq result (ew-rcons* result ,nl) + column 0 + fold nil) + (setq fold result))) + (setq fold result)) + (setq tmp (sref line (match-beginning 0)) + result (ew-rcons* result (char-to-string tmp)) + column (+ column (char-width tmp)) + start (match-end 0))) + (when (< start end) + (setq tmp (substring line start) + result (ew-rcons* result tmp) + column (+ column (string-width tmp)))) + (when (and (< line-length column) fold) + (setcdr fold (cons (car fold) (cdr fold))) + (setcar fold ,nl)) + (apply 'concat (nreverse result)))) + (lambda (fold) (setq column 1) nil) + (lambda (nl) (setq column 0) nil))))) + +(ew-fold-define ew-crlf-fold ew-crlf-line-convert "\r\n") +(ew-fold-define ew-lf-fold ew-crlf-line-convert "\n") + +(defun ew-crlf-refold (string start-column line-length) + (ew-crlf-fold (ew-crlf-unfold string) start-column line-length)) -(ew-lf-line-convert-define) +(defun ew-lf-refold (string start-column line-length) + (ew-lf-fold (ew-lf-unfold string) start-column line-length)) diff --git a/ew-parse.el b/ew-parse.el index 77062f5..deb4657 100644 --- a/ew-parse.el +++ b/ew-parse.el @@ -387,389 +387,389 @@ (defconst ew:reduction-table (vector '() - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (accept $1))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 1 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 2 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 2 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 3 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 3 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 4 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 4 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 5 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 6 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($4 (aref stack (- sp 1))) ($3 (aref stack (- sp 3))) ($2 (aref stack (- sp 5))) ($1 (aref stack (- sp 7)))) (lr-push stack (- sp 8) 7 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 7 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 8 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 8 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 9 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($4 (aref stack (- sp 1))) ($3 (aref stack (- sp 3))) ($2 (aref stack (- sp 5))) ($1 (aref stack (- sp 7)))) (lr-push stack (- sp 8) 10 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 11 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($5 (aref stack (- sp 1))) ($4 (aref stack (- sp 3))) ($3 (aref stack (- sp 5))) ($2 (aref stack (- sp 7))) ($1 (aref stack (- sp 9)))) (lr-push stack (- sp 10) 11 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 12 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 12 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 13 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 13 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 13 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 14 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 14 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 15 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 15 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 16 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 17 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 18 goto-table (ew-mark-phrase (car $1) (cdr $1))))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 19 goto-table $1))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 19 goto-table (cons (car $1) (cdr $2))))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 20 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 21 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($4 (aref stack (- sp 1))) ($3 (aref stack (- sp 3))) ($2 (aref stack (- sp 5))) ($1 (aref stack (- sp 7)))) (lr-push stack (- sp 8) 21 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($4 (aref stack (- sp 1))) ($3 (aref stack (- sp 3))) ($2 (aref stack (- sp 5))) ($1 (aref stack (- sp 7)))) (lr-push stack (- sp 8) 22 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 23 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 23 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 24 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 24 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 25 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 26 goto-table $1))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 26 goto-table $1))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 27 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 28 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 28 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 29 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 29 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 30 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 30 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 31 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 31 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($1 (aref stack (- sp 1)))) (lr-push stack (- sp 2) 32 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 32 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 33 goto-table nil))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 33 goto-table (cons (if $1 (car $1) $2) $2)))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 33 goto-table (cons (if $1 (car $1) $2) $2)))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 33 goto-table (cons (if $1 (car $1) (car $2)) (cdr $2))))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 34 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 35 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 36 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 37 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 38 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 39 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 40 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 41 goto-table (cons (car $1) (if $2 (cdr $2) (cdr $1)))))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 42 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 43 goto-table (cons $1 (if $2 (cdr $2) $1))))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 44 goto-table (cons $1 $3)))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 45 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 45 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 45 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 45 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 45 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 45 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 46 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 47 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 47 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 47 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 47 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 47 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 47 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($3 (aref stack (- sp 1))) ($2 (aref stack (- sp 3))) ($1 (aref stack (- sp 5)))) (lr-push stack (- sp 6) 48 goto-table (cons $1 $3)))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* () (lr-push stack (- sp 0) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) - (lambda (stack sp goto-table) + (lambda (stack sp goto-table $lookahead) (let* (($2 (aref stack (- sp 1))) ($1 (aref stack (- sp 3)))) (lr-push stack (- sp 4) 49 goto-table ()))) diff --git a/ew-var.el b/ew-var.el index a16c41c..60d6e81 100644 --- a/ew-var.el +++ b/ew-var.el @@ -9,6 +9,8 @@ (defvar ew-permit-sticked-comment nil) (defvar ew-permit-sticked-special nil) +(defvar ew-parse-error-sit-for-seconds 0) + ;;; anonymous function to decode ground string. ;; NOTE: STR is CRLF-form and it should return as CRLF-form. (defvar ew-decode-us-ascii (lambda (str) (decode-coding-string str 'iso-latin-1-unix))) diff --git a/eword-decode.el b/eword-decode.el index 3144048..08ca6d6 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -44,8 +44,9 @@ ;;; TEST +(defvar rotate-memo nil) (defmacro rotate-memo (var val) - `(progn + `(when rotate-memo (unless (boundp ',var) (setq ,var ())) (setq ,var (cons ,val ,var)) (let ((tmp (last ,var (- (length ,var) 100)))) @@ -366,8 +367,8 @@ mime-charset, it decodes non-ASCII bit patterns as the mime-charset. Otherwise it decodes non-ASCII bit patterns as the default-mime-charset." (interactive "*r") -;; (rotate-memo args-eword-decode-region -;; (list start end (buffer-substring start end) unfolding must-unfold code-conversion)) + (rotate-memo args-eword-decode-region + (list start end (buffer-substring start end) unfolding must-unfold code-conversion)) (save-excursion (save-restriction (narrow-to-region start end) @@ -410,30 +411,36 @@ Otherwise it decodes non-ASCII bit patterns as the default-mime-charset. If SEPARATOR is not nil, it is used as header separator." (interactive "*") -;; (rotate-memo args-eword-decode-header (list code-conversion)) + (rotate-memo args-eword-decode-header (list code-conversion)) (unless code-conversion - (message "eword-decode-header is called with no code-conversion")) + (message "eword-decode-header is called with no code-conversion") + (sit-for 2)) (if (and code-conversion (not (mime-charset-to-coding-system code-conversion))) (setq code-conversion default-mime-charset)) (save-excursion (save-restriction (std11-narrow-to-header separator) -;; (rotate-memo header-eword-decode-header (buffer-substring (point-min) (point-max))) + (rotate-memo args-h-eword-decode-header (buffer-substring (point-min) (point-max))) (if code-conversion - (let (beg p end field-name field-body len) + (let (beg p end field-name field-body decoded) (goto-char (point-min)) (while (re-search-forward std11-field-head-regexp nil t) (setq beg (match-beginning 0) p (match-end 0) field-name (buffer-substring beg (1- p)) end (std11-field-end) - field-body (buffer-substring p end)) + field-body (buffer-substring p end) + decoded (ew-decode-field + field-name + (ew-lf-crlf-to-crlf field-body))) + (unless (equal field-body decoded) + (setq decoded (ew-crlf-refold + decoded + (1+ (string-width field-name)) + fill-column))) (delete-region p end) - (insert (ew-crlf-to-lf - (ew-decode-field field-name - (ew-lf-crlf-to-crlf field-body)))) - )) + (insert (ew-crlf-to-lf decoded)))) (eword-decode-region (point-min) (point-max) t nil nil) )))) @@ -710,38 +717,18 @@ If MAX-COLUMN is omitted, `fill-column' is used. If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even if there are in decoded encoded-words (generated by bad manner MUA such as a version of Net$cape)." -;; (rotate-memo args-eword-decode-and-fold-structured-field -;; (list string start-column max-column must-unfold)) + (rotate-memo args-eword-decode-and-fold-structured-field + (list string start-column max-column must-unfold)) (or max-column (setq max-column fill-column)) - (let* ((ew-decode-field-default-syntax '(ew-scan-unibyte-std11)) - (decoded (ew-decode-field (make-string (1- start-column) ?X) - (ew-lf-crlf-to-crlf string) - (if must-unfold 'ew-cut-cr-lf))) - column) - (setq decoded (ew-crlf-to-lf decoded)) - (setq column 0) - (ew-lf-line-convert decoded - (lambda (line) - (if (<= (length line) max-column) - line - (let ((start 0) index) - (catch 'loop - (while (< (+ column start) max-column) - (if (string-match " " decoded start) - (progn - (setq start (match-end 0)) - (when (< (match-beginning 0) max-column) - (setq index (match-beginning 0)))) - (throw 'loop nil))) - (setq index (string-match " " decoded start))) - (if index - (concat (substring decoded 0 index) - "\n" - (substring decoded index)) - decoded)))) - (lambda (str) (setq column 1) str) - (lambda (str) (setq column 0) str)))) + (let* ((field-name (make-string (1- start-column) ?X)) + (field-body (ew-lf-crlf-to-crlf string)) + (ew-decode-field-default-syntax '(ew-scan-unibyte-std11)) + (decoded (ew-decode-field field-name field-body + (if must-unfold 'ew-cut-cr-lf)))) + (unless (equal field-body decoded) + (setq decoded (ew-crlf-refold decoded start-column max-column))) + (ew-crlf-to-lf decoded))) (defun eword-decode-and-unfold-structured-field (string) "Decode and unfold STRING as structured field body. @@ -751,7 +738,7 @@ characters are regarded as variable `default-mime-charset'. If an encoded-word is broken or your emacs implementation can not decode the charset included in it, it is not decoded." -;; (rotate-memo args-eword-decode-and-unfold-structured-field (list string)) + (rotate-memo args-eword-decode-and-unfold-structured-field (list string)) (let* ((ew-decode-field-default-syntax '(ew-scan-unibyte-std11)) (decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string) @@ -773,8 +760,8 @@ decode the charset included in it, it is not decoded. If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even if there are in decoded encoded-words (generated by bad manner MUA such as a version of Net$cape)." -;; (rotate-memo args-eword-decode-structured-field-body -;; (list string must-unfold start-column max-column)) + (rotate-memo args-eword-decode-structured-field-body + (list string must-unfold start-column max-column)) (if start-column ;; fold with max-column (folding is not implemented.) (let* ((ew-decode-field-default-syntax '(ew-scan-unibyte-std11)) @@ -803,8 +790,8 @@ decode the charset included in it, it is not decoded. If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even if there are in decoded encoded-words (generated by bad manner MUA such as a version of Net$cape)." -;; (rotate-memo args-eword-decode-unstructured-field-body -;; (list string must-unfold)) + (rotate-memo args-eword-decode-unstructured-field-body + (list string must-unfold)) (let ((decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string) (if must-unfold 'ew-cut-cr-lf)))) @@ -817,7 +804,7 @@ If no name can be extracted, FULL-NAME will be nil. It decodes non us-ascii characters in FULL-NAME encoded as encoded-words or invalid \"raw\" string. \"Raw\" non us-ascii characters are regarded as variable `default-mime-charset'." -;; (rotate-memo args-eword-extract-address-components (list string)) + (rotate-memo args-eword-extract-address-components (list string)) (let* ((structure (car (std11-parse-address (eword-lexical-analyze (std11-unfold-string string) 'must-unfold)))) diff --git a/lr-driver.el b/lr-driver.el index 7c14b19..b3de911 100644 --- a/lr-driver.el +++ b/lr-driver.el @@ -69,4 +69,4 @@ ;; Reduce by rule (- act) (t - (setq sp (funcall (aref reduction-table (- act)) stack sp goto-table))))))))) + (setq sp (funcall (aref reduction-table (- act)) stack sp goto-table (cdr input)))))))))) diff --git a/mmbuffer.el b/mmbuffer.el index 9bd59e3..5913265 100644 --- a/mmbuffer.el +++ b/mmbuffer.el @@ -153,7 +153,7 @@ (let ((the-buf (current-buffer)) (src-buf (mime-entity-buffer-internal entity)) (h-end (mime-entity-header-end-internal entity)) - beg p end field-name len field) + beg p end field-name len field-body decoded) (save-excursion (set-buffer src-buf) (goto-char (mime-entity-header-start-internal entity)) @@ -167,19 +167,21 @@ end (std11-field-end)) (when (mime-visible-field-p field-name visible-fields invisible-fields) - (setq field (intern (capitalize field-name))) (save-excursion (set-buffer the-buf) + (setq field-body (ew-lf-crlf-to-crlf + (save-excursion + (set-buffer src-buf) + (buffer-substring p end)))) + (setq decoded (ew-decode-field field-name field-body)) + (unless (equal field-body decoded) + (setq decoded (ew-crlf-refold + decoded + (1+ (string-width field-name)) + fill-column))) (insert field-name) (insert ":") - (insert (ew-crlf-to-lf - (ew-decode-field - field-name - (ew-lf-crlf-to-crlf - (save-excursion - (set-buffer src-buf) - (buffer-substring p end) - ))))) + (insert (ew-crlf-to-lf decoded)) (insert "\n") )))))))) -- 1.7.10.4