X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=eword-encode.el;h=6ca51165d23586d0955dab8ea3ac85624b869f04;hb=e767dd848231092ee8727a140f037420674278cd;hp=0436357b512622308d8c82e3fa16ff25321e69a2;hpb=9f47b42c4d3d8617de27537a90b8d851cbb85cae;p=elisp%2Fflim.git diff --git a/eword-encode.el b/eword-encode.el index 0436357..6ca5116 100644 --- a/eword-encode.el +++ b/eword-encode.el @@ -119,13 +119,15 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (let ((len (length string)) dest) (while (> len 0) - (let* ((chr (sref string 0)) + (let* ((chr (aref string 0)) + ;; (chr (sref string 0)) (charset (eword-encode-char-type chr)) (i 1) ;; (i (char-length chr)) ) (while (and (< i len) - (setq chr (sref string i)) + (setq chr (aref string i)) + ;; (setq chr (sref string i)) (eq charset (eword-encode-char-type chr))) (setq i (1+ i)) ;; (setq i (char-next-index chr i)) @@ -312,7 +314,8 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (str "") nstr) (while (and (< p len) (progn - (setq np (char-next-index (sref string p) p)) + (setq np (1+ p)) + ;;(setq np (char-next-index (sref string p) p)) (setq nstr (substring string 0 np)) (setq ret (tm-eword::encoded-word-length (cons nstr (cdr rword)) @@ -401,7 +404,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (append dest (list (let ((ret (ew-find-charset-rule - (find-non-ascii-charset-string str)))) + (find-charset-string str)))) (make-ew-rword str (car ret)(nth 1 ret) 'phrase) ) @@ -464,7 +467,8 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (if (or (eq pname 'spaces) (eq pname 'comment)) (nconc dest (list (list (cdr token) nil nil))) - (nconc (butlast dest) + (nconc (nreverse (cdr (reverse dest))) + ;; (butlast dest) (list (list (concat (car (car (last dest))) (cdr token)) @@ -575,10 +579,8 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is ;;; @ application interfaces ;;; -(defcustom eword-encode-default-start-column 10 - "Default start column if it is omitted." - :group 'eword-encode - :type 'integer) +(defvar eword-encode-default-start-column 10 + "Default start column if it is omitted.") (defun eword-encode-string (string &optional column mode) "Encode STRING as encoded-words, and return the result. @@ -688,7 +690,7 @@ It refer variable `eword-field-encoding-method-alist'." (setq bbeg (match-end 0) field-name (buffer-substring (match-beginning 0) (1- bbeg)) end (std11-field-end)) - (and (find-non-ascii-charset-region bbeg end) + (and (delq 'ascii (find-charset-region bbeg end)) (let ((method (eword-find-field-encoding-method (downcase field-name)))) (cond ((eq method 'mime)