From 578f4562dd88e9917acbe5e7b7d36647845c4dae Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 2 Jun 1999 15:12:13 +0000 Subject: [PATCH] * Sync up to flim-1_12_7 from flim-1_12_5. * mime-def.el (mime-library-product): Bump up to FLAM-DOODLE 1.12.6. --- ChangeLog | 260 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- DOODLE-VERSION | 2 +- FLIM-CFG | 8 +- Makefile | 6 +- README.en | 4 +- README.ja | 4 +- VERSION | 19 ++-- eword-decode.el | 8 +- eword-encode.el | 228 +++++++++++++++++++++++++----------------------- ftp.in | 6 +- mailcap.el | 13 ++- mel-b-ccl.el | 29 ++++--- mel-b-dl.el | 81 ++++++++--------- mel-b-el.el | 200 +++++++++++++++++++----------------------- mel-g.el | 60 ++++++------- mel-q-ccl.el | 36 ++++---- mel-q.el | 219 ++++++++++++++++++++++------------------------ mel-u.el | 55 +++++------- mel.el | 100 +++++++++------------ mime-def.el | 28 +++--- mime-en.sgml | 15 ++-- mime-en.texi | 15 ++-- mime-ja.sgml | 164 ++++++++++++++++++----------------- mime-parse.el | 4 +- mime.el | 6 +- smtp.el | 49 +++++++---- smtpmail.el | 19 +++- std11.el | 7 +- 28 files changed, 945 insertions(+), 700 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25b8337..e2b2395 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-06-02 Tanaka Akira + + * Sync up to flim-1_12_7 from flim-1_12_5. + + * mime-def.el (mime-library-product): Bump up to FLAM-DOODLE + 1.12.6. + 1999-05-26 Tanaka Akira * TESTPAT: Does not treat =?= as encoded-word. @@ -1407,6 +1414,250 @@ * eword-decode.el: Copied from AKEMI branch of SEMI. +1999-05-31 MORIOKA Tomohiko + + * FLIM: Version 1.12.7 (Y-Dþzaki)-A released. + +1999-05-31 MORIOKA Tomohiko + + * mime-en.sgml (Network representation of header): Translate. + +1999-05-27 Shuhei KOBAYASHI + + * mel-b-el.el (pack-sequence): Eliminate local variable `i'. + (base64-encode-1): Avoid concat. + (base64-encode-string): Fixed last change; extra padding. + +1999-05-26 MORIOKA Tomohiko + + * smtpmail.el (smtpmail-default-smtp-server): Define obsolete + variable alias for XEmacs. + (smtpmail-smtp-server): Likewise. + (smtpmail-smtp-service): Likewise. + (smtpmail-local-domain): Likewise. + (smtpmail-debug-info): Likewise. + (smtpmail-send-it): Check function `expand-mail-aliases' is + defined. + +1999-05-26 MORIOKA Tomohiko + + * smtp.el (smtp-debug-info): Now a user option. + +1999-05-25 Yoshiki Hayashi + + * README.ja: Modify URL and required version of APEL. + +1999-05-24 Tanaka Akira + + * mel-b-ccl.el (base64-encode-string): New alias. + (base64-encode-region): Ditto. + (base64-decode-string): Ditto. + (base64-decode-region): Ditto. + +1999-05-24 Tanaka Akira + + * mel-b-ccl.el, mel-q-ccl.el: Sync up with doodle-1.12.5. + +1999-05-24 MORIOKA Tomohiko + + * eword-encode.el (ew-space-process): Renamed from + `tm-eword::space-process'. + +1999-05-24 MORIOKA Tomohiko + + * eword-encode.el (tm-eword::space-process): Don't concatenate + `special's. + (ew-encode-rword-1): Renamed from `tm-eword::encode-string-1'; add + new optional argument `must-output'; return nil if it can't encode + literally. + (eword-encode-rword-list): Fold SPACE or TAB in the encoded string + if `ew-encode-rword-1' can't encode literally and it is possible + to encode the rest literally with the folding. + (eword-encode-phrase-to-rword-list): Add `special' flag to + brackets of comments. + +1999-05-22 Shuhei KOBAYASHI + + * smtpmail.el: Require 'poe and 'pcustom. + +1999-05-22 Shuhei KOBAYASHI + + * mel.el: Update header. + Require 'path-util and don't require 'poem. + (mel-use-module): Eliminate local variable `encoding'. + (mime-insert-encoded-file for mel-b-builtin): + Use built-in `interactive' spec. + (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'". + (mime-encode-region): Capitalize prompt string. + (mime-decode-region): Ditto. + (mime-insert-encoded-file): Ditto. + (mime-write-decoded-region): Ditto. + + * mel-b-ccl.el: Update header. + (base64-ccl-encode-region): Use read-only `interactive' spec. + (base64-ccl-decode-region): Ditto. + (base64-ccl-insert-encoded-file): Use built-in `interactive' spec. + (base64-ccl-write-decoded-region): Ditto. + (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'". + + * mel-b-dl.el: Update header. + Don't require 'poe; it is required implicitly via 'mime-def. + (base64-dl-handle): Chech whether `base64-dl-module' is string. + Defalias `base64-encode-string' and `base64-decode-string' just + after `dynamic-call'ing "emacs_base64_init". + (base64-encode-region): Use read-only `interactive' spec. + Use `base64-encode-string'. + Changed order of evaluation to "encode, delete, then insert". + (base64-decode-region): Renamed from `decode-base64-region'. + Use read-only `interactive' spec. + Use `base64-decode-string'. + Changed order of evaluation to "decode, delete, then insert". + (mime-encode-string): Use `base64-encode-string'. + (mime-decode-string): Use `base64-decode-string'. + (mime-decode-region): Use `base64-decode-region'. + (encoded-text-encode-string): Use `base64-encode-string'. + (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'". + (mime-insert-encoded-file): Use built-in `interactive' spec. + (mime-write-decoded-region in comment): Ditto. + + * mel-b-el.el: Update header. + Don't require 'poe; it is required implicitly via 'mime-def. + (pack-sequence): Moved to top of the function definitions. + (base64-encode-string): Calculate padding first. + (base64-internal-encode-region): Changed order of evaluation to + "encode, delete, then insert". + (base64-internal-decode-string): Changed order of evaluation to + "decode, delete, then insert". + (base64-encode-region): Use read-only `interactive' spec. + (base64-decode-region): Ditto. + (base64-decode-string): Not interactive. + (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'". + (base64-insert-encoded-file): Use built-in `interactive' spec. + (base64-write-decoded-region): Ditto. + + * mel-g.el: Update header. + Require 'mime-def instead of 'poem and 'mel. + (mime-insert-encoded-file): Use built-in `interactive' spec. + (mime-write-decoded-region): Ditto. + + * mel-q-ccl.el: Update header. + (quoted-printable-ccl-encode-region): + Use read-only `interactive' spec. + (quoted-printable-ccl-decode-region): Ditto. + (quoted-printable-ccl-insert-encoded-file): + Use built-in `interactive' spec. + (quoted-printable-ccl-write-decoded-region): Ditto. + (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'". + + * mel-q.el: Update header. + Require 'path-util instead of 'emu. + (quoted-printable-internal-encode-region): Rewrite without regexp. + (quoted-printable-internal-decode-region): Ditto. + (quoted-printable-encode-region): Use read-only `interactive' spec. + (quoted-printable-decode-region): Ditto. + (mime-insert-encoded-file): Use built-in `interactive' spec. + (mime-write-decoded-region): Ditto. + (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'". + + * mel-u.el: Update header. + Require 'path-util instead of 'emu. + (mime-insert-encoded-file): Use built-in `interactive' spec. + (mime-write-decoded-region): Ditto. + +1999-05-22 Shuhei KOBAYASHI + + * mime-def.el: Require 'poe, 'poem, and 'pcustom. + (mime): Declare `default-mime-charset' as an initial member. + + * mime-parse.el: Don't require 'cl at compile-time. + + * mailcap.el (mailcap-look-at-qchar): Use `char-after'. + + * std11.el: Require 'poe, 'poem, and 'pcustom. + + * smtp.el: Update header. + Require 'poe, 'poem, and 'pcustom. + Require 'cl at compile-time. + +1999-05-21 MORIOKA Tomohiko + + * README.en (Installation): Modify URL and required version of + APEL. + + * eword-encode.el (ew-find-charset-rule): Renamed from + `tm-eword::find-charset-rule'; use + `find-mime-charset-by-charsets'. + + +1999-05-11 MORIOKA Tomohiko + + * FLIM: Version 1.12.6 (Family-K-Dòenmae)-A released. + +1999-04-27 Shuhei KOBAYASHI + + * mel-b-ccl.el (TopLevel): Suppress warning. + mel-q-ccl.el (TopLevel): Ditto. + mime.el (TopLevel): Ditto. + +1999-04-26 Shuhei KOBAYASHI + + * eword-decode.el (eword-encoded-word-regexp): Accept "b" and "q" + for "encoding". + + * mime-def.el (std11-qtext-regexp): Don't use `string'. + (mime-tspecial-char-list): Eval at compile time. + +1999-04-22 Katsumi Yamaoka + + * mime.el: Delete autoload setting for `eword-encode-field'. + +1999-04-22 MORIOKA Tomohiko + + * eword-encode.el: Require `poem' instead of `emu'. + Don't use `cl' for `caar'. + +1999-04-09 Katsumi Yamaoka + + * smtp.el (smtp-via-smtp): Funcall `smtp-server' if it is a + function. + (smtp-server): Make it can also be a function called from + `smtp-via-smtp' with arguments SENDER and RECIPIENTS. + +1999-04-05 Shuhei KOBAYASHI + + * FLIM-CFG: Make easier to install in VERSION_SPECIFIC_LISPDIR. + +1999-03-29 Shuhei KOBAYASHI + + * mime.el (mime-read-field): Correct argument of + `mime-decode-field-body'; 'native -> 'plain. + +1999-03-27 Shuhei KOBAYASHI + + * eword-encode.el (TopLevel): Require 'cl when compiling. + (eword-encode-rword-list): Suppress insertion of extra spaces. + (eword-encode-msg-id-to-rword-list): Treat surrounding angle + brackets atomically. + ([tm-ja:4244] by Kazuhiro Ohta ) + +1999-03-11 MORIOKA Tomohiko + + * eword-encode.el (eword-charset-encoding-alist): Add `tis-620'. + +1999-03-01 MORIOKA Tomohiko + + * mel.el (mime-decode-string): Return STRING if return value of + `(mel-find-function 'mime-decode-string encoding)' is nil. + +1999-02-10 MORIOKA Tomohiko + + * mime-def.el (mel-define-service): Change size of obarray to 7. + +1999-02-01 Yoshiki Hayashi + + * mime-ja.sgml: Tranlate all untranslated parts. + + 1999-01-27 MORIOKA Tomohiko * FLIM: Version 1.12.5 (Hirahata) released. @@ -1768,7 +2019,7 @@ 1998-11-12 Tanaka Akira - * mel-q-ccl.el (mel-ccl-encode-quoted-printable-generic): workaround + * mel-q-ccl.el (mel-ccl-encode-quoted-printable-generic): workaround for mule-2.3@19.34. 1998-11-12 Tanaka Akira @@ -2290,7 +2541,7 @@ * Move variable `mel-encoding-module-alist' from mel.el to mime-def.el. - + * mel.el (mel-find-function): Use function `mel-find-function-from-obarray'. Use `mel-define-backend' to define "7bit", "8bit" and "binary"; @@ -2459,7 +2710,7 @@ (mime-insert-encoded-file): Use `mel-define-method'; abolish `base64-insert-encoded-file'. (mime-write-decoded-region): Use `mel-define-method'; abolish - `base64-write-decoded-region'. + `base64-write-decoded-region'. - Move `base64-encoded-length' to mel.el. * mel-dl.el (base64-encode-region): Define directly (abolish @@ -3495,7 +3746,7 @@ * eword-decode.el (eword-decode-ignored-field-list): Add `received'. - + * mel.el (mime-temp-directory): Use TMPDIR, TMP, or TEMP environment variables. @@ -3545,4 +3796,3 @@ eword-encode.el: Copied from MEL, SEMI (mime-def.el eword-decode.el eword-encode.el) and APEL (std11-parse.el std11.el). -> diff --git a/DOODLE-VERSION b/DOODLE-VERSION index 7a3d829..235418b 100644 --- a/DOODLE-VERSION +++ b/DOODLE-VERSION @@ -31,7 +31,7 @@ Order is not significant. 25 $B>GCc(B $B$3$2$A$c(B 10R3.0/2.0 FLAM-DOODLE 1.12.3 26 $B7*Hi(B $B$/$j$+$O(B 10R3.0/4.0 FLAM-DOODLE 1.12.4 27 $BFP(B $B$H$S(B 10R4.0/7.0 FLAM-DOODLE 1.12.5 - 28 $B3w(B $B$+$P(B 10R4.0/5.0 + 28 $B3w(B $B$+$P(B 10R4.0/5.0 FLAM-DOODLE 1.12.6 29 $B2+H'@w(B $B$3$&$m$;$s(B 2.5Y5.0/4.0 30 $BCz;RCc(B $B$A$g$&$8$A$c(B 5.0YR4.0/4.0 31 $Bl=j$X$NF3F~(B diff --git a/VERSION b/VERSION index 2f8d3f3..a4dbc84 100644 --- a/VERSION +++ b/VERSION @@ -36,14 +36,23 @@ ;; Kinki Nippon Railway $(B6a5&F|K\E4F;(B http://www.kintetsu.co.jp/ ;; Ky-Dòto-A Line $(B3`86@~(B ;;------------------------------------------------------------------------- - (Saidaiji) ($(B@>Bg;{(B) ; $(B!{J?>k5\@W!"@>Bg;{(B -1.12.0 Amagatsuji $(BFt%vDT(B ; $(B!{?b?NE79DNM(B -1.12.1 Nishinoky-Dò-A $(B@>$N5~(B ; $(B!{Eb>7Ds;{!"Lt;U;{(B + (Saidaiji) ($(B@>Bg;{(B) +1.12.0 Amagatsuji $(BFt%vDT(B +1.12.1 Nishinoky-Dò-A $(B@>$N5~(B 1.12.2 Kuj-Dò-A $(B6e>r(B -1.12.3 Kintetsu-K-Dòriyama-A $(B6aE474;3(B ; $(B!{74;3>k@W!"(B - ; $(B%"%Z%k!"%]! $(B6aE4(B $(B@>ED86K\(B +------ Kasanui $(B3^K%(B +------ Ninokuchi $(B?7%N8}(B +------ Yagi $(BH,LZ(B ; = $(B6aE4(B $(BBg:e@~(B +------ Yagi-Nishiguchi $(BH,LZ@>8}(B +------ Unebigory-Dòmae-A $(B@&K58fNMA0(B +------ Kashiharajingu-mae $(B3`86?@5\A0(B ; = $(B6aE4(B $(BFnBg:e@~!"5HLn@~(B [Chao Version names] diff --git a/eword-decode.el b/eword-decode.el index 25635fd..87c9aed 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -32,14 +32,14 @@ ;;; Code: -(require 'std11) -(require 'mel) (require 'mime-def) +(require 'mel) +(require 'std11) (require 'ew-dec) (require 'ew-line) -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl)) ; list*, pop (defgroup eword-decode nil "Encoded-word decoding" @@ -65,7 +65,7 @@ mime-charset-regexp "\\)" (regexp-quote "?") - "\\(B\\|Q\\)" + "\\([BbQq]\\)" (regexp-quote "?") "\\(" eword-encoded-text-regexp diff --git a/eword-encode.el b/eword-encode.el index a04db3e..f4976c5 100644 --- a/eword-encode.el +++ b/eword-encode.el @@ -24,10 +24,9 @@ ;;; Code: -(require 'emu) +(require 'mime-def) (require 'mel) (require 'std11) -(require 'mime-def) (require 'eword-decode) @@ -83,6 +82,7 @@ If method is nil, this field will not be encoded." (cn-gb . "B") (cn-gb-2312 . "B") (euc-kr . "B") + (tis-620 . "B") (iso-2022-jp-2 . "B") (iso-2022-int-1 . "B") (utf-8 . "B") @@ -183,30 +183,31 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (defmacro ew-rword-type (rword) (` (car (cdr (cdr (cdr (, rword))))))) -(defun tm-eword::find-charset-rule (charsets) +(defun ew-find-charset-rule (charsets) (if charsets - (let* ((charset (charsets-to-mime-charset charsets)) - (encoding (cdr (assq charset eword-charset-encoding-alist))) - ) + (let* ((charset (find-mime-charset-by-charsets charsets)) + (encoding (cdr (or (assq charset eword-charset-encoding-alist) + '(nil . "Q"))))) (list charset encoding) ))) (defun tm-eword::words-to-ruled-words (wl &optional mode) (mapcar (function (lambda (word) - (let ((ret (tm-eword::find-charset-rule (car word)))) + (let ((ret (ew-find-charset-rule (car word)))) (make-ew-rword (cdr word) (car ret)(nth 1 ret) mode) ))) wl)) -(defun tm-eword::space-process (seq) +(defun ew-space-process (seq) (let (prev a ac b c cc) (while seq (setq b (car seq)) (setq seq (cdr seq)) (setq c (car seq)) (setq cc (ew-rword-charset c)) - (if (null (ew-rword-charset b)) + (if (and (null (ew-rword-charset b)) + (not (eq (ew-rword-type b) 'special))) (progn (setq a (car prev)) (setq ac (ew-rword-charset a)) @@ -235,7 +236,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is )) (defun eword-encode-split-string (str &optional mode) - (tm-eword::space-process + (ew-space-process (tm-eword::words-to-ruled-words (eword-encode-charset-words-to-words (eword-encode-divide-into-charset-words str)) @@ -267,71 +268,82 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is ;;; @ encode-string ;;; -(defun tm-eword::encode-string-1 (column rwl) - (let* ((rword (car rwl)) - (ret (tm-eword::encoded-word-length rword)) - string len) - (if (null ret) - (cond ((and (setq string (car rword)) - (or (<= (setq len (+ (length string) column)) 76) - (<= column 1)) +(defun ew-encode-rword-1 (column rwl &optional must-output) + (catch 'can-not-output + (let* ((rword (car rwl)) + (ret (tm-eword::encoded-word-length rword)) + string len) + (if (null ret) + (cond ((and (setq string (car rword)) + (or (<= (setq len (+ (length string) column)) 76) + (<= column 1)) + ) + (setq rwl (cdr rwl)) + ) + ((memq (aref string 0) '(? ?\t)) + (setq string (concat "\n" string) + len (length string) + rwl (cdr rwl)) + ) + (must-output + (setq string "\n " + len 1) + ) + (t + (throw 'can-not-output nil) + )) + (cond ((and (setq len (car ret)) + (<= (+ column len) 76) ) + (setq string + (eword-encode-text + (ew-rword-charset rword) + (ew-rword-encoding rword) + (cdr ret) + (ew-rword-type rword) + )) + (setq len (+ (length string) column)) (setq rwl (cdr rwl)) ) (t - (setq string "\n ") - (setq len 1) - )) - (cond ((and (setq len (car ret)) - (<= (+ column len) 76) - ) - (setq string - (eword-encode-text - (ew-rword-charset rword) - (ew-rword-encoding rword) - (cdr ret) - (ew-rword-type rword) - )) - (setq len (+ (length string) column)) - (setq rwl (cdr rwl)) - ) - (t - (setq string (car rword)) - (let* ((p 0) np - (str "") nstr) - (while (and (< p len) - (progn - (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)) - )) - (setq nstr (cdr ret)) - (setq len (+ (car ret) column)) - (<= len 76) - )) - (setq str nstr - p np)) - (if (string-equal str "") - (setq string "\n " - len 1) - (setq rwl (cons (cons (substring string p) (cdr rword)) - (cdr rwl))) - (setq string - (eword-encode-text - (ew-rword-charset rword) - (ew-rword-encoding rword) - str - (ew-rword-type rword))) - (setq len (+ (length string) column)) - ) - ))) - ) - (list string len rwl) - )) + (setq string (car rword)) + (let* ((p 0) np + (str "") nstr) + (while (and (< p len) + (progn + (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)) + )) + (setq nstr (cdr ret)) + (setq len (+ (car ret) column)) + (<= len 76) + )) + (setq str nstr + p np)) + (if (string-equal str "") + (if must-output + (setq string "\n " + len 1) + (throw 'can-not-output nil)) + (setq rwl (cons (cons (substring string p) (cdr rword)) + (cdr rwl))) + (setq string + (eword-encode-text + (ew-rword-charset rword) + (ew-rword-encoding rword) + str + (ew-rword-type rword))) + (setq len (+ (length string) column)) + ) + ))) + ) + (list string len rwl) + ))) (defun eword-encode-rword-list (column rwl) - (let (ret dest ps special str ew-f pew-f) + (let (ret dest str ew-f pew-f folded-points) (while rwl (setq ew-f (nth 2 (car rwl))) (if (and pew-f ew-f) @@ -339,40 +351,34 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is pew-f nil) (setq pew-f ew-f) ) - (setq ret (tm-eword::encode-string-1 column rwl)) + (if (null (setq ret (ew-encode-rword-1 column rwl))) + (let ((i (1- (length dest))) + c s r-dest r-column) + (catch 'success + (while (catch 'found + (while (>= i 0) + (cond ((memq (setq c (aref dest i)) '(? ?\t)) + (if (memq i folded-points) + (throw 'found nil) + (setq folded-points (cons i folded-points)) + (throw 'found i)) + ) + ((eq c ?\n) + (throw 'found nil) + )) + (setq i (1- i)))) + (setq s (substring dest i) + r-column (length s) + r-dest (concat (substring dest 0 i) "\n" s)) + (when (setq ret (ew-encode-rword-1 r-column rwl)) + (setq dest r-dest + column r-column) + (throw 'success t) + )) + (setq ret (ew-encode-rword-1 column rwl 'must-output)) + ))) (setq str (car ret)) - (if (eq (elt str 0) ?\n) - (if (eq special ?\() - (progn - (setq dest (concat dest "\n (")) - (setq ret (tm-eword::encode-string-1 2 rwl)) - (setq str (car ret)) - )) - (cond ((eq special ? ) - (if (string= str "(") - (setq ps t) - (setq dest (concat dest " ")) - (setq ps nil) - )) - ((eq special ?\() - (if ps - (progn - (setq dest (concat dest " (")) - (setq ps nil) - ) - (setq dest (concat dest "(")) - ) - ))) - (cond ((string= str " ") - (setq special ? ) - ) - ((string= str "(") - (setq special ?\() - ) - (t - (setq special nil) - (setq dest (concat dest str)) - )) + (setq dest (concat dest str)) (setq column (nth 1 ret) rwl (nth 2 ret)) ) @@ -393,7 +399,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (setq dest (append dest (list - (let ((ret (tm-eword::find-charset-rule + (let ((ret (ew-find-charset-rule (find-non-ascii-charset-string str)))) (make-ew-rword str (car ret)(nth 1 ret) 'phrase) @@ -403,13 +409,13 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is ((eq type 'comment) (setq dest (append dest - '(("(" nil nil)) + '(("(" nil nil special)) (tm-eword::words-to-ruled-words (eword-encode-charset-words-to-words (eword-encode-divide-into-charset-words (cdr token))) 'comment) - '((")" nil nil)) + '((")" nil nil special)) )) ) (t @@ -423,7 +429,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is )) (setq phrase (cdr phrase)) ) - (tm-eword::space-process dest) + (ew-space-process dest) )) (defun eword-encode-addr-seq-to-rword-list (seq) @@ -524,10 +530,12 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is dest)) (defsubst eword-encode-msg-id-to-rword-list (msg-id) - (cons '(" " nil nil) - (cons '("<" nil nil) - (nconc (eword-encode-addr-seq-to-rword-list (cdr msg-id)) - '((">" nil nil)))))) + (list + (list + (concat "<" + (caar (eword-encode-addr-seq-to-rword-list (cdr msg-id))) + ">") + nil nil))) (defsubst eword-encode-in-reply-to-to-rword-list (in-reply-to) (let (dest) diff --git a/ftp.in b/ftp.in index e79cb27..0949088 100644 --- a/ftp.in +++ b/ftp.in @@ -2,12 +2,12 @@ It is available from - ftp://ftp.jaist.ac.jp/pub/GNU/elisp/flim/flim-API + ftp://ftp.etl.go.jp/pub/mule/flim/flim-API --[[message/external-body; access-type=anon-ftp; - site="ftp.jaist.ac.jp"; - directory="/pub/GNU/elisp/flim/flim-API"; + site="ftp.etl.go.jp"; + directory="/pub/mule/flim/flim-API"; name="flim-VERSION.tar.gz"; mode=image]] Content-Type: application/octet-stream; diff --git a/mailcap.el b/mailcap.el index 12eee88..b3b7d90 100644 --- a/mailcap.el +++ b/mailcap.el @@ -95,18 +95,17 @@ (forward-char))))) (defsubst mailcap-look-at-qchar () - (let ((chr (char-after (point)))) - (when (eq chr ?\\) - (forward-char 2) - (char-before (point)) - ))) + (when (eq (char-after (point)) ?\\) + (prog2 + (forward-char) + (char-after (point)) + (forward-char)))) (defsubst mailcap-look-at-mtext () (let ((beg (point))) (while (or (mailcap-look-at-qchar) (mailcap-look-at-schar))) - (buffer-substring beg (point)) - )) + (buffer-substring beg (point)))) ;;; @ field diff --git a/mel-b-ccl.el b/mel-b-ccl.el index c47e00f..e0426b8 100644 --- a/mel-b-ccl.el +++ b/mel-b-ccl.el @@ -1,4 +1,4 @@ -;;; mel-b-ccl.el: CCL based encoder/decoder of Base64 +;;; mel-b-ccl.el --- Base64 encoder/decoder using CCL. ;; Copyright (C) 1998 Tanaka Akira @@ -19,7 +19,7 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. @@ -105,6 +105,10 @@ abcdefghijklmnopqrstuvwxyz\ (logand v (lsh 255 8)) (lsh (logand v 255) 16))) +) + +(eval-when-compile + (defconst mel-ccl-decode-b-0-table (vconcat (mapcar @@ -402,17 +406,19 @@ abcdefghijklmnopqrstuvwxyz\ (if no-line-break (decode-coding-string string 'mel-ccl-b-rev) (decode-coding-string string 'mel-ccl-base64-lf-rev))) + (defalias-maybe 'base64-encode-string 'base64-ccl-encode-string) (defun base64-ccl-encode-region (start end &optional no-line-break) "Encode region from START to END with base64 encoding." - (interactive "r") + (interactive "*r") (if no-line-break (decode-coding-region start end 'mel-ccl-b-rev) (decode-coding-region start end 'mel-ccl-base64-lf-rev))) + (defalias-maybe 'base64-encode-region 'base64-ccl-encode-region) (defun base64-ccl-insert-encoded-file (filename) "Encode contents of file FILENAME to base64, and insert the result." - (interactive (list (read-file-name "Insert encoded file: "))) + (interactive "*fInsert encoded file: ") (insert-file-contents-as-coding-system 'mel-ccl-base64-lf-rev filename)) (mel-define-method-function (mime-encode-string string (nil "base64")) @@ -430,17 +436,17 @@ abcdefghijklmnopqrstuvwxyz\ (defun base64-ccl-decode-string (string) "Decode base64 encoded STRING" (encode-coding-string string 'mel-ccl-b-rev)) +(defalias-maybe 'base64-decode-string 'base64-ccl-decode-string) (defun base64-ccl-decode-region (start end) "Decode base64 encoded the region from START to END." - (interactive "r") + (interactive "*r") (encode-coding-region start end 'mel-ccl-b-rev)) +(defalias-maybe 'base64-decode-region 'base64-ccl-decode-region) (defun base64-ccl-write-decoded-region (start end filename) "Decode the region from START to END and write out to FILENAME." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) + (interactive "*r\nFWrite decoded region to file: ") (write-region-as-coding-system 'mel-ccl-b-rev start end filename)) (mel-define-method-function (mime-decode-string string (nil "base64")) @@ -452,8 +458,9 @@ abcdefghijklmnopqrstuvwxyz\ 'base64-ccl-write-decoded-region) (mel-define-method encoded-text-decode-string (string (nil "B")) - (if (and (string-match B-encoded-text-regexp string) - (string= string (match-string 0 string))) + (if (string-match (eval-when-compile + (concat "\\`" B-encoded-text-regexp "\\'")) + string) (base64-ccl-decode-string string) (error "Invalid encoded-text %s" string))) @@ -463,4 +470,4 @@ abcdefghijklmnopqrstuvwxyz\ (provide 'mel-b-ccl) -;;; mel-b-ccl.el ends here +;;; mel-b-ccl.el ends here. diff --git a/mel-b-dl.el b/mel-b-dl.el index 411fa74..59bff29 100644 --- a/mel-b-dl.el +++ b/mel-b-dl.el @@ -1,11 +1,11 @@ -;;; mel-b-dl.el: Base64 encoder/decoder using DL module +;;; mel-b-dl.el --- Base64 encoder/decoder using DL module. ;; Copyright (C) 1998 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Keywords: MIME, Base64 -;; This file is part of MEL (MIME Encoding Library). +;; This file is part of FLIM (Faithful Library about Internet Message). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -18,66 +18,66 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: -(require 'poe) (require 'mime-def) (eval-and-compile (defvar base64-dl-handle - (and (file-exists-p base64-dl-module) + (and (stringp base64-dl-module) + (file-exists-p base64-dl-module) (dynamic-link base64-dl-module))) (dynamic-call "emacs_base64_init" base64-dl-handle) ) +;; base64-dl-module provides `encode-base64-string' and `decode-base64-string'. +(defalias 'base64-encode-string 'encode-base64-string) +(defalias 'base64-decode-string 'decode-base64-string) + (defun base64-encode-region (start end) "Encode current region by base64. START and END are buffer positions." - (interactive "r") - (let ((str (buffer-substring start end))) - (delete-region start end) - (insert (encode-base64-string str)) - ) - (or (bolp) - (insert "\n")) - ) - -(defun decode-base64-region (start end) + (interactive "*r") + (insert + (prog1 + (base64-encode-string + (buffer-substring start end)) + (delete-region start end))) + (or (bolp) (insert ?\n))) + +(defun base64-decode-region (start end) "Decode current region by base64. START and END are buffer positions." - (interactive "r") - (let ((str (buffer-substring start end))) - (delete-region start end) - (condition-case err - (insert (decode-base64-string str)) - (error (message (nth 1 err))) - ))) - -(defalias 'base64-encode-string 'encode-base64-string) -(defalias 'base64-decode-string 'decode-base64-string) + (interactive "*r") + (insert + (prog1 + (base64-decode-string + (buffer-substring start end)) + (delete-region start end)))) (mel-define-method-function (mime-encode-string string (nil "base64")) - 'encode-base64-string) + 'base64-encode-string) (mel-define-method-function (mime-decode-string string (nil "base64")) - 'decode-base64-string) + 'base64-decode-string) (mel-define-method-function (mime-encode-region start end (nil "base64")) 'base64-encode-region) (mel-define-method-function (mime-decode-region start end (nil "base64")) - 'decode-base64-region) + 'base64-decode-region) (mel-define-method-function (encoded-text-encode-string string (nil "B")) - 'encode-base64-string) + 'base64-encode-string) (mel-define-method encoded-text-decode-string (string (nil "B")) - (if (and (string-match B-encoded-text-regexp string) - (string= string (match-string 0 string))) - (decode-base64-string string) + (if (string-match (eval-when-compile + (concat "\\`" B-encoded-text-regexp "\\'")) + string) + (base64-decode-string string) (error "Invalid encoded-text %s" string))) @@ -89,28 +89,23 @@ START and END are buffer positions." It calls external base64 encoder specified by `base64-external-encoder'. So you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive (list (read-file-name "Insert encoded file: "))) - (insert (encode-base64-string + (interactive "*fInsert encoded file: ") + (insert (base64-encode-string (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-as-binary filename) (buffer-string)))) - (or (bolp) - (insert "\n")) - ) + (or (bolp) (insert ?\n))) ;; (mel-define-method mime-write-decoded-region (start end filename ;; (nil "base64")) ;; "Decode and write current region encoded by base64 into FILENAME. ;; START and END are buffer positions." -;; (interactive -;; (list (region-beginning) (region-end) -;; (read-file-name "Write decoded region to file: "))) +;; (interactive "*r\nFWrite decoded region to file: ") ;; (let ((str (buffer-substring start end))) ;; (with-temp-buffer -;; (insert (decode-base64-string str)) -;; (write-region-as-binary (point-min) (point-max) filename) -;; ))) +;; (insert (base64-decode-string str)) +;; (write-region-as-binary (point-min)(point-max) filename)))) ;;; @ end diff --git a/mel-b-el.el b/mel-b-el.el index 7426cc5..076f2f6 100644 --- a/mel-b-el.el +++ b/mel-b-el.el @@ -1,13 +1,13 @@ -;;; mel-b-el.el: Base64 encoder/decoder for GNU Emacs +;;; mel-b-el.el --- Base64 encoder/decoder. ;; Copyright (C) 1992,1995,1996,1997,1998 Free Software Foundation, Inc. ;; Author: ENAMI Tsugutomo -;; MORIOKA Tomohiko +;; MORIOKA Tomohiko ;; Created: 1995/6/24 ;; Keywords: MIME, Base64 -;; This file is part of MEL (MIME Encoding Library). +;; This file is part of FLIM (Faithful Library about Internet Message). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -20,13 +20,12 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: -(require 'poe) (require 'mime-def) @@ -72,6 +71,26 @@ external decoder is called." (integer :tag "Size"))) +;;; @ utility function +;;; + +(defun pack-sequence (seq size) + "Split sequence SEQ into SIZE elements packs, and return list of packs. +\[mel-b-el; tl-seq function]" + (let ((len (length seq)) + (p 0) + dest unit) + (while (< p len) + (setq unit (cons (elt seq p) unit)) + (setq p (1+ p)) + (when (zerop (mod p size)) + (setq dest (cons (nreverse unit) dest)) + (setq unit nil))) + (if unit + (nreverse (cons (nreverse unit) dest)) + (nreverse dest)))) + + ;;; @ internal base64 encoder ;;; based on base64 decoder by Enami Tsugutomo @@ -84,33 +103,31 @@ external decoder is called." `(aref base64-characters ,n)) (defun base64-encode-1 (pack) - (let ((a (car pack)) - (b (nth 1 pack)) - (c (nth 2 pack))) - (concat - (char-to-string (base64-num-to-char (ash a -2))) - (if b - (concat - (char-to-string - (base64-num-to-char (logior (ash (logand a 3) 4) (ash b -4)))) - (if c - (concat - (char-to-string - (base64-num-to-char (logior (ash (logand b 15) 2) (ash c -6)))) - (char-to-string (base64-num-to-char (logand c 63))) - ) - (concat (char-to-string - (base64-num-to-char (ash (logand b 15) 2))) "=") - )) - (concat (char-to-string - (base64-num-to-char (ash (logand a 3) 4))) "==") - )))) + (let ((buf (make-string 4 ?=))) + (aset buf 0 (base64-num-to-char (ash (car pack) -2))) + (if (nth 1 pack) + (progn + (aset buf 1 (base64-num-to-char + (logior (ash (logand (car pack) 3) 4) + (ash (nth 1 pack) -4)))) + (if (nth 2 pack) + (progn + (aset buf 2 (base64-num-to-char + (logior (ash (logand (nth 1 pack) 15) 2) + (ash (nth 2 pack) -6)))) + (aset buf 3 (base64-num-to-char + (logand (nth 2 pack) 63)))) + (aset buf 2 (base64-num-to-char + (ash (logand (nth 1 pack) 15) 2))))) + (aset buf 1 (base64-num-to-char + (ash (logand (car pack) 3) 4)))) + buf)) (defun-maybe base64-encode-string (string) "Encode STRING to base64, and return the result." - (let ((len (length string)) - (b 0)(e 57) - dest) + (let* ((len (length string)) + (b 0)(e 57) + (dest "")) (while (< e len) (setq dest (concat dest @@ -120,32 +137,23 @@ external decoder is called." "") "\n")) (setq b e - e (+ e 57) - ) - ) - (let* ((es (mapconcat - (function base64-encode-1) - (pack-sequence (substring string b) 3) - "")) - (m (mod (length es) 4)) - ) - (concat dest es (cond ((= m 3) "=") - ((= m 2) "==") - )) - ))) + e (+ e 57))) + (concat dest + (mapconcat + (function base64-encode-1) + (pack-sequence (substring string b) 3) + "")))) (defun base64-internal-encode-region (beg end) (save-excursion (save-restriction (narrow-to-region beg end) - (let ((str (buffer-substring beg end))) - (delete-region beg end) - (insert (base64-encode-string str)) - ) - (or (bolp) - (insert "\n") - ) - ))) + (insert + (prog1 + (base64-encode-string + (buffer-substring beg end)) + (delete-region beg end))) + (or (bolp) (insert ?\n))))) ;;; @ internal base64 decoder @@ -166,8 +174,7 @@ external decoder is called." (defsubst base64-internal-decode (string buffer) (let* ((len (length string)) - (i 0) - (j 0) + (i 0)(j 0) v1 v2 v3) (catch 'tag (while (< i len) @@ -187,12 +194,9 @@ external decoder is called." (if v4 (aset buffer (prog1 j (setq j (1+ j))) (logior (lsh (logand v3 3) 6) v4)) - (throw 'tag nil) - )) - (throw 'tag nil) - )))) - (substring buffer 0 j) - )) + (throw 'tag nil))) + (throw 'tag nil))))) + (substring buffer 0 j))) (defun base64-internal-decode-string (string) (base64-internal-decode string (make-string (length string) 0))) @@ -204,9 +208,10 @@ external decoder is called." (defun base64-internal-decode-region (beg end) (save-excursion (let ((str (string-as-unibyte (buffer-substring beg end)))) - (delete-region beg end) - (goto-char beg) - (insert (base64-internal-decode str str))))) + (insert + (prog1 + (base64-internal-decode str str) + (delete-region beg end)))))) ;; (defun base64-internal-decode-region2 (beg end) ;; (save-excursion @@ -233,30 +238,30 @@ external decoder is called." (as-binary-process (apply (function call-process-region) beg end (car base64-external-encoder) - t t nil (cdr base64-external-encoder))) + t t nil + (cdr base64-external-encoder))) ;; for OS/2 ;; regularize line break code (goto-char (point-min)) (while (re-search-forward "\r$" nil t) - (replace-match "")) - ))) + (replace-match ""))))) (defun base64-external-decode-region (beg end) (save-excursion (as-binary-process (apply (function call-process-region) beg end (car base64-external-decoder) - t t nil (cdr base64-external-decoder))) - )) + t t nil + (cdr base64-external-decoder))))) (defun base64-external-decode-string (string) (with-temp-buffer (insert string) (as-binary-process (apply (function call-process-region) - (point-min) (point-max) - (car base64-external-decoder) - t t nil (cdr base64-external-decoder))) + (point-min)(point-max) (car base64-external-decoder) + t t nil + (cdr base64-external-decoder))) (buffer-string))) @@ -271,7 +276,7 @@ smaller than `base64-internal-encoding-limit', otherwise it calls external base64 encoder specified by `base64-external-encoder'. In this case, you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive "r") + (interactive "*r") (if (and base64-internal-encoding-limit (> (- end start) base64-internal-encoding-limit)) (base64-external-encode-region start end) @@ -285,7 +290,7 @@ smaller than `base64-internal-decoding-limit', otherwise it calls external base64 decoder specified by `base64-external-decoder'. In this case, you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive "r") + (interactive "*r") (if (and base64-internal-decoding-limit (> (- end start) base64-internal-decoding-limit)) (base64-external-decode-region start end) @@ -298,7 +303,6 @@ smaller than `base64-internal-decoding-limit', otherwise it calls external base64 decoder specified by `base64-external-decoder'. In this case, you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive "r") (if (and base64-internal-decoding-limit (> (length string) base64-internal-decoding-limit)) (base64-external-decode-string string) @@ -318,8 +322,9 @@ metamail or XEmacs package)." 'base64-encode-string) (mel-define-method encoded-text-decode-string (string (nil "B")) - (if (and (string-match B-encoded-text-regexp string) - (string= string (match-string 0 string))) + (if (string-match (eval-when-compile + (concat "\\`" B-encoded-text-regexp "\\'")) + string) (base64-decode-string string) (error "Invalid encoded-text %s" string))) @@ -328,21 +333,21 @@ metamail or XEmacs package)." It calls external base64 encoder specified by `base64-external-encoder'. So you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive (list (read-file-name "Insert encoded file: "))) + (interactive "*fInsert encoded file: ") (if (and base64-internal-encoding-limit (> (nth 7 (file-attributes filename)) base64-internal-encoding-limit)) - (apply (function call-process) (car base64-external-encoder) - filename t nil (cdr base64-external-encoder)) + (apply (function call-process) + (car base64-external-encoder) + filename t nil + (cdr base64-external-encoder)) (insert (base64-encode-string (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-as-binary filename) (buffer-string)))) - (or (bolp) - (insert "\n")) - )) + (or (bolp) (insert ?\n)))) (mel-define-method-function (mime-insert-encoded-file filename (nil "base64")) 'base64-insert-encoded-file) @@ -350,9 +355,7 @@ mmencode included in metamail or XEmacs package)." (defun base64-write-decoded-region (start end filename) "Decode and write current region encoded by base64 into FILENAME. START and END are buffer positions." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) + (interactive "*r\nFWrite decoded region to file: ") (if (and base64-internal-decoding-limit (> (- end start) base64-internal-decoding-limit)) (as-binary-process @@ -365,42 +368,13 @@ START and END are buffer positions." (let ((str (buffer-substring start end))) (with-temp-buffer (insert (base64-internal-decode-string str)) - (write-region-as-binary (point-min) (point-max) filename) - )))) + (write-region-as-binary (point-min) (point-max) filename))))) (mel-define-method-function (mime-write-decoded-region start end filename (nil "base64")) 'base64-write-decoded-region) -;;; @ etc -;;; - -(defun pack-sequence (seq size) - "Split sequence SEQ into SIZE elements packs, -and return list of packs. [mel-b-el; tl-seq function]" - (let ((len (length seq)) (p 0) obj - unit (i 0) - dest) - (while (< p len) - (setq obj (elt seq p)) - (setq unit (cons obj unit)) - (setq i (1+ i)) - (if (= i size) - (progn - (setq dest (cons (reverse unit) dest)) - (setq unit nil) - (setq i 0) - )) - (setq p (1+ p)) - ) - (if unit - (setq dest (cons (reverse unit) dest)) - ) - (reverse dest) - )) - - ;;; @ end ;;; diff --git a/mel-g.el b/mel-g.el index 8be016c..c0f3577 100644 --- a/mel-g.el +++ b/mel-g.el @@ -1,15 +1,14 @@ -;;; mel-g.el: Gzip64 encoder/decoder for GNU Emacs +;;; mel-g.el --- Gzip64 encoder/decoder. ;; Copyright (C) 1995,1996,1997,1998 MORIOKA Tomohiko -;; Copyright (C) 1996,1997 Shuhei KOBAYASHI +;; Copyright (C) 1996,1997,1999 Shuhei KOBAYASHI -;; Author: Shuhei KOBAYASHI -;; modified by MORIOKA Tomohiko -;; Maintainer: Shuhei KOBAYASHI +;; Author: Shuhei KOBAYASHI +;; MORIOKA Tomohiko ;; Created: 1995/10/25 ;; Keywords: Gzip64, base64, gzip, MIME -;; This file is part of MEL (MIME Encoding Library). +;; This file is part of FLIM (Faithful Library about Internet Message). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -22,7 +21,7 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. @@ -33,9 +32,8 @@ ;;; Code: -(require 'poem) +(require 'mime-def) (require 'path-util) -(require 'mel) ;;; @ variables @@ -44,15 +42,13 @@ (defvar gzip64-external-encoder (let ((file (exec-installed-p "mmencode"))) (and file - (` ("sh" "-c" (, (concat "gzip -c | " file)))) - )) + (` ("sh" "-c" (, (concat "gzip -c | " file)))))) "*list of gzip64 encoder program name and its arguments.") (defvar gzip64-external-decoder (let ((file (exec-installed-p "mmencode"))) (and file - (` ("sh" "-c" (, (concat file " -u | gzip -dc")))) - )) + (` ("sh" "-c" (, (concat file " -u | gzip -dc")))))) "*list of gzip64 decoder program name and its arguments.") @@ -62,26 +58,25 @@ (defun gzip64-external-encode-region (beg end) (interactive "*r") (save-excursion - (as-binary-process (apply (function call-process-region) - beg end (car gzip64-external-encoder) - t t nil (cdr gzip64-external-encoder)) - ) + (as-binary-process + (apply (function call-process-region) + beg end (car gzip64-external-encoder) + t t nil + (cdr gzip64-external-encoder))) ;; for OS/2 ;; regularize line break code (goto-char (point-min)) (while (re-search-forward "\r$" nil t) - (replace-match "") - ) - )) + (replace-match "")))) (defun gzip64-external-decode-region (beg end) (interactive "*r") (save-excursion - (as-binary-process (apply (function call-process-region) - beg end (car gzip64-external-decoder) - t t nil (cdr gzip64-external-decoder)) - ) - )) + (as-binary-process + (apply (function call-process-region) + beg end (car gzip64-external-decoder) + t t nil + (cdr gzip64-external-decoder))))) (mel-define-method-function (mime-encode-region start end (nil "x-gzip64")) 'gzip64-external-encode-region) @@ -109,27 +104,24 @@ ;;; (mel-define-method mime-insert-encoded-file (filename (nil "x-gzip64")) - (interactive (list (read-file-name "Insert encoded file: "))) - (apply (function call-process) (car gzip64-external-encoder) + (interactive "*fInsert encoded file: ") + (apply (function call-process) + (car gzip64-external-encoder) filename t nil - (cdr gzip64-external-encoder)) - ) + (cdr gzip64-external-encoder))) (mel-define-method mime-write-decoded-region (start end filename (nil "x-gzip64")) "Decode and write current region encoded by gzip64 into FILENAME. START and END are buffer positions." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) + (interactive "*r\nFWrite decoded region to file: ") (as-binary-process (apply (function call-process-region) start end (car gzip64-external-decoder) nil nil nil (let ((args (cdr gzip64-external-decoder))) (append (butlast args) - (list (concat (car (last args)) ">" filename)))) - ))) + (list (concat (car (last args)) ">" filename))))))) ;;; @ end diff --git a/mel-q-ccl.el b/mel-q-ccl.el index d08184d..04e09b0 100644 --- a/mel-q-ccl.el +++ b/mel-q-ccl.el @@ -1,5 +1,4 @@ -;;; mel-ccl.el: CCL based encoder/decoder of Quoted-Printable -;;; and Q-encoding +;;; mel-q-ccl.el --- Quoted-Printable encoder/decoder using CCL. ;; Copyright (C) 1998 Tanaka Akira @@ -20,7 +19,7 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. @@ -237,6 +236,8 @@ abcdefghijklmnopqrstuvwxyz\ (eval-when-compile +(defvar eof-block-branches) +(defvar eof-block-reg) (defun mel-ccl-set-eof-block (branch) (let ((p (assoc branch eof-block-branches))) (unless p @@ -244,6 +245,9 @@ abcdefghijklmnopqrstuvwxyz\ eof-block-branches (cons p eof-block-branches))) `(,eof-block-reg = ,(cdr p)))) +) + +(eval-when-compile (defun mel-ccl-try-to-read-crlf (input-crlf reg succ @@ -263,6 +267,10 @@ abcdefghijklmnopqrstuvwxyz\ ,succ ,crlf-fail)))) +) + +(eval-when-compile + ;; Generated CCL program works not properly on 20.2 because CCL_EOF_BLOCK ;; is not executed. (defun mel-ccl-encode-quoted-printable-generic (input-crlf output-crlf) @@ -884,12 +892,12 @@ abcdefghijklmnopqrstuvwxyz\ (defun quoted-printable-ccl-encode-region (start end) "Encode the region from START to END with quoted-printable encoding." - (interactive "r") + (interactive "*r") (decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev)) (defun quoted-printable-ccl-insert-encoded-file (filename) "Encode contents of the file named as FILENAME, and insert it." - (interactive (list (read-file-name "Insert encoded file: "))) + (interactive "*fInsert encoded file: ") (insert-file-contents-as-coding-system 'mel-ccl-quoted-printable-lf-lf-rev filename)) @@ -913,15 +921,12 @@ abcdefghijklmnopqrstuvwxyz\ (defun quoted-printable-ccl-decode-region (start end) "Decode the region from START to END with quoted-printable encoding." - (interactive "r") + (interactive "*r") (encode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev)) -(defun quoted-printable-ccl-write-decoded-region - (start end filename) +(defun quoted-printable-ccl-write-decoded-region (start end filename) "Decode quoted-printable encoded current region and write out to FILENAME." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) + (interactive "*r\nFWrite decoded region to file: ") (write-region-as-coding-system 'mel-ccl-quoted-printable-lf-lf-rev start end filename)) @@ -959,7 +964,7 @@ MODE allows `text', `comment', `phrase' or nil. Default value is (unless (featurep 'xemacs) (defun q-encoding-ccl-encoded-length (string &optional mode) (let ((status [nil nil nil nil nil nil nil nil nil])) - (fillarray status nil) + (fillarray status nil) ; XXX: Is this necessary? (ccl-execute-on-string (cond ((eq mode 'text) 'mel-ccl-count-uq) @@ -974,8 +979,9 @@ MODE allows `text', `comment', `phrase' or nil. Default value is 'q-encoding-ccl-encode-string) (mel-define-method encoded-text-decode-string (string (nil "Q")) - (if (and (string-match Q-encoded-text-regexp string) - (string= string (match-string 0 string))) + (if (string-match (eval-when-compile + (concat "\\`" Q-encoded-text-regexp "\\'")) + string) (q-encoding-ccl-decode-string string) (error "Invalid encoded-text %s" string))) @@ -985,4 +991,4 @@ MODE allows `text', `comment', `phrase' or nil. Default value is (provide 'mel-q-ccl) -;;; mel-q-ccl.el ends here +;;; mel-q-ccl.el ends here. diff --git a/mel-q.el b/mel-q.el index 0e80c16..6200a74 100644 --- a/mel-q.el +++ b/mel-q.el @@ -1,12 +1,12 @@ -;;; mel-q.el: Quoted-Printable and Q-encoding encoder/decoder for GNU Emacs +;;; mel-q.el --- Quoted-Printable encoder/decoder. -;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Created: 1995/6/25 ;; Keywords: MIME, Quoted-Printable, Q-encoding -;; This file is part of MEL (MIME Encoding Library). +;; This file is part of FLIM (Faithful Library about Internet Message). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -19,14 +19,14 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: -(require 'emu) (require 'mime-def) +(require 'path-util) ;;; @ Quoted-Printable encoder @@ -36,54 +36,56 @@ (concat "=" (char-to-string (aref quoted-printable-hex-chars (ash character -4))) - (char-to-string (aref quoted-printable-hex-chars (logand character 15))) - )) + (char-to-string (aref quoted-printable-hex-chars (logand character 15))))) (defun quoted-printable-internal-encode-region (start end) (save-excursion (save-restriction - (narrow-to-region start end) - (goto-char start) - (let ((col 0)) - (while (< (point)(point-max)) - (cond ((>= col 75) - (insert "=\n") - (setq col 0) - ) - ((looking-at-as-unibyte "^From ") - (replace-match "=46rom ") - (backward-char 1) - (setq col (+ col 6)) - ) - ((looking-at-as-unibyte "[ \t]\n") - (forward-char 1) - (insert "=\n") - (forward-char 1) - (setq col 0) - ) - (t - (let ((chr (char-after (point)))) - (cond ((= chr ?\n) - (forward-char 1) - (setq col 0) - ) - ((or (= chr ?\t) - (and (<= 32 chr)(/= chr ?=)(< chr 127)) - ) - (forward-char 1) - (setq col (1+ col)) - ) - ((>= col 73) - (insert "=\n") - (setq col 0) - ) - (t - (delete-char 1) - (insert (quoted-printable-quote-char chr)) - (setq col (+ col 3)) - )) - ))) - ))))) + (narrow-to-region (goto-char start) end) + (let ((col 0) + chr) + (while (not (eobp)) + (cond + ((>= col 75) ; soft line break. + (insert "=\n") + (setq col 0)) + ((eolp) ; end of line. + (forward-char) + (setq col 0)) + (t + (setq chr (char-after (point))) + (cond + ((and (memq chr '(? ?\t)) ; encode WSP char before CRLF. + (eq (char-after (1+ (point))) ?\n)) + (forward-char) + (insert "=\n") + (forward-char) + (setq col 0)) + ((and (bolp) ; "^From " is not safe. + (eq chr ?F) + (eq (char-after (1+ (point))) ?r) + (eq (char-after (+ 2 (point))) ?o) + (eq (char-after (+ 3 (point))) ?m) + (eq (char-after (+ 4 (point))) ? )) + (delete-region (point)(1+ (point))) + (insert "=46") ; moved to ?r. + (forward-char 4) ; skip "rom ". + (setq col 7)) + ((or (= chr ?\t) ; skip safe char. + (and (<= 32 chr)(/= chr ?=)(< chr 127))) + (forward-char) + (setq col (1+ col))) + ((>= col 73) ; soft line break. + (insert "=\n") + (setq col 0)) + (t ; encode unsafe char. + (delete-region (point)(1+ (point))) + ;; (insert (quoted-printable-quote-char chr)) + (insert + ?= + (aref quoted-printable-hex-chars (ash chr -4)) + (aref quoted-printable-hex-chars (logand chr 15))) + (setq col (+ col 3))))))))))) (defvar quoted-printable-external-encoder '("mmencode" "-q") @@ -96,15 +98,13 @@ (as-binary-process (apply (function call-process-region) start end (car quoted-printable-external-encoder) - t t nil (cdr quoted-printable-external-encoder)) - ) + t t nil + (cdr quoted-printable-external-encoder))) ;; for OS/2 ;; regularize line break code (goto-char (point-min)) (while (re-search-forward "\r$" nil t) - (replace-match "") - ) - ))) + (replace-match ""))))) (defvar quoted-printable-internal-encoding-limit @@ -113,7 +113,8 @@ (require 'path-util) (if (exec-installed-p "mmencode") 1000 - (message "Don't found external encoder for Quoted-Printable!") + ;; XXX: Fix this message, or simply remove it. + ;; (message "Don't found external encoder for Quoted-Printable!") nil)) "*limit size to use internal quoted-printable encoder. If size of input to encode is larger than this limit, @@ -127,21 +128,18 @@ region is smaller than `quoted-printable-internal-encoding-limit', otherwise it calls external quoted-printable encoder specified by `quoted-printable-external-encoder'. In this case, you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive "r") + (interactive "*r") (if (and quoted-printable-internal-encoding-limit (> (- end start) quoted-printable-internal-encoding-limit)) (quoted-printable-external-encode-region start end) - (quoted-printable-internal-encode-region start end) - )) - + (quoted-printable-internal-encode-region start end))) (defun quoted-printable-encode-string (string) "Encode STRING to quoted-printable, and return the result." (with-temp-buffer (insert string) (quoted-printable-encode-region (point-min)(point-max)) - (buffer-string) - )) + (buffer-string))) (mel-define-method-function @@ -152,16 +150,16 @@ the program (maybe mmencode included in metamail or XEmacs package)." (mime-encode-region start end (nil "quoted-printable")) 'quoted-printable-encode-region) -(mel-define-method mime-insert-encoded-file (filename - (nil "quoted-printable")) +(mel-define-method mime-insert-encoded-file (filename (nil "quoted-printable")) "Encode contents of file FILENAME to quoted-printable, and insert the result. It calls external quoted-printable encoder specified by `quoted-printable-external-encoder'. So you must install the program \(maybe mmencode included in metamail or XEmacs package)." - (interactive (list (read-file-name "Insert encoded file: "))) - (apply (function call-process) (car quoted-printable-external-encoder) - filename t nil (cdr quoted-printable-external-encoder)) - ) + (interactive "*fInsert encoded file: ") + (apply (function call-process) + (car quoted-printable-external-encoder) + filename t nil + (cdr quoted-printable-external-encoder))) ;;; @ Quoted-Printable decoder @@ -179,25 +177,28 @@ It calls external quoted-printable encoder specified by (narrow-to-region start end) (goto-char (point-min)) (while (search-forward "=" nil t) - (let ((beg (match-beginning 0))) - (cond ((looking-at "\n") - (delete-region beg (match-end 0)) - ) - ((looking-at - `,(concat "[" quoted-printable-hex-chars - "][" quoted-printable-hex-chars "]")) - (let* ((end (match-end 0)) - (hex (buffer-substring (match-beginning 0) end))) - (delete-region beg end) - (insert - (logior - (ash (quoted-printable-hex-char-to-num (aref hex 0)) 4) - (quoted-printable-hex-char-to-num (aref hex 1)))) - )) - (t - ;; invalid - )) - ))))) + (cond + ((eolp) + ;; unfold soft line break. + (delete-region (1- (point))(1+ (point)))) + ((and (memq (char-after (point)) + (eval-when-compile + ;; XXX: should provide char-list instead. + (string-to-char-list quoted-printable-hex-chars))) + (memq (char-after (1+ (point))) + (eval-when-compile + ;; XXX: should provide char-list instead. + (string-to-char-list quoted-printable-hex-chars)))) + ;; encoded char. + (insert + (prog1 + (logior + (ash (quoted-printable-hex-char-to-num (char-after (point))) 4) + (quoted-printable-hex-char-to-num (char-after (1+ (point))))) + (delete-region (1- (point))(+ 2 (point)))))) + (t + ;; invalid encoding. + )))))) (defvar quoted-printable-external-decoder '("mmencode" "-q" "-u") "*list of quoted-printable decoder program name and its arguments.") @@ -207,8 +208,8 @@ It calls external quoted-printable encoder specified by (as-binary-process (apply (function call-process-region) start end (car quoted-printable-external-decoder) - t t nil (cdr quoted-printable-external-decoder)) - ))) + t t nil + (cdr quoted-printable-external-decoder))))) (defvar quoted-printable-internal-decoding-limit nil @@ -224,12 +225,11 @@ region is smaller than `quoted-printable-internal-decoding-limit', otherwise it calls external quoted-printable decoder specified by `quoted-printable-external-decoder'. In this case, you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive "r") + (interactive "*r") (if (and quoted-printable-internal-decoding-limit (> (- end start) quoted-printable-internal-decoding-limit)) (quoted-printable-external-decode-region start end) - (quoted-printable-internal-decode-region start end) - )) + (quoted-printable-internal-decode-region start end))) (defun quoted-printable-decode-string (string) "Decode STRING which is encoded in quoted-printable, and return the result." @@ -255,17 +255,14 @@ the program (maybe mmencode included in metamail or XEmacs package)." (nil "quoted-printable")) "Decode and write current region encoded by quoted-printable into FILENAME. START and END are buffer positions." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) + (interactive "*r\nFWrite decoded region to file: ") (as-binary-process (apply (function call-process-region) start end (car quoted-printable-external-decoder) nil nil nil (append (cdr quoted-printable-external-decoder) quoted-printable-external-decoder-option-to-specify-file - (list filename)) - ))) + (list filename))))) ;;; @ Q-encoding encode/decode string @@ -283,22 +280,16 @@ START and END are buffer positions." MODE allows `text', `comment', `phrase' or nil. Default value is `phrase'." (let ((specials (cdr (or (assq mode q-encoding-special-chars-alist) - (assq 'phrase q-encoding-special-chars-alist) - )))) + (assq 'phrase q-encoding-special-chars-alist))))) (mapconcat (function (lambda (chr) (cond ((eq chr ? ) "_") ((or (< chr 32) (< 126 chr) - (memq chr specials) - ) - (quoted-printable-quote-char chr) - ) + (memq chr specials)) + (quoted-printable-quote-char chr)) (t - (char-to-string chr) - )) - )) - string "") - )) + (char-to-string chr))))) + string ""))) (defun q-encoding-decode-string (string) "Decode STRING which is encoded in Q-encoding and return the result." @@ -315,19 +306,17 @@ MODE allows `text', `comment', `phrase' or nil. Default value is (h (setq l (quoted-printable-hex-char-to-num chr)) (prog1 (char-to-string (logior (ash h 4) l)) - (setq h nil) - ) - ) - (t (char-to-string chr)) - ))) + (setq h nil))) + (t (char-to-string chr))))) string ""))) (mel-define-method-function (encoded-text-encode-string string (nil "Q")) 'q-encoding-encode-string) (mel-define-method encoded-text-decode-string (string (nil "Q")) - (if (and (string-match Q-encoded-text-regexp string) - (string= string (match-string 0 string))) + (if (string-match (eval-when-compile + (concat "\\`" Q-encoded-text-regexp "\\'")) + string) (q-encoding-decode-string string) (error "Invalid encoded-text %s" string))) @@ -337,4 +326,4 @@ MODE allows `text', `comment', `phrase' or nil. Default value is (provide 'mel-q) -;;; mel-q.el ends here +;;; mel-q.el ends here. diff --git a/mel-u.el b/mel-u.el index 3328e56..94ede06 100644 --- a/mel-u.el +++ b/mel-u.el @@ -1,6 +1,6 @@ -;;; mel-u.el: uuencode encoder/decoder for GNU Emacs +;;; mel-u.el --- uuencode encoder/decoder. -;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Created: 1995/10/25 @@ -19,14 +19,14 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: -(require 'emu) (require 'mime-def) +(require 'path-util) (mel-define-backend "x-uue") @@ -51,17 +51,16 @@ This function uses external uuencode encoder which is specified by variable `uuencode-external-encoder'." (interactive "*r") (save-excursion - (as-binary-process (apply (function call-process-region) - start end (car uuencode-external-encoder) - t t nil (cdr uuencode-external-encoder)) - ) + (as-binary-process + (apply (function call-process-region) + start end (car uuencode-external-encoder) + t t nil + (cdr uuencode-external-encoder))) ;; for OS/2 ;; regularize line break code (goto-char (point-min)) (while (re-search-forward "\r$" nil t) - (replace-match "") - ) - )) + (replace-match "")))) (defun uuencode-external-decode-region (start end) "Decode current region by unofficial uuencode format. @@ -76,14 +75,14 @@ variable `uuencode-external-decoder'." (if (re-search-forward "^begin [0-9]+ " nil t) (if (looking-at ".+$") (buffer-substring (match-beginning 0) - (match-end 0)) - ))))) + (match-end 0))))))) (default-directory temporary-file-directory)) (if filename (as-binary-process (apply (function call-process-region) start end (car uuencode-external-decoder) - t nil nil (cdr uuencode-external-decoder)) + t nil nil + (cdr uuencode-external-decoder)) (as-binary-input-file (insert-file-contents filename)) ;; The previous line causes the buffer to be made read-only, I ;; do not pretend to understand the control flow leading to this @@ -91,10 +90,7 @@ variable `uuencode-external-decoder'." ;; Use `inhibit-read-only' to avoid to force ;; buffer-read-only nil. - tomo. (let ((inhibit-read-only t)) - (delete-file filename) - ) - )) - ))) + (delete-file filename))))))) (mel-define-method-function (mime-encode-region start end (nil "x-uue")) 'uuencode-external-encode-region) @@ -125,18 +121,16 @@ variable `uuencode-external-decoder'." "Insert file encoded by unofficial uuencode format. This function uses external uuencode encoder which is specified by variable `uuencode-external-encoder'." - (interactive (list (read-file-name "Insert encoded file: "))) - (call-process (car uuencode-external-encoder) filename t nil - (file-name-nondirectory filename)) - ) + (interactive "*fInsert encoded file: ") + (call-process (car uuencode-external-encoder) + filename t nil + (file-name-nondirectory filename))) (mel-define-method mime-write-decoded-region (start end filename (nil "x-uue")) "Decode and write current region encoded by uuencode into FILENAME. START and END are buffer positions." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) + (interactive "*r\nFWrite decoded region to file: ") (save-excursion (let ((file (save-excursion (save-restriction @@ -145,16 +139,15 @@ START and END are buffer positions." (if (re-search-forward "^begin [0-9]+ " nil t) (if (looking-at ".+$") (buffer-substring (match-beginning 0) - (match-end 0)) - ))))) + (match-end 0))))))) (default-directory temporary-file-directory)) (if file (as-binary-process (apply (function call-process-region) start end (car uuencode-external-decoder) - nil nil nil (cdr uuencode-external-decoder)) - (rename-file file filename 'overwrites) - ))))) + nil nil nil + (cdr uuencode-external-decoder)) + (rename-file file filename 'overwrites)))))) ;;; @ end @@ -164,4 +157,4 @@ START and END are buffer positions." (mel-define-backend "x-uuencode" ("x-uue")) -;;; mel-u.el ends here +;;; mel-u.el ends here. diff --git a/mel.el b/mel.el index e44ad5b..f128321 100644 --- a/mel.el +++ b/mel.el @@ -1,6 +1,6 @@ -;;; mel.el : a MIME encoding/decoding library +;;; mel.el --- A MIME encoding/decoding library. -;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; Created: 1995/6/25 @@ -19,14 +19,14 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: (require 'mime-def) -(require 'poem) +(require 'path-util) (defcustom mime-encoding-list '("7bit" "8bit" "binary" "base64" "quoted-printable") @@ -59,17 +59,15 @@ Content-Transfer-Encoding for it." (defun mime-encoding-alist (&optional service) "Return table of Content-Transfer-Encoding for completion." - (mapcar #'list (mime-encoding-list service)) - ) + (mapcar #'list (mime-encoding-list service))) (defsubst mel-use-module (name encodings) - (let (encoding) - (while (setq encoding (car encodings)) - (set-alist 'mel-encoding-module-alist - encoding - (cons name (cdr (assoc encoding mel-encoding-module-alist)))) - (setq encodings (cdr encodings)) - ))) + (while encodings + (set-alist 'mel-encoding-module-alist + (car encodings) + (cons name (cdr (assoc (car encodings) + mel-encoding-module-alist)))) + (setq encodings (cdr encodings)))) (defsubst mel-find-function (service encoding) (mel-find-function-from-obarray @@ -115,21 +113,20 @@ Content-Transfer-Encoding for it." It calls external base64 encoder specified by `base64-external-encoder'. So you must install the program (maybe mmencode included in metamail or XEmacs package)." - (interactive (list (read-file-name "Insert encoded file: "))) + (interactive "*fInsert encoded file: ") (insert (base64-encode-string (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-as-binary filename) (buffer-string)))) - (or (bolp) - (insert "\n")) - ) + (or (bolp) (insert ?\n))) (mel-define-method-function (encoded-text-encode-string string (nil "B")) 'base64-encode-string) (mel-define-method encoded-text-decode-string (string (nil "B")) - (if (and (string-match B-encoded-text-regexp string) - (string= string (match-string 0 string))) + (if (string-match (eval-when-compile + (concat "\\`" B-encoded-text-regexp "\\'")) + string) (base64-decode-string string) (error "Invalid encoded-text %s" string))) ) @@ -143,27 +140,22 @@ mmencode included in metamail or XEmacs package)." (and (featurep 'mule) (progn (require 'path-util) - (module-installed-p 'mel-b-ccl) - ))) + (module-installed-p 'mel-b-ccl)))) (defvar mel-q-ccl-module (and (featurep 'mule) (progn (require 'path-util) - (module-installed-p 'mel-q-ccl) - ))) + (module-installed-p 'mel-q-ccl)))) -(if mel-b-ccl-module - (mel-use-module 'mel-b-ccl '("base64" "B")) - ) +(when mel-b-ccl-module + (mel-use-module 'mel-b-ccl '("base64" "B"))) -(if mel-q-ccl-module - (mel-use-module 'mel-q-ccl '("quoted-printable" "Q")) - ) +(when mel-q-ccl-module + (mel-use-module 'mel-q-ccl '("quoted-printable" "Q"))) -(if base64-dl-module - (mel-use-module 'mel-b-dl '("base64" "B")) - ) +(when base64-dl-module + (mel-use-module 'mel-b-dl '("base64" "B"))) ;;; @ region @@ -174,12 +166,11 @@ mmencode included in metamail or XEmacs package)." "Encode region START to END of current buffer using ENCODING. ENCODING must be string." (interactive - (list (region-beginning) (region-end) - (completing-read "encoding: " + (list (region-beginning)(region-end) + (completing-read "Encoding: " (mime-encoding-alist) nil t "base64"))) - (funcall (mel-find-function 'mime-encode-region encoding) start end) - ) + (funcall (mel-find-function 'mime-encode-region encoding) start end)) ;;;###autoload @@ -187,8 +178,8 @@ ENCODING must be string." "Decode region START to END of current buffer using ENCODING. ENCODING must be string." (interactive - (list (region-beginning) (region-end) - (completing-read "encoding: " + (list (region-beginning)(region-end) + (completing-read "Encoding: " (mime-encoding-alist 'mime-decode-region) nil t "base64"))) (funcall (mel-find-function 'mime-decode-region encoding) @@ -204,33 +195,29 @@ ENCODING must be string." ENCODING must be string. If ENCODING is found in `mime-string-decoding-method-alist' as its key, this function decodes the STRING by its value." - (let ((fun (mel-find-function 'mime-decode-string encoding))) - (if fun - (funcall (mel-find-function 'mime-decode-string encoding) - string) + (let ((f (mel-find-function 'mime-decode-string encoding))) + (if f + (funcall f string) string))) + (mel-define-service encoded-text-encode-string (string encoding) - "Encode STRING as encoded-text using ENCODING. -ENCODING must be string.") + "Encode STRING as encoded-text using ENCODING. ENCODING must be string.") (mel-define-service encoded-text-decode-string (string encoding) - "Decode STRING as encoded-text using ENCODING. -ENCODING must be string.") + "Decode STRING as encoded-text using ENCODING. ENCODING must be string.") (defun base64-encoded-length (string) (* (/ (+ (length string) 2) 3) 4)) (defsubst Q-encoding-printable-char-p (chr mode) (and (not (memq chr '(?= ?? ?_))) - (<= ?\ chr)(<= chr ?~) + (<= ?\ chr)(<= chr ?~) (cond ((eq mode 'text) t) ((eq mode 'comment) - (not (memq chr '(?\( ?\) ?\\))) - ) + (not (memq chr '(?\( ?\) ?\\)))) (t - (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr)) - )))) + (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr)))))) (defun Q-encoded-text-length (string &optional mode) (let ((l 0)(i 0)(len (length string)) chr) @@ -238,9 +225,8 @@ ENCODING must be string.") (setq chr (elt string i)) (if (Q-encoding-printable-char-p chr mode) (setq l (+ l 1)) - (setq l (+ l 3)) - ) - (setq i (+ i 1)) ) + (setq l (+ l 3))) + (setq i (+ i 1))) l)) @@ -252,7 +238,7 @@ ENCODING must be string.") "Insert file FILENAME encoded by ENCODING format." (interactive (list (read-file-name "Insert encoded file: ") - (completing-read "encoding: " + (completing-read "Encoding: " (mime-encoding-alist) nil t "base64"))) (funcall (mel-find-function 'mime-insert-encoded-file encoding) @@ -264,9 +250,9 @@ ENCODING must be string.") "Decode and write current region encoded by ENCODING into FILENAME. START and END are buffer positions." (interactive - (list (region-beginning) (region-end) + (list (region-beginning)(region-end) (read-file-name "Write decoded region to file: ") - (completing-read "encoding: " + (completing-read "Encoding: " (mime-encoding-alist 'mime-write-decoded-region) nil t "base64"))) (funcall (mel-find-function 'mime-write-decoded-region encoding) diff --git a/mime-def.el b/mime-def.el index 9c40695..3d41ae4 100644 --- a/mime-def.el +++ b/mime-def.el @@ -24,10 +24,16 @@ ;;; Code: +(require 'poe) +(require 'poem) +(require 'pcustom) (require 'mcharset) +(require 'alist) + +(eval-when-compile (require 'cl)) ; list* (eval-and-compile - (defconst mime-library-product ["FLAM-DOODLE" (1 12 5) "$BFP(B 10R4.0/7.0"] + (defconst mime-library-product ["FLAM-DOODLE" (1 12 6) "$B3w(B 10R4.0/5.0"] "Product name, version number and code name of MIME-library package.") ) @@ -51,18 +57,11 @@ ;;; @ variables ;;; -(require 'custom) - -(eval-when-compile (require 'cl)) - -(defgroup mime nil +(defgroup mime '((default-mime-charset custom-variable)) "Emacs MIME Interfaces" :group 'news :group 'mail) -(custom-handle-keyword 'default-mime-charset :group 'mime - 'custom-variable) - (defcustom mime-uuencode-encoding-name-list '("x-uue" "x-uuencode") "*List of encoding names for uuencode format." :group 'mime @@ -87,7 +86,7 @@ (defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n)) (defconst std11-qtext-regexp (eval-when-compile - (concat "[^" (apply #'string std11-non-qtext-char-list) "]")))) + (concat "[^" std11-non-qtext-char-list "]")))) (defconst std11-quoted-string-regexp (eval-when-compile (concat "\"" @@ -99,8 +98,9 @@ ;;; @ about MIME ;;; -(defconst mime-tspecial-char-list - '(?\] ?\[ ?\( ?\) ?< ?> ?@ ?, ?\; ?: ?\\ ?\" ?/ ?? ?=)) +(eval-and-compile + (defconst mime-tspecial-char-list + '(?\] ?\[ ?\( ?\) ?< ?> ?@ ?, ?\; ?: ?\\ ?\" ?/ ?? ?=))) (defconst mime-token-regexp (eval-when-compile (concat "[^" mime-tspecial-char-list "\000-\040]+"))) @@ -357,8 +357,6 @@ message/rfc822, `mime-entity' structures of them are included in ;;; @ for mm-backend ;;; -(require 'alist) - (defvar mime-entity-implementation-alist nil) (defmacro mm-define-backend (type &optional parents) @@ -443,7 +441,7 @@ If ARGS is specified, NAME is defined as a generic function for the service." `(progn (add-to-list 'mel-service-list ',name) - (defvar ,(intern (format "%s-obarray" name)) (make-vector 1 nil)) + (defvar ,(intern (format "%s-obarray" name)) (make-vector 7 0)) ,@(if args `((defun ,name ,args ,@rest diff --git a/mime-en.sgml b/mime-en.sgml index dd428f8..3ef7f7f 100644 --- a/mime-en.sgml +++ b/mime-en.sgml @@ -870,18 +870,23 @@ ENCODING must be string.")

Network representation of header encoded-word

-encoded-word $B$O(B header $B$GHs(B ASCII $BJ8;z$rI=8=$9$k$?$a$N7A(B -$B<0$G!"(BRFC 2047 $B$GDj5A$5$l$F$$$^$9!#(B +RFC 2047 defines the +encoded-word which is a format to represent +non-ASCII characters in a header.

-$B$^$?!"9T57$N0-$$$3$H$@$H8@$($^$9$,!"(Bencoded-word $B$rMQ$$$:$KHs(B -ASCII $BJ8;z$r(B header $B$KF~$l$?5-;v$bB8:_$7$^$9!#(B +The encoded-word is the only valid format to represent +non-ASCII characters in a header, but there are also +invalid styles. Such kinds of evil messages represent +non-ASCII characters in headers without encoded-words (it +is called "raw" non-ASCII characters).

-FLIM $B$O$3$l$i$rId9f2=!&I|9f2=$9$k5!G=$rDs6!$7$^$9!#(B +FLIM provides encoding/decoding features of both encoded-word and +invalid "raw" non-ASCII characters.

Header encoding/decoding diff --git a/mime-en.texi b/mime-en.texi index aa65897..bf1be13 100644 --- a/mime-en.texi +++ b/mime-en.texi @@ -957,10 +957,11 @@ ENCODING must be string.") @chapter Network representation of header @cindex RFC 2047 @cindex Standards Track +@cindex encoded-word @cindex RFC 2047 -encoded-word $B$O(B header $B$GHs(B ASCII (@ref{ASCII}) $BJ8;z$rI=8=$9$k$?$a$N7A<0(B -$B$G!"(B@strong{RFC 2047} $B$GDj5A$5$l$F$$$^$9!#(B@refill +@strong{RFC 2047} defines the @strong{encoded-word} which is a format to +represent non-ASCII (@ref{ASCII}) characters in a header.@refill @noindent @@ -971,10 +972,14 @@ Message Header Extensions for Non-ASCII Text'', November 1996, Standards Track (obsolete RFC 1521,1522,1590). @end quotation -$B$^$?!"9T57$N0-$$$3$H$@$H8@$($^$9$,!"(Bencoded-word $B$rMQ$$$:$KHs(B ASCII -(@ref{ASCII}) $BJ8;z$r(B header $B$KF~$l$?5-;v$bB8:_$7$^$9!#(B@refill +The encoded-word is the only valid format to represent non-ASCII +(@ref{ASCII}) characters in a header, but there are also invalid styles. +Such kinds of evil messages represent non-ASCII (@ref{ASCII}) characters +in headers without encoded-words (it is called "raw" non-ASCII +(@ref{ASCII}) characters).@refill -FLIM $B$O$3$l$i$rId9f2=!&I|9f2=$9$k5!G=$rDs6!$7$^$9!#(B +FLIM provides encoding/decoding features of both encoded-word and +invalid "raw" non-ASCII (@ref{ASCII}) characters. @menu diff --git a/mime-ja.sgml b/mime-ja.sgml index e4dcda2..e358ca0 100644 --- a/mime-ja.sgml +++ b/mime-ja.sgml @@ -60,12 +60,12 @@ FLIM $B$O(B entity $B$N>pJs$rI=8=$9$k$?$a$K(Bmime-entity type location

-Open an entity and return it. +Entity $B$r3+$$$F!"$=$l$rJV$7$^$9!#(B

-type is representation-type. +type $B$O(B representation-type $B$G$9!#(B

-location is location of entity. Specification of it is -depended on representation-type. +location $B$O(B entity $B$N0LCV$G$9!#;XDjJ}K!$O(B +representation-type $B$K0M$C$FJQ$o$j$^$9!#(B @@ -176,28 +176,29 @@ buffer local $BJQ?t!#(B entity-number message

-Return entity from entity-number in message. +message $B$+$i!"(Benity-number $B$N(B entity $B$rJV$7$^$9!#(B

-If message is not specified, -mime-message-structure is used. +message $B$,;XDj$5$l$F$$$J$$>l9g$O!"(B +mime-message-structrue $B$,;H$o$l$^$9!#(B entity-node-id message

-Return entity from entity-node-id in message. +message $B$+$i!"(Bentity-node-id $B$N(B entity $B$rJV$7$^(B +$B$9!#(B

-If message is not specified, -mime-message-structure is used. +message $B$,;XDj$5$l$F$$$J$$>l9g$O!"(B +mime-message-structure $B$,;H$o$l$^$9!#(B cid message

-Return entity from cid in message. +message $B$+$i!"(Bcid $B$N(B entity $B$rJV$7$^$9!#(B

-If message is not specified, -mime-message-structure is used. +message $B$,;XDj$5$l$F$$$J$$>l9g$O!"(B +mime-message-structure $B$,;H$o$l$^$9!#(B @@ -238,8 +239,8 @@ node="Content-Transfer-Encoding"> entity

-Return non-nil if contents of entity has been already -code-converted. +entity $B$NFbMF$,4{$K%3!<%IJQ49$5$l$F$$$k>l9g$O(B nil $B$GL5$$CM(B +$B$rJV$9!#(B @@ -300,12 +301,11 @@ list $B$G!"$=$l$>$l!"I=<($7$?$/$J$$(B field $BL>$HI=<($7$?$$MsL>$rI=8=$7$?$b$ entity

-Insert before point a contents of entity as text entity. +point $B$NA0$K(B entity $B$r(B text entity $B$H$7$FA^F~$7$^$9!#(B

-Contents of the entity are decoded as MIME -charset. If the entity does not have charset -parameter of Content-Type field, default-mime-charset is -used as default value. +entity $B$NFbMF$O(B MIMe charset $B$H$7$FI|9f2=$5$l(B +$B$^$9!#(Bentity $B$N(B Content-Type field $B$K(B charset paramter $B$,L5(B +$B$$$H!"(Bdefault-mime-charset $B$,=i4|CM$H$7$F;H$o$l$^$9!#(B @@ -329,13 +329,13 @@ MIME charset. entity

-Insert content of entity at point. +pointo $B$N0LCV$K(B entity $B$NFbMF$rA^F~$7$^$9!#(B entity filename

-Write content of entity into filename. +entity $B$NFbMF$r(B filename $B$K=q$-9~$_$^$9!#(B @@ -345,19 +345,19 @@ Write content of entity into filename. entity

-Insert header and body of entity at point. +entity $B$N(B header $B$H(B body $B$r(B point $B$N$H$3$m$KA^F~$7$^$9!#(B entity filename

-Write representation of entity into filename. +entity $B$NI=8=$r(B filename $B$K=q$-9~$_$^$9!#(B entity filename

-Write body of entity into filename. +entity $B$N(B body $B$r(B filename $B$K=q$-9~$_$^$9!#(B @@ -456,12 +456,13 @@ representation-type $B$NL>A0$N@hF,$K(B mm $B$rIU$1$?$b$N$K$J$C$F type parents

-Define type as a mm-backend. +type $B$r(B mm-backend $B$H$7$FDj5A$7$^$9!#(B

-If PARENTS is specified, type inherits parents. -Each parent must be representation-type. +PARENTS $B$,;XDj$5$l$F$$$k>l9g$O!"(Btype $B$O(B prents +$B$r7Q>5$7$^$9!#$=$l$>$l$N(B parent $B$O(B representation-type $B$G$"$kI,MW$,$"(B +$B$j$^$9!#(B

-Example: +$BNc(B:

(mm-define-backend chao (generic)) @@ -471,15 +472,15 @@ Example: name args body

-Define name as a method function of (nth 1 (car -args)) backend. +name $B$r(B (nth 1 (car args)) backend $B$N(B method $B4X(B +$B?t$H$7$FDj5A$7$^$9!#(B

-args is like an argument list of lambda, but (car -args) must be specialized parameter. (car (car -args)) is name of variable and (nth 1 (car -args)) is name of backend (representation-type). +args $B$O(B lambda $B$N0z?t%j%9%H$N$h$&$J$b$N$G$9$,!"(B(car +args) $B$O;XDj$5$l$?(B parameter $B$G$"$kI,MW$,$"$j$^$9!#(B(car +(car args)) $B$OJQ?t$NL>A0$G!"(B(nth 1 (car args)) +$B$O(B backend $B$NL>A0(B (representation-type) $B$G$9!#(B

-Example: +$BNc(B:

(mm-define-method entity-cooked-p ((entity chao)) nil) @@ -724,15 +725,15 @@ Content-Transfer-Encoding $BMs$,B8:_$7$J$$>l9g$O(B start end encoding

-Encode region start to end of current buffer -using encoding. +$B8=:_$N(B buffer $B$N(B start $B$+$i(B end $B$^$G$N(B region $B$r(B +encoding $B$r;H$C$FId9f2=$7$^$9!#(B start end encoding

-Decode region start to end of current buffer -using encoding. +$B8=:_$N(B buffer $B$N(B start $B$+$i(B end $B$^$G$N(B region $B$r(B +encoding $B$r;H$C$FI|9f2=$7$^$9!#(B @@ -746,56 +747,57 @@ using encoding. filename encoding

-Insert file FILENAME encoded by ENCODING format. +ENCODING format $B$GId9f2=$5$l$?(B file FILENAME $B$r(B +$BA^F~$9$k!#(B start end filename encoding

-Decode and write current region encoded by encoding into -filename. +encoding $B$GId9f2=$5$l$?8=:_$N(B region $B$rI|9f2=$7$F(B +filename$B$K=q$-9~$_$^$9!#(B

-start and end are buffer positions. +start $B$H(B end $B$O(B buffer $B$N0LCV$G$9!#(B -

Other utilities +

$BB>$N(B utility Encoding information

SERVICE

-Return list of Content-Transfer-Encoding. +Content-Transfer-Encoding $B$N(B list $B$rJV$7$^$9!#(B

-If service is specified, it returns available list of -Content-Transfer-Encoding for it. +service $B$,;XDj$5$l$F$$$k$H!"$=$l$KBP$9$k(B +Content-Transfer-Encoding $B$rJV$7$^$9!#(B SERVICE

-Return table of Content-Transfer-Encoding for completion. +$BJd40$N$?$a$N(B Content-Transfer-Encoding $B$NI=$rJV$7$^$9!#(B

-If service is specified, it returns available list of -Content-Transfer-Encoding for it. +service $B$,;XDj$5$l$F$$$k>l9g$O$=$l$KBP$9$k(B +Content-Transfer-Encoding $B$N(B list $B$rJV$7$^$9!#(B -

How to write encoder/decoder module +

$BId9f2=(B/$BI|9f2=(B module $B$N=q$-J}(B mel-backend

name args body

-Define name as a method function of (nth 1 (car (last -args))) backend. +name $B$r(B (nth 1 (car (last args))) backend $B$N(B +method $B4X?t$H$7$FDj5A$7$^$9!#(B

-args is like an argument list of lambda, but (car (last -args)) must be specialized parameter. (car (car (last -args))) is name of variable and (nth 1 (car (last -args))) is name of backend (encoding). +args $B$O(B lambda $B$N0z?t(B list $B$H;w$F$$$^$9$,!"(B(car (last +args)) $B$O;XDj$5$l$?(B parameter $B$G$"$kI,MW$,$"$j$^$9!#(B(car +(car (last args))) $B$OJQ?t$NL>A0$G!"(B(nth 1 (car (last +args))) $B$O(B backend $B$NL>A0(B (encoding) $B$G$9!#(B

-Example: +$BNc(B:

(mel-define-method mime-write-decoded-region (start end filename @@ -816,16 +818,16 @@ START and END are buffer positions." spec function

-Set spec's function definition to function. +spec $B$N4X?tDj5A$r(B function $B$K@_Dj$7$^$9!#(B

-First element of spec is service. +spec $B$N:G=i$NMWAG$O(B service $B$G$9!#(B

-Rest of args is like an argument list of lambda, but (car -(last args)) must be specialized parameter. (car (car -(last args))) is name of variable and (nth 1 (car (last -args))) is name of backend (encoding). +args $B$N;D$j$O(B lambda $B$N0z?t(B list $B;w$F$$$^$9$,!"(B(car (last +args)) $B$O;XDj$5$l$?(B parameter $B$G$"$kI,MW$,$"$j$^$9!#(B(car +(car (last args))) $B$OJQ?t$NL>A0$G!"(B(nth 1 (car (last +args))) $B$O(B backend $B$NL>A0(B (encoding) $B$G$9!#(B

-Example: +$BNc(B:

(mel-define-method-function (mime-encode-string string (nil "base64")) @@ -834,19 +836,20 @@ Example: -

How to add encoding/decoding service +

$BId9f2=(B/$BI|9f2=(B service $B$rDI2C$9$kJ}K!(B generic function for mel-backend

name args doc-string

-Define name as a service for Content-Transfer-Encodings. +name $B$r(B Content-Transfer-Encoding $B$N(B service $B$H$7$FDj5A$7$^(B +$B$9!#(B

-If args is specified, name is defined as a -generic function for the service. +args $B$,;XDj$5$l$F$$$k$H!"(Bname $B$O(B service $B$N(B +generic function $B$H$7$FDj5A$5$l$^$9!#(B

-Example: +$BNc(B:

(mel-define-service encoded-text-encode-string (string encoding) @@ -903,20 +906,19 @@ Header $B$r(B network $BI=8=$KId9f2=$9$k!#(B

-Association list to specify field encoding method. Each element looks -like (FIELD . METHOD). +Field $B$rId9f2=$9$kJ}K!$r;XDj$9$kO"A[(B list$B!#3F(B element $B$O(B (FIELD +. METHOD) $B$NMM$K$J$C$F$$$k!#(B

-If METHOD is mime, the FIELD will be encoded into MIME -format (encoded-word). +METHOD $B$,(B mime $B$G$"$l$P!"(BFIELD $B$O(B MIME format $B$KId9f2=$5(B +$B$l$k(B (encoded-word)$B!#(B

-If METHOD is nil, the FIELD will not be encoded. +METHOD $B$,(B nil $B$G$"$l$P!"(BFIELD $B$OId9f2=$5$l$J$$!#(B

-If METHOD is a MIME charset, the FIELD will be encoded as the charset -when it must be convert into network-code. +METHOD $B$,(B MIME charset $B$G$"$l$P!"(BFIELD $B$O%M%C%H%o!<%/%3!<%I$KJQ49$7$J(B +$B$1$l$P$J$i$J$$$H$-$K(B charset $B$KId9f2=$5$l$k!#(B

-Otherwise the FIELD will be encoded as variable -default-mime-charset when it must be convert into -network-code. +$B$=$&$G$J$1$l$P!"(BFIELD $B$O%M%C%H%o!<%/%3!<%I$KJQ49$7$J$1$l$P$J$i$J$$$H$-(B +$B$K(B $BJQ?t(B default-mime-charset $B$GId9f2=$5$l$k(B diff --git a/mime-parse.el b/mime-parse.el index 003b800..7d760c4 100644 --- a/mime-parse.el +++ b/mime-parse.el @@ -24,10 +24,8 @@ ;;; Code: -(require 'std11) (require 'mime-def) - -(eval-when-compile (require 'cl)) +(require 'std11) ;;; @ lexical analyzer diff --git a/mime.el b/mime.el index 0130f99..ce23631 100644 --- a/mime.el +++ b/mime.el @@ -29,12 +29,11 @@ (require 'mime-def) (require 'eword-decode) -(autoload 'eword-encode-field "eword-encode" - "Encode header field STRING, and return the result.") +(eval-and-compile + (autoload 'eword-encode-header "eword-encode" "Encode header fields to network representation, such as MIME encoded-word.") - (autoload 'mime-parse-Content-Type "mime-parse" "Parse STRING as field-body of Content-Type field.") (autoload 'mime-read-Content-Type "mime-parse" @@ -62,6 +61,7 @@ current-buffer, and return it.") (autoload 'mime-parse-buffer "mime-parse" "Parse BUFFER as a MIME message.") +) ;;; @ Entity Representation and Implementation ;;; diff --git a/smtp.el b/smtp.el index 79ef969..baef1ec 100644 --- a/smtp.el +++ b/smtp.el @@ -3,8 +3,9 @@ ;; Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. ;; Author: Tomoji Kagatani -;; Simon Leinen (ESMTP support) -;; Shuhei KOBAYASHI +;; Simon Leinen (ESMTP support) +;; MORIOKA Tomohiko (separate smtp.el from smtpmail.el) +;; Shuhei KOBAYASHI ;; Keywords: SMTP, mail ;; This file is part of FLIM (Faithful Library about Internet Message). @@ -20,13 +21,18 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the +;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: -(require 'mail-utils) ; pick up mail-strip-quoted-names +(require 'poe) +(require 'poem) +(require 'pcustom) +(require 'mail-utils) ; mail-strip-quoted-names + +(eval-when-compile (require 'cl)) ; push (defgroup smtp nil "SMTP protocol for sending mail." @@ -38,8 +44,10 @@ :group 'smtp) (defcustom smtp-server (or (getenv "SMTPSERVER") smtp-default-server) - "*The name of the host running SMTP server." - :type '(choice (const nil) string) + "*The name of the host running SMTP server. It can also be a function +called from `smtp-via-smtp' with arguments SENDER and RECIPIENTS." + :type '(choice (string :tag "Name") + (function :tag "Function")) :group 'smtp) (defcustom smtp-service "smtp" @@ -60,7 +68,11 @@ don't define this value." :type '(choice (const nil) string) :group 'smtp) -(defvar smtp-debug-info nil) +(defcustom smtp-debug-info nil + "*smtp debug info printout. messages and process buffer." + :type 'boolean + :group 'smtp) + (defvar smtp-read-point nil) (defun smtp-make-fqdn () @@ -75,11 +87,14 @@ don't define this value." (error "Cannot generate valid FQDN. Set `smtp-local-domain' correctly."))))) (defun smtp-via-smtp (sender recipients smtp-text-buffer) - (let (process response extensions) + (let ((server (if (functionp smtp-server) + (funcall smtp-server sender recipients) + smtp-server)) + process response extensions) (save-excursion (set-buffer (get-buffer-create - (format "*trace of SMTP session to %s*" smtp-server))) + (format "*trace of SMTP session to %s*" server))) (erase-buffer) (make-local-variable 'smtp-read-point) (setq smtp-read-point (point-min)) @@ -87,7 +102,7 @@ don't define this value." (unwind-protect (catch 'done (setq process (open-network-stream-as-binary - "SMTP" (current-buffer) smtp-server smtp-service)) + "SMTP" (current-buffer) server smtp-service)) (or process (throw 'done nil)) (set-process-filter process 'smtp-process-filter) @@ -121,7 +136,7 @@ don't define this value." extensions) (setq extension-lines (cdr extension-lines))))) - ;; ONEX --- One message transaction only (sendmail extension?) + ;; ONEX --- One message transaction only (sendmail extension?) (if (or (memq 'onex extensions) (memq 'xone extensions)) (progn @@ -132,7 +147,7 @@ don't define this value." (>= (car response) 400)) (throw 'done (car (cdr response)))))) - ;; VERB --- Verbose (sendmail extension?) + ;; VERB --- Verbose (sendmail extension?) (if (and smtp-debug-info (or (memq 'verb extensions) (memq 'xvrb extensions))) @@ -144,7 +159,7 @@ don't define this value." (>= (car response) 400)) (throw 'done (car (cdr response)))))) - ;; XUSR --- Initial (user) submission (sendmail extension?) + ;; XUSR --- Initial (user) submission (sendmail extension?) (if (memq 'xusr extensions) (progn (smtp-send-command process "XUSR") @@ -159,7 +174,7 @@ don't define this value." process (format "MAIL FROM:<%s>%s%s" sender - ;; SIZE --- Message Size Declaration (RFC1870) + ;; SIZE --- Message Size Declaration (RFC1870) (if (memq 'size extensions) (format " SIZE=%d" (save-excursion @@ -174,7 +189,7 @@ don't define this value." ;; those two bytes anyway: 2))) "") - ;; 8BITMIME --- 8bit-MIMEtransport (RFC1652) + ;; 8BITMIME --- 8bit-MIMEtransport (RFC1652) (if (and (memq '8bitmime extensions) smtp-use-8bitmime) " BODY=8BITMIME" @@ -184,7 +199,7 @@ don't define this value." (not (integerp (car response))) (>= (car response) 400)) (throw 'done (car (cdr response)))) - + ;; RCPT TO: (while recipients (smtp-send-command process @@ -195,7 +210,7 @@ don't define this value." (not (integerp (car response))) (>= (car response) 400)) (throw 'done (car (cdr response))))) - + ;; DATA (smtp-send-command process "DATA") (setq response (smtp-read-response process)) diff --git a/smtpmail.el b/smtpmail.el index 807b4a7..1cb7a1f 100644 --- a/smtpmail.el +++ b/smtpmail.el @@ -18,8 +18,8 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: @@ -42,10 +42,23 @@ ;;; Code: +(require 'poe) +(require 'pcustom) (require 'smtp) (require 'sendmail) (require 'time-stamp) +(eval-when-compile (require 'static)) + +(static-when (featurep 'xemacs) + (define-obsolete-variable-alias 'smtpmail-default-smtp-server + 'smtp-default-server) + (define-obsolete-variable-alias 'smtpmail-smtp-server 'smtp-server) + (define-obsolete-variable-alias 'smtpmail-smtp-service 'smtp-service) + (define-obsolete-variable-alias 'smtpmail-local-domain 'smtp-local-domain) + (define-obsolete-variable-alias 'smtpmail-debug-info 'smtp-debug-info) + ) + ;;; (defcustom smtpmail-queue-mail nil @@ -102,7 +115,7 @@ This is relative to `smtpmail-queue-dir'.") (backward-char 1) (setq delimline (point-marker)) ;; (sendmail-synch-aliases) - (if mail-aliases + (if (and mail-aliases (fboundp 'expand-mail-aliases)) ; XEmacs (expand-mail-aliases (point-min) delimline)) (goto-char (point-min)) ;; ignore any blank lines in the header diff --git a/std11.el b/std11.el index a083236..982b895 100644 --- a/std11.el +++ b/std11.el @@ -24,10 +24,9 @@ ;;; Code: -(or (fboundp 'buffer-substring-no-properties) - (require 'poe)) - -(require 'custom) +(require 'poe) +(require 'poem) ; find-non-ascii-charset-string +(require 'pcustom) ; std11-lexical-analyzer ;;; @ fetch -- 1.7.10.4