Anonymous avatar Anonymous committed 5d02ac0

Created

Comments (0)

Files changed (88)

+1998-01-12  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile: Update to newer package interface.
+
+1997-01-05  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile: Update to newer package interface.
+
+1997-12-21  SL Baur  <steve@altair.xemacs.org>
+
+	* gnus-charset.el ((require 'emu)): Fix truly twisted bytecompile
+	time dependency.
+
+1997-07-25  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.10.1 was released.
+
+1997-07-14  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el (uuencode-external-decode-region): Use
+	`inhibit-read-only' instead of `(setq buffer-read-only nil)'.
+
+1997-07-09  Steven L Baur  <steve@altair.xemacs.org>
+
+	* mel-u.el (uuencode-external-decode-region): Force
+	buffer-read-only nil because it gets changed magically to t during
+	the call to `insert-file-contents'.
+
+
+1997-07-14  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.10 was released.
+
+1997-07-14  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el: Add autoload comments for command `mime-encode-region',
+	`mime-decode-region' and `mime-insert-encoded-file'.
+
+1997-07-13  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-internal-encoding-limit): Change
+	initial value; 0 for XEmacs/mule; 1000 if mmencode is found;
+	otherwise nil; Don't use `quoted-printable-internal-encode-region'
+	for XEmacs/mule.
+
+	* mel-q.el: Use `start' instead of `beg' for argument.
+
+	* mel-q.el (quoted-printable-internal-encode-region): New
+	implementation.
+
+	* mel-q.el (quoted-printable-quote-char): Change to `defsubst';
+	use `aref'.
+
+	* mel-q.el: Abolish unused function `byte-to-hex-string'.
+
+1997-07-01  Steven L Baur  <steve@altair.xemacs.org>
+
+	* mel/mel-q.el (q-encoding-encode-string): Fix Ebola-ified
+ 	comparison. (cf. [xemacs-beta:10342][tm-en:1367])
+
+
+1997-05-15  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.9.1 was released.
+
+Thu May 15 05:43:48 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* README.en (make install): Add LISPDIR.
+
+Tue May 13 14:59:52 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* Makefile (LISPDIR): New variable.
+
+	* MEL-MK (config-mel): set LISPDIR.
+
+	* MEL-CFG: Setting for load-path is modified.
+
+
+1997-04-30  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.9 was released.
+
+Wed Apr 30 17:29:02 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* README.en (q-encoding-encode-string, q-encoding-decode-string):
+ 	Modify documentation.
+
+Wed Apr 30 17:24:32 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el, mel-q.el (q-encoding-encode-string,
+ 	q-encoding-decode-string): Add DOC-string.
+
+Wed Apr 30 17:14:46 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el (base64-insert-encoded-file,
+ 	quoted-printable-insert-encoded-file): Modify DOC-string.
+
+	* mel-q.el (quoted-printable-insert-encoded-file): Add DOC-string.
+
+Wed Apr 30 17:09:57 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-encode-region,
+ 	quoted-printable-decode-region): Add DOC-string.
+
+	* mel.el: Add autoload for `quoted-printable-encode-string' and
+ 	`quoted-printable-decode-string'.
+
+	* mel-q.el (quoted-printable-encode-string,
+ 	quoted-printable-decode-string): Add DOC-string.
+
+Wed Apr 30 13:23:00 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el (base64-insert-encoded-file): DOC-string was modified.
+
+	* mel-b.el (base64-insert-encoded-file): Add DOC-string.
+
+Wed Apr 30 13:15:12 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el (base64-encode-region, base64-decode-region): Add
+ 	DOC-string.
+
+Wed Apr 30 13:01:16 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el (base64-encode-string, base64-decode-string): Add
+ 	DOC-string.
+
+	* mel-b.el (base64-encode-string, base64-decode-string): Add
+ 	DOC-string.
+
+	* mel.el: autoload for `q-encoding-encode-string-for-text',
+ 	`q-encoding-encode-string-for-comment' and
+ 	`q-encoding-encode-string-for-phrase' were abolished.
+
+Tue Apr 29 11:47:35 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* README.en: New file.
+
+
+1997-03-14  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.3 was released.
+
+Fri Mar 14 07:40:13 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL-MK (config-mel): New function; load "MEL-CFG".
+
+	* MEL-CFG: New file.
+
+Wed Mar 12 06:31:16 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL-MK: mk-mel was renamed to MEL-MK.
+
+Mon Mar 10 15:15:09 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el: Variable `mime/tmp-dir' was abolished.
+
+	Require mel.
+
+	(uuencode-external-decoder): Use variable `mime-temp-directory'
+ 	instead of `mime/tmp-dir'.
+
+	(uuencode-external-decode-region): Use variable
+ 	`mime-temp-directory' instead of `mime/tmp-dir'.
+
+	* mel.el (mime-temp-directory): New variable.
+
+	* mel-u.el (uuencode-external-decode-region): Use
+ 	`as-binary-input-file'.
+
+
+1997-03-10  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.2.3 was released.
+
+	* mel-g.el (gzip64-external-encoder, gzip64-external-decoder): Use
+ 	`exec-installed-p' instead of `file-installed-p' to search
+ 	mmencode.
+
+
+1997-03-03  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.2.2 was released.
+
+	* mel-g.el (gzip64-external-encoder, gzip64-external-decoder):
+ 	Search mmencode from `exec-path'. (cf. [xemacs-beta:3730])
+
+
+Wed Jan  1 11:01:44 1997  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.2.1 was released.
+
+Wed Dec 28 13:57:22 1996  Martin Buchholz   <mrb@Eng.Sun.COM>
+
+	* mk-mel: Use variable `default-directory' instead of `(getenv
+ 	"PWD")'. (cf. [tm-en:1084])
+
+	* Makefile: A makefile command like `cd some-dir; do-something' is
+ 	generally better written as: `cd some-dir && do-something' since
+ 	if the cd fails (usually because of a coding or file-system error)
+ 	the do-something is not executed in the wrong
+ 	directory. (cf. [tm-en:1084])
+
+
+Wed Dec 25 06:30:59 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.2 was released.
+
+	* mel.el (mime-encoding-method-alist, mime-decoding-method-alist,
+ 	mime-file-encoding-method-alist): Add DOC-string.
+
+Wed Dec 25 01:08:47 1996  Steven L Baur     <steve@miranova.com>
+
+	* mel.el: to decode `x-uuencode'. (cf. [tm-en:1062])
+
+
+Thu Oct 31 16:05:41 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.0.1 was released.
+
+Mon Oct 28 12:53:09 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-insert-encoded-file): New constant.
+	(q-encoding-encode-string): New implementation; Function
+ 	`q-encoding-encode-string-for-text',
+ 	`q-encoding-encode-string-for-comment' and
+ 	`q-encoding-encode-string-for-phrase' were abolished.
+
+
+Mon Sep 23 16:53:19 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 6.0 was released.
+
+	* mel.el (mime-file-encoding-method-alist): Use function
+ 	`insert-binary-file-contents-literally'.
+
+
+Fri Aug 23 07:31:32 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 5.6.1 was released.
+
+Thu Aug 22 14:49:14 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL-ELS: Variable `mel-el-files' and `mel-elc-files' were
+ 	abolished.
+
+Thu Aug 22 14:47:45 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mk-mel: Variable `el-file-mode' was abolished.
+	Function `install-el', `install-el-files', `install-elc' and
+ 	`install-elc-files' were abolished.
+	(install-mel): Use function `install-elisp-modules'.
+
+Mon Aug 19 16:55:27 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mk-mel (compile-mel): Use function `compile-elisp-modules'.
+
+Mon Aug 19 16:53:14 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL-ELS (mel-modules): changed to list of symbols.
+
+	* mk-mel: mel-els was renamed to MEL-ELS.
+
+
+Thu Jun 27 22:28:57 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 5.6 was released.
+
+Wed Jun 26 16:25:13 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-g.el (gzip64-external-encode-region): regularize line break
+ 	code (for OS/2).
+
+Wed Jun 26 16:23:39 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-g.el (gzip64-external-encode-region): Use macro
+ 	`as-binary-process'.
+	(gzip64-external-decode-region): Use macro `as-binary-process'.
+
+Wed Jun 26 16:21:11 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el (uuencode-external-encode-region): regularize line
+ 	break code (for OS/2).
+
+Wed Jun 26 16:18:39 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el (uuencode-external-encode-region): Use macro
+ 	`as-binary-process'.
+	(uuencode-external-decode-region): Use macro `as-binary-process'.
+
+Wed Jun 26 16:13:39 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-external-encode-region): Use macro
+ 	`as-binary-process'.
+	(quoted-printable-external-decode-region): Use macro
+ 	`as-binary-process'.
+
+	* mel-b.el (base64-external-encode-region): Use macro
+ 	`as-binary-process'.
+	(base64-external-decode-region): Use macro `as-binary-process'.
+
+Wed Jun 12 05:30:23 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 5.5 was released.
+
+Mon Jun 10 05:06:27 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (q-encoding-printable-char-p): New function.
+
+	(q-encoding-encoded-length): Use function
+ 	`q-encoding-printable-char-p'.
+
+
+Sun Jun  9 04:10:08 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 5.4 was released.
+
+Fri Jun  7 14:06:59 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-g.el (gzip64-external-encode-region): fixed.
+	(gzip64-external-decode-region): fixed.
+
+Fri Jun  7 14:04:09 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-external-encode-region): fixed.
+	(quoted-printable-external-decode-region): fixed.
+
+Fri Jun  7 12:12:47 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el (uuencode-external-encode-region): fixed.
+	(uuencode-external-decode-region): fixed.
+
+Thu Jun  6 08:46:55 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el (mime-file-encoding-method-alist): New variable.
+	(mime-insert-encoded-file): New function.
+
+	* mel-g.el (gzip64-external-encode-region): fixed
+ 	`default-process-coding-system'.
+
+	(gzip64-external-decode-region): fixed
+ 	`default-process-coding-system'.
+
+Thu Jun  6 07:51:30 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el (uuencode-external-encode-region): fixed
+	`default-process-coding-system'.
+
+	(uuencode-external-decode-region): fixed
+	`default-process-coding-system'.
+
+Thu Jun  6 07:48:44 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-external-encode-region): fixed
+ 	`default-process-coding-system'.
+
+	(quoted-printable-external-decode-region): fixed
+ 	`default-process-coding-system'.
+
+Thu Jun  6 07:09:23 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el (base64-external-encode-region): fixed
+ 	`default-process-coding-system'.
+
+	(base64-external-decode-region): fixed
+ 	`default-process-coding-system'.
+
+
+Mon Jun  3 14:43:47 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 5.2 was released.
+
+Wed May 29 12:54:45 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-g.el: Don't use function `define-program-coding-system' and
+ 	`define-program-kanji-code'.
+	(gzip64-external-encode-region): set for process code.
+	(gzip64-external-decode-region): set for process code.
+
+Wed May 29 12:49:41 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el: Don't use function `define-program-coding-system' and
+ 	`define-program-kanji-code'.
+	(uuencode-external-encode-region): set for process code.
+	(uuencode-external-decode-region): set for process code.
+
+Wed May 29 12:40:12 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el: Don't use function `define-program-coding-system' and
+	`define-program-kanji-code'.
+	(quoted-printable-external-encode-region): set for process code.
+	(quoted-printable-external-decode-region): set for process code.
+
+Wed May 29 10:54:01 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el: Don't use function `define-program-coding-system' and
+ 	`define-program-kanji-code'.
+	(base64-external-encode-region): set for process code.
+	(base64-external-decode-region): set for process code.
+
+Wed May 29 08:10:15 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-g.el (gzip64-insert-encoded-file): New function.
+
+Wed May 29 08:00:01 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-g.el: Shuhei KOBAYASHI's address was changed.
+
+	* mel-u.el (uuencode-insert-encoded-file): New function.
+
+Wed May 29 07:30:48 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (quoted-printable-insert-encoded-file): New function.
+
+	* mel-b.el (base64-insert-encoded-file): New function.
+
+
+Tue May 28 03:31:13 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 5.0 was released.
+
+	* mel.el: Function `mime/encode-region' and `mime/decode-region'
+ 	were abolished.
+
+
+Thu May 23 01:32:04 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 4.7.1 was released.
+
+Wed May 22 02:20:35 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel.el (mime-encode-region): New function; Order of arguments
+ 	was changed.
+	(mime-decode-region): New function; Order of arguments was
+ 	changed.
+	(mime/encode-region): New implementation.
+	(mime/decode-region): New implementation.
+
+
+Wed May 15 21:19:12 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 4.7 was released.
+
+	* mel-b.el (base64-internal-decode-region): fixed about last line
+ 	which does not have line break.
+
+
+Tue May 14 02:43:41 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 4.6 was released.
+
+Sun May 12 17:43:04 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el (base64-decode-1): New spec; Argument was changed;
+ 	Return string instead of list of characters.
+	(base64-decode-string): modified for new spec of function
+ 	`base64-decode-1'.
+	(base64-internal-decode-region): fixed.
+
+Sun May 12 17:05:17 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el (base64-encode-1): New spec; Argument was changed;
+ 	Return string instead of list of characters.
+	(base64-encode-string): modified for new spec of function
+ 	`base64-encode-1'.
+	(base64-internal-decode-region): fixed.
+
+Sun May 12 16:17:11 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el: Function `base64-encode-chars' was abolished.
+	(base64-encode-1): New spec; use function `base64-num-to-char.
+	(base64-encode-string): Use function `base64-encode-1' instead of
+ 	`base64-encode-chars'.
+
+Sun May 12 15:50:26 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el: Function `base64-decode-chars' was abolished.
+	(base64-decode-1): New spec; use function `base64-char-to-num'.
+	(base64-decode-string): Use function `base64-decode-1' instead of
+ 	`base64-decode-chars'.
+
+
+Sat May 11 08:12:23 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 4.2 was released.
+
+	* mel-b.el (base64-encode-1): don't use function `base64-mask'.
+  	Function `base64-mask' was abolished.
+
+Sat May 11 07:52:05 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el (base64-decode-1): don't use function `base64-mask'.
+
+Sat May 11 06:35:20 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-b.el (base64-internal-decode-region): New implementation.
+
+
+Wed Mar 13 16:40:46 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 3.5 was released.
+
+Mon Mar 11 14:29:31 1996  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-q.el (byte-to-hex-string): New function.
+
+Tue Mar 12 11:19:02 1996  Shuhei KOBAYASHI  <shuhei@cmpt01.phys.tohoku.ac.jp>
+
+        * mel-els (mel-modules): "mel-g" was added. (cf.[tm-ja:1661])
+
+        * mel.el: gzip64 support was added. (cf.[tm-ja:1661])
+
+        * mel-g.el: New file.
+        gzip64 encoder/decoder. `gzip64' is an experimental encoding.
+	(cf.[tm-ja:1661])
+
+
+Mon Mar  4 09:13:20 1996  Morioka Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: Version 3.3.1 was released.
+
+	* mel-els: New module
+
+	* mk-mel: use mel-els file.
+
+Thu Jan 18 10:26:38 1996  Morioka Tomohiko  <morioka@jaist.ac.jp>
+
+	* Makefile: Yoshiyuki Yamagami <yamagami@hb.nmcc.co.jp>'s patch
+ 	was applied to specify `-no-site-file' option. (cf. [tm-ja:1474])
+
+Thu Jan 18 01:55:25 1996  Yoshiyuki Yamagami <yamagami@hb.nmcc.co.jp>
+
+	* Makefile: specify `-no-site-file' option (cf. [tm-ja:1474])
+
+
+Wed Jan  9 19:09:44 1996  Morioka Tomohiko  <morioka@jaist.ac.jp>
+
+	* MEL: version 3.3 was released.
+
+Tue Jan  9 18:25:22 1996  Morioka Tomohiko  <morioka@jaist.ac.jp>
+
+	* mel-u.el (uuencode-external-decode-region):
+	don't display uuencode output.
+	(cf. [tm-en:253])
+# Makefile for TM lisp code
+
+# This file is part of XEmacs.
+
+# XEmacs is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+
+# XEmacs is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with XEmacs; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+VERSION = 1.02
+PACKAGE = tm
+PKG_TYPE = regular
+REQUIRES = gnus vm mailcrypt mail-lib xemacs-base
+CATEGORY = comm
+
+ELCS = char-util.elc cless.elc gnus-art-mime.elc gnus-charset.elc \
+	gnus-mime.elc gnus-sum-mime.elc latex-math-symbol.elc mel-b.elc \
+	mel-g.elc mel-q.elc mel-u.elc mel.elc message-mime.elc \
+	mime-setup.elc mu-bbdb.elc mu-cite.elc range.elc sc-setup.elc \
+	signature.elc texi-util.elc tl-atype.elc tl-list.elc tl-misc.elc \
+	tl-num.elc tl-seq.elc tl-str.elc tm-bbdb.elc tm-def.elc \
+	tm-edit-mc.elc tm-edit.elc tm-ew-d.elc tm-ew-e.elc tm-file.elc \
+	tm-ftp.elc tm-html.elc tm-image.elc tm-latex.elc tm-mail.elc \
+	tm-mh-e.elc tm-parse.elc tm-partial.elc tm-pgp.elc tm-play.elc \
+	tm-rmail.elc tm-setup.elc tm-tar.elc tm-text.elc tm-view.elc \
+	tm-vm.elc tmh-comp.elc tu-comment.elc tu-replace.elc
+
+include ../../XEmacs.rules
+
+.RECURSIVE: texi
+.PHONY: texi
+
+all:: $(ELCS) auto-autoloads.elc texi
+
+texi:
+	$(MAKE) EMACS=xemacs -C texi info
+
+srckit: srckit-std
+
+binkit: all
+	rm -rf $(STAGING)/lisp/$(PACKAGE)
+	rm -rf $(STAGING)/info/tm-*.info*
+	-mkdir -p $(STAGING)/lisp/$(PACKAGE)
+	-mkdir -p $(STAGING)/info
+	cp -a ChangeLog *.el* $(STAGING)/lisp/$(PACKAGE)
+	cp -a texi/*.info* $(STAGING)/info
+	(cd $(STAGING); \
+	rm -f $(PACKAGE)-$(VERSION)-pkg.tar*; \
+	tar cf $(PACKAGE)-$(VERSION)-pkg.tar lisp/$(PACKAGE) \
+		info/tm-*.info*; \
+	gzip -v9 $(PACKAGE)-$(VERSION)-pkg.tar)
+;;; char-util.el --- character utility
+
+;; Copyright (C) 1996,1997 MORIOKA Tomohiko
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Version: $Id$
+;; Keywords: character, Emacs/mule
+
+;; This file is not part of tl (Tiny Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(defun row-line-to-char (r l)
+  (int-char (+ (* r 16) l))
+  )
+
+(defun row-line-to-string (r l)
+  (char-to-string (row-line-to-char r l))
+  )
+
+(defun print-row-line (r l)
+  (interactive (and (looking-at "\\([0-9]+\\)/\\([0-9]+\\)")
+		    (list (string-to-number
+			   (buffer-substring (match-beginning 1)
+					     (match-end 1)))
+			  (string-to-number
+			   (buffer-substring (match-beginning 2)
+					     (match-end 2)))
+			  )))
+  (message (row-line-to-string r l))
+  )
+
+(defun char-to-row-line-form (chr)
+  (setq chr (char-int chr))
+  (format "%d/%d" (/ chr 16)(mod chr 16))
+  )
+
+(defun char-to-byte-list (chr)
+  (let ((rest (mapcar (function identity)
+		      (char-to-string chr))
+	      ))
+    (if (cdr rest)
+	(cons (car rest)
+	      (mapcar (lambda (byte)
+			(logand byte 127)
+			)
+		      (cdr rest)))
+      (cons 'ascii rest)
+      )))
+
+(defun char-to-row-cell-form (chr)
+  (let ((cl (char-to-byte-list chr)))
+    (if (= (length cl) 2)
+	(char-to-row-line-form (nth 1 cl))
+      (format "%02d-%02d" (- (nth 1 cl) 32)(- (nth 2 cl) 32))
+      )))
+
+(defun show-char-info (char)
+  (interactive (list (char-after (point))))
+  (let ((cl (char-to-byte-list char)))
+    (message (format "%s: %s %s"
+		     (charset-description (car cl))
+		     (mapconcat (lambda (byte)
+				  (format "%02x" byte)
+				  )
+				(cdr cl) "")
+		     (if (= (length cl) 2)
+			 (char-to-row-line-form (nth 1 cl))
+		       (format "%02d-%02d" (- (nth 1 cl) 32)(- (nth 2 cl) 32))
+		       )
+		     ))))
+
+
+;;; @ end
+;;;
+
+(provide 'char-util)
+
+;;; char-util.el ends here
+;;; cless.el --- Common lisp and Emacs Lisp source sharing
+
+;; Copyright (C) 1996 MORIOKA Tomohiko
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Version:
+;;	$Id$
+;; Keywords: common lisp
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; 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 'cl)
+
+(defun call-after-loaded (module func &optional hook-name)
+  "If MODULE is provided, then FUNC is called.
+Otherwise func is set to MODULE-load-hook.
+If optional argument HOOK-NAME is specified,
+it is used as hook to set. [cless.el; imported from tl-misc.el]"
+  (if (featurep module)
+      (funcall func)
+    (progn
+      (if (null hook-name)
+	  (setq hook-name
+		(intern (concat (symbol-name module) "-load-hook")))
+	)
+      (add-hook hook-name func)
+      )))
+
+(defun define-cless-alias (alias func)
+  (defalias alias func)
+  (call-after-loaded
+   'cl-macs
+   (` (lambda ()
+	(define-compiler-macro (, alias) (&rest args)
+	  (cons (, (list 'quote func)) args)
+	  ))
+      ))
+  )
+
+(define-cless-alias 'FLOOR 'floor*)
+(define-cless-alias 'CEILING 'ceiling*)
+(define-cless-alias 'TRUNCATE 'truncate*) 
+(define-cless-alias 'ROUND 'round*)
+(define-cless-alias 'MOD 'mod*)
+
+(define-cless-alias 'DELETE 'delete*)
+(define-cless-alias 'SORT 'sort*)
+(define-cless-alias 'MEMBER 'member*)
+(define-cless-alias 'ASSOC  'assoc*)
+(define-cless-alias 'RASSOC  'rassoc*)
+
+(define-cless-alias 'MAPCAR 'mapcar*)
+
+(define-cless-alias 'DEFUN 'defun*)
+
+
+
+;;; @ end
+;;;
+
+(provide 'cless)
+
+;;; cless.el ends here
+;;; gnus-art-mime.el --- MIME extension for article mode of Gnus
+
+;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1996/8/6
+;; Version:
+;;	$Id$
+;; Keywords: news, MIME, multimedia, multilingual, encoded-word
+
+;; This file is not part of GNU Emacs yet.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'emu)
+(require 'gnus-mime)
+(require 'gnus-art)
+(require 'tm-view)
+
+(autoload 'mime-eword/decode-region "tm-ew-d"
+  "Decode MIME encoded-words in region." t)
+(autoload 'mime/decode-message-header "tm-ew-d"
+  "Decode MIME encoded-words in message header." t)
+
+
+;;; @ encoded-word
+;;;
+
+;;; `gnus-decode-rfc1522' of Gnus works only Q-encoded iso-8859-1
+;;; encoded-words.  In addition, it does not apply decoding rule of
+;;; RFC 1522 and it does not do unfolding.  So gnus-mime defines own
+;;; function using tm-ew-d.
+
+(defun gnus-decode-encoded-word ()
+  (goto-char (point-min))
+  (if (re-search-forward "^[0-9]+\t" nil t)
+      (progn
+	(goto-char (point-min))
+	;; for XOVER
+	(while (re-search-forward "^[0-9]+\t\\([^\t]+\\)\t" nil t)
+	  (mime-eword/decode-region (match-beginning 1) (match-end 1)
+				    'unfolding 'must-unfold)
+	  (if (re-search-forward "[^\t]+" nil t)
+	      (mime-eword/decode-region (match-beginning 0)(match-end 0)
+					'unfolding 'must-unfold)
+	    )
+	  ))
+    (mime-eword/decode-region (point-min)(point-max) t)
+    ))
+
+(defalias 'gnus-decode-rfc1522 'gnus-decode-encoded-word)
+
+;; In addition, latest RFC about encoded-word is RFC 2047. (^_^;
+
+
+;;; @ article filter
+;;;
+
+(defun gnus-article-preview-mime-message ()
+  (make-local-variable 'tm:mother-button-dispatcher)
+  (setq tm:mother-button-dispatcher
+	(function gnus-article-push-button))
+  (let ((mime-viewer/ignored-field-regexp "^:$")
+	(default-mime-charset
+	  (save-excursion
+	    (set-buffer gnus-summary-buffer)
+	    default-mime-charset))
+	)
+    (save-window-excursion
+      (mime/viewer-mode nil nil nil gnus-original-article-buffer
+			gnus-article-buffer
+			gnus-article-mode-map)
+      ))
+  (run-hooks 'tm-gnus/article-prepare-hook)
+  )
+
+(defun gnus-article-decode-encoded-word ()
+  (decode-mime-charset-region (point-min)(point-max)
+			      (save-excursion
+				(set-buffer gnus-summary-buffer)
+				default-mime-charset))
+  (mime/decode-message-header)
+  (run-hooks 'tm-gnus/article-prepare-hook)
+  )
+
+
+;;; @ for tm-view
+;;;
+
+(defun gnus-content-header-filter ()
+  (goto-char (point-min))
+  (mime-preview/cut-header)
+  (decode-mime-charset-region (point-min)(point-max) default-mime-charset)
+  (mime/decode-message-header)
+  )
+
+(defun mime-viewer/quitting-method-for-gnus ()
+  (if (not gnus-show-mime)
+      (mime-viewer/kill-buffer))
+  (delete-other-windows)
+  (gnus-article-show-summary)
+  (if (or (not gnus-show-mime)
+	  (null gnus-have-all-headers))
+      (gnus-summary-select-article nil t)
+    ))
+
+(call-after-loaded
+ 'tm-view
+ (lambda ()
+   (set-alist 'mime-viewer/content-header-filter-alist
+	      'gnus-original-article-mode
+	      (function gnus-content-header-filter))
+   
+   (set-alist 'mime-viewer/code-converter-alist
+	      'gnus-original-article-mode
+	      (function mime-charset/decode-buffer))
+   
+   (set-alist 'mime-viewer/quitting-method-alist
+	      'gnus-original-article-mode
+	      (function mime-viewer/quitting-method-for-gnus))
+   
+   (set-alist 'mime-viewer/show-summary-method
+	      'gnus-original-article-mode
+	      (function mime-viewer/quitting-method-for-gnus))
+   ))
+
+
+;;; @ for BBDB
+;;;
+
+(call-after-loaded
+ 'bbdb
+ (function
+  (lambda ()
+    (require 'tm-bbdb)
+    )))
+
+(autoload 'tm-bbdb/update-record "tm-bbdb")
+
+(defun tm-gnus/bbdb-setup ()
+  (if (and (boundp 'gnus-article-prepare-hook)
+	   (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
+	   )
+      (progn
+	(remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
+	(add-hook 'gnus-article-display-hook 'tm-bbdb/update-record)
+	)))
+
+(add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)
+
+(tm-gnus/bbdb-setup)
+
+
+;;; @ end
+;;;
+
+(provide 'gnus-art-mime)
+
+;;; gnus-art-mime.el ends here
+;;; gnus-charset.el --- MIME charset extension for Gnus
+
+;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1996/8/6
+;; Version:
+;;	$Id$
+;; Keywords: news, MIME, multimedia, multilingual, encoded-word
+
+;; This file is not part of GNU Emacs yet.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'gnus)
+;; Don't ask and I won't tell ... :-( :-( :-( :-(
+(eval-when-compile (require 'emu))
+
+(defvar gnus-is-red-gnus-or-later
+  (or (featurep 'gnus-load)
+      (module-installed-p 'gnus-sum)
+      ))
+
+
+;;; @ newsgroup default charset
+;;;
+
+(defvar gnus-newsgroup-default-charset-alist nil)
+
+(defun gnus-set-newsgroup-default-charset (newsgroup charset)
+  "Set CHARSET for the NEWSGROUP as default MIME charset."
+  (let* ((ng-regexp (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)"))
+	 (pair (assoc ng-regexp gnus-newsgroup-default-charset-alist))
+	 )
+    (if pair
+	(setcdr pair charset)
+      (setq gnus-newsgroup-default-charset-alist
+	    (cons (cons ng-regexp charset)
+		  gnus-newsgroup-default-charset-alist))
+      )))
+
+
+;;; @ for mule (Multilingual support)
+;;;
+
+(cond
+ ((featurep 'mule)
+  (require 'emu)
+  (defvar nntp-open-binary-connection-function
+    (if gnus-is-red-gnus-or-later
+	;; maybe Red Gnus
+	(if (boundp 'nntp-open-connection-function)
+	    nntp-open-connection-function
+	  'nntp-open-network-stream)
+      ;; maybe Gnus 5.[01] or Gnus 5.[23]
+      (if (boundp 'nntp-open-server-function)
+	  nntp-open-server-function
+	'nntp-open-network-stream)
+      ))
+  (defun nntp-open-network-stream-with-no-code-conversion (&rest args)
+    (let ((proc (apply nntp-open-binary-connection-function args)))
+      (set-process-input-coding-system proc *noconv*)
+      proc))
+  (if gnus-is-red-gnus-or-later
+      (setq nntp-open-connection-function
+	    'nntp-open-network-stream-with-no-code-conversion)
+    (setq nntp-open-server-function
+	  'nntp-open-network-stream-with-no-code-conversion)
+    )
+  (call-after-loaded
+   'nnheader
+   (lambda ()
+     (defun nnheader-find-file-noselect (&rest args)
+       (as-binary-input-file
+        (let ((format-alist nil)
+              (auto-mode-alist (nnheader-auto-mode-alist))
+              (default-major-mode 'fundamental-mode)
+              (after-insert-file-functions ; for jam-code-guess
+               (if (memq 'jam-code-guess-after-insert-file-function
+                         after-insert-file-functions)
+                   '(jam-code-guess-after-insert-file-function))))
+          (apply 'find-file-noselect args)))
+       )
+     ;; Red Gnus 0.67 or later
+     (defun nnheader-insert-file-contents
+       (filename &optional visit beg end replace)
+       (as-binary-input-file
+        (let ((format-alist nil)
+              (auto-mode-alist (nnheader-auto-mode-alist))
+              (default-major-mode 'fundamental-mode)
+              (enable-local-variables nil)
+              (after-insert-file-functions ; for jam-code-guess
+               (if (memq 'jam-code-guess-after-insert-file-function
+                         after-insert-file-functions)
+                   '(jam-code-guess-after-insert-file-function))))
+          (insert-file-contents filename visit beg end replace))
+        )
+       ;; for gnspool on OS/2
+       (while (re-search-forward "\r$" nil t)
+	 (replace-match "")
+	 )
+       )
+     ;; imported from Red Gnus 0.66
+     (or (fboundp 'nnheader-auto-mode-alist)
+         (defun nnheader-auto-mode-alist ()
+           (let ((alist auto-mode-alist)
+                 out)
+             (while alist
+               (when (listp (cdar alist))
+                 (push (car alist) out))
+               (pop alist))
+             (nreverse out)))
+         )
+     ;; alias for Old Gnus
+     (defalias 'nnheader-insert-file-contents-literally
+       'nnheader-insert-file-contents)
+     ))
+  (call-after-loaded
+   'nnmail
+   (lambda ()
+     (defun nnmail-find-file (file)
+       "Insert FILE in server buffer safely. [gnus-charset.el]"
+       (set-buffer nntp-server-buffer)
+       (erase-buffer)
+       (let ((format-alist nil)
+             (after-insert-file-functions   ; for jam-code-guess
+              (if (memq 'jam-code-guess-after-insert-file-function
+                        after-insert-file-functions)
+                  '(jam-code-guess-after-insert-file-function)))
+	     )
+	 (as-binary-input-file
+	  (condition-case ()
+	      (progn (insert-file-contents file) t)
+	    (file-error nil))
+	  )))
+     ))
+  (defun gnus-prepare-save-mail-function ()
+    (setq file-coding-system *noconv*
+	  buffer-file-coding-system 'no-conversion)
+    )
+  (add-hook 'nnmail-prepare-save-mail-hook
+	    'gnus-prepare-save-mail-function)
+  
+  (gnus-set-newsgroup-default-charset "alt.chinese" 'hz-gb-2312)
+  (gnus-set-newsgroup-default-charset "alt.chinese.text.big5" 'cn-big5)
+  (gnus-set-newsgroup-default-charset "fj"	'iso-2022-jp-2)
+  (gnus-set-newsgroup-default-charset "han"    	'euc-kr)
+  (gnus-set-newsgroup-default-charset "hk"	'cn-big5)
+  (gnus-set-newsgroup-default-charset "hkstar"	'cn-big5)
+  (gnus-set-newsgroup-default-charset "relcom"	'koi8-r)
+  (gnus-set-newsgroup-default-charset "tw"	'cn-big5)
+  ))
+
+
+;;; @ end
+;;;
+
+(provide 'gnus-charset)
+
+;;; gnus-charset.el ends here
+;;; gnus-mime.el --- MIME extensions for Gnus
+
+;; Copyright (C) 1996,1997 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1996/8/6
+;; Version: $Revision$
+;; Keywords: news, MIME, multimedia, multilingual, encoded-word
+
+;; This file is not part of GNU Emacs yet.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'tl-misc)
+
+
+;;; @ version
+;;;
+
+(defconst gnus-mime-RCS-ID
+  "$Id$")
+
+(defconst gnus-mime-version
+  (get-version-string gnus-mime-RCS-ID))
+
+
+;;; @ variables
+;;;
+
+(defvar gnus-show-mime t
+  "*If non-nil, do mime processing of articles.
+The articles will simply be fed to the function given by
+`gnus-show-mime-method'.")
+
+(defvar gnus-show-mime-method 'gnus-article-preview-mime-message
+  "*Function to process a MIME message.
+The function is called from the article buffer.")
+
+(defvar gnus-decode-encoded-word-method 'gnus-article-decode-encoded-word
+  "*Function to decode a MIME encoded-words.
+The function is called from the article buffer.")
+
+(defvar gnus-parse-headers-hook
+  '(gnus-set-summary-default-charset gnus-decode-rfc1522)
+  "*A hook called before parsing the headers.")
+
+
+;;; @ load
+;;;
+
+(require 'gnus)
+(require 'gnus-charset)
+
+
+;;; @ end
+;;;
+
+(provide 'gnus-mime)
+
+(or gnus-is-red-gnus-or-later
+    (require 'gnus-mime-old)
+    )
+
+(call-after-loaded 'gnus-art (lambda ()
+			       (require 'gnus-art-mime)
+			       ))
+(call-after-loaded 'gnus-sum (lambda ()
+			       (require 'gnus-sum-mime)
+			       ))
+
+(run-hooks 'gnus-mime-load-hook)
+
+;;; gnus-mime.el ends here
+;;; gnus-sum-mime.el --- MIME extension for summary mode of Gnus
+
+;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1996/8/6
+;; Version:
+;;	$Id$
+;; Keywords: news, MIME, multimedia, multilingual, encoded-word
+
+;; This file is not part of GNU Emacs yet.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'gnus-mime)
+(require 'gnus-sum)
+
+
+;;; @ summary filter
+;;;
+
+(defun gnus-set-summary-default-charset ()
+  (let ((charset
+	 (if (buffer-live-p gnus-summary-buffer)
+	     (save-excursion
+	       (set-buffer gnus-summary-buffer)
+	       (let ((ret (assoc-if (function
+				     (lambda (key)
+				       (string-match key gnus-newsgroup-name)
+				       ))
+				    gnus-newsgroup-default-charset-alist)
+			  ))
+		 (if ret
+		     (progn
+		       (make-local-variable 'default-mime-charset)
+		       (setq default-mime-charset (cdr ret))
+		       ))
+		 )
+	       default-mime-charset)
+	   default-mime-charset)))
+    (goto-char (point-min))
+    (while (< (point)(point-max))
+      (decode-mime-charset-region (point) (point-at-eol) charset)
+      (end-of-line)
+      (let (signal-error-on-buffer-boundary) ; for XEmacs
+	(forward-char))
+      )))
+
+
+;;; @ command functions
+;;;
+
+(defun gnus-summary-preview-mime-message (arg)
+  "MIME decode and play this message."
+  (interactive "P")
+  (let ((gnus-break-pages nil))
+    (gnus-summary-select-article t t)
+    )
+  (pop-to-buffer gnus-original-article-buffer t)
+  (let (buffer-read-only)
+    (if (text-property-any (point-min) (point-max) 'invisible t)
+	(remove-text-properties (point-min) (point-max)
+				gnus-hidden-properties)
+      ))
+  (mime/viewer-mode nil nil nil gnus-original-article-buffer
+		    gnus-article-buffer)
+  )
+
+(defun gnus-summary-scroll-down ()
+  "Scroll down one line current article."
+  (interactive)
+  (gnus-summary-scroll-up -1)
+  )
+
+(define-key gnus-summary-mode-map "v"
+  (function gnus-summary-preview-mime-message))
+(define-key gnus-summary-mode-map "\e\r"
+  (function gnus-summary-scroll-down))
+
+
+;;; @ for tm-partial
+;;;
+
+(defun gnus-mime-partial-preview-function ()
+  (gnus-summary-preview-mime-message (gnus-summary-article-number))
+  )
+
+(call-after-loaded
+ 'tm-partial
+ (function
+  (lambda ()
+    (set-atype 'mime/content-decoding-condition
+	       '((type . "message/partial")
+		 (method . mime-article/grab-message/partials)
+		 (major-mode . gnus-original-article-mode)
+		 (summary-buffer-exp . gnus-summary-buffer)
+		 ))
+    (set-alist 'tm-partial/preview-article-method-alist
+	       'gnus-original-article-mode
+	       'gnus-mime-partial-preview-function)
+    )))
+
+
+;;; @ end
+;;;
+
+(provide 'gnus-sum-mime)
+
+;;; gnus-sum-mime.el ends here

latex-math-symbol.el

+;;; latex-math-symbol.el --- LaTeX math symbol decoder
+
+;; Copyright (C) 1996,1997 MORIOKA Tomohiko
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1996/7/1
+;; Version:
+;;    $Id$
+;; Keywords: LaTeX, math, mule
+
+;; This file is part of MU (Message Utilities).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; - How to install
+;;	bytecompile this file and copy it to the apropriate directory.
+;; - How to use
+;;	If you use tm, please put following to your ~/.emacs:
+;;	  (autoload 'latex-math-decode-buffer "latex-math-symbol" nil t)
+;;	  (add-hook 'mime-viewer/plain-text-preview-hook
+;;		    'latex-math-decode-buffer)
+;;   Of course, it may be available for other hooks to filter messages.
+
+;;; Code:
+
+(defvar latex-math-symbol-table-alist
+  '(("\\alpha"		. ",Fa(B")
+    ("\\beta"		. ",Fb(B")
+    ("\\gamma"		. ",Fc(B")("\\Gamma"	. "$B&#(B")
+    ("\\delta"		. ",Fd(B")("\\Delta"	. "$B&$(B")
+    ("\\epsilon"	. ",Fe(B")("\\varepsilon"	. "$B&E(B")
+    ("\\zeta"		. ",Ff(B")
+    ("\\eta"		. ",Fg(B")
+    ("\\theta"		. ",Fh(B")("\\Theta"	. "$B&((B")
+    ("\\iota"		. ",Fi(B")
+    ("\\kappa"		. ",Fj(B")
+    ("\\lambda"		. ",Fk(B")("\\Lambda"	. "$B&+(B")
+    ("\\mu"		. ",Fl(B")
+    ("\\nu"		. ",Fm(B")
+    ("\\xi"		. ",Fn(B")("\\Xi"		. "$B&.(B")
+    ("\\pi"		. ",Fp(B")("\\Pi"		. "$B&0(B")
+    ("\\rho"		. ",Fq(B")
+    ("\\sigma"		. ",Fs(B")("\\Sigma"	. "$B&2(B")
+    ("\\varsigma"	. ",Fr(B")
+    ("\\tau"		. ",Ft(B")
+    ("\\upsilon"	. ",Fu(B")("\\Upsilon"	. "$B&4(B")
+    ("\\phi"		. "$B&U(B")("\\Phi"		. "$B&5(B")
+    ("\\varphi"		. ",Fv(B")
+    ("\\chi"		. ",Fw(B")
+    ("\\psi"		. ",Fx(B")("\\Psi"		. "$B&7(B")
+    ("\\omega"		. ",Fy(B")("\\Omega"	. "$B&8(B")
+    
+    ("\\{"		. "$B!P(B")("\\}"		. "$B!Q(B")
+    ("\\langle\\!\\langle" . "$B!T(B")("\\rangle\\!\\rangle" . "$B!U(B")
+    ("\\langle"		. "$B!R(B")("\\rangle"	. "$B!S(B")
+    
+    ("\\cdots"		. "$B!D(B")
+    
+    ("\\ln"		. "$(G"L(B")
+    ("\\log"		. "$(G"K(B")
+    
+    ("\\pm"		. "$B!^(B")
+    ("\\cdot"		. "$B!&(B")
+    ("\\times"		. "$B!_(B")("\\ast"		. "$B!v(B")
+    ("\\star"		. "$B!z(B")
+    ("\\bullet"		. "$B!&(B")
+    ("\\div"		. "$B!`(B")
+    ("\\cap"		. "$B"A(B")("\\cup"		. "$B"@(B")
+    ("\\lhd"		. "$(C"7(B")("\\rhd"		. "$(C"9(B")
+    ("\\bigcirc"	. "$B"~(B")
+    ("\\vee"		. "$B"K(B")("\\lor"		. "$B"K(B")
+    ("\\wedge"		. "$B"J(B")("\\land"	. "$B"J(B")
+    ("\\oplus"		. "$(G"S(B")
+    ("\\odot"		. "$(G"T(B")
+    ("\\dagger"		. "$B"w(B")("\\ddagger"	. "$B"x(B")
+    
+    ("\\leq"		. "$(C!B(B")("\\geq"		. "$(C!C(B")
+    ("\\le"		. "$(C!B(B")("\\ge"		. "$(C!C(B")
+    ("\\ll"		. "$B"c(B")("\\gg"		. "$B"d(B")
+    ("\\subseteq"	. "$B"<(B")("\\supseteq"	. "$B"=(B")
+    ("\\subset"		. "$B">(B")("\\supset"	. "$B"?(B")
+    ("\\in"		. "$B":(B")
+    ("\\ni"		. "$B";(B")("\\owns"	. "$B";(B")
+    ("\\frown"		. "$B"^(B")
+    ("\\mid"		. "$B!C(B")("\\parallel"	. "$B!B(B")
+    ("\\sim"		. "$B!A(B")
+    ("\\equiv"		. "$B"a(B")
+    ("\\approx"		. "$A!V(B")
+    ("\\not="		. "$B!b(B")
+    ("\\neq"		. "$B!b(B")("\\ne"		. "$B!b(B")
+    ("\\perp"		. "$B"](B")
+    
+    ("\\triangleup"	. "$B"$(B")
+    ("\\forall"		. "$B"O(B")
+    
+    ("\\hbar"		. ",C1(B")("\\imath"	. ",C9(B")
+    ("\\ell"		. "$(C'$(B")
+    ("\\partial"	. "$B"_(B")
+    ("\\infty"		. "$B!g(B")
+    ("\\smallint"	. "$B"i(B")
+    ("\\P"		. "$B"y(B")
+    ("\\prime"		. "$B!l(B")
+    ("\\nabla"		. "$B"`(B")
+    ("\\top"		. "$(D0#(B")("\\bot"		. "$(D0"(B")
+    ("\\vert"		. "$B!C(B")("\\Vert"	. "$B!B(B")
+    ("\\angle"		. "$B"\(B")
+    ("\\triangle"	. "$B"$(B")
+    ("\\backslash"	. "$B!@(B")
+    ("\\S"		. "$B!x(B")
+    ("\\forall"		. "$B"O(B")
+    ("\\exists"		. "$B"P(B")
+    ("\\neg"		. "$B"L(B")("\\lnot"	. "$B"L(B")
+    ("\\flat"		. "$B"u(B")("\\sharp"	. "$B"t(B")
+    ("\\clubsuit"	. "$(C"@(B")
+    ("\\diamondsuit"	. "$B!~(B")
+    ("\\heartsuit"	. "$(C"=(B")
+    ("\\spadesuit"	. "$(C"<(B")
+    
+    ("\\leftarrow"	. "$B"+(B")("\\rightarrow"	. "$B"*(B")
+    ("\\gets"		. "$B"+(B")("\\to"		. "$B"*(B")
+    
+    ("^1"		. ",A9(B")("^{1}"		. ",A9(B")
+    ("^2"		. ",A2(B")("^{2}"		. ",A2(B")
+    ("^3"		. ",A3(B")("^{3}"		. ",A3(B")
+    ("^4"		. "$(C)y(B")("^{4}"		. "$(C)y(B")
+    ("^n"		. "$(C)z(B")("^{n}"		. "$(C)z(B")
+    ("_1"		. "$(C){(B")("_{1}"		. "$(C){(B")
+    ("_2"		. "$(C)|(B")("_{2}"		. "$(C)|(B")
+    ("_3"		. "$(C)}(B")("_{3}"		. "$(C)}(B")
+    ("_4"		. "$(C)~(B")("_{4}"		. "$(C)~(B")
+    ))
+
+(defun latex-math-decode-region (beg end)
+  (interactive "r")
+  (save-restriction
+    (narrow-to-region beg end)
+    (let ((rest latex-math-symbol-table-alist)
+	  (case-fold-search nil)
+	  cell)
+      (while rest
+	(setq cell (car rest))
+	(goto-char beg)
+	(while (re-search-forward
+		(concat "\\("
+			(regexp-quote (car cell))
+			"\\)\\([^a-zA-Z]\\|$\\)")
+		nil t)
+	  (delete-region (match-beginning 1)(match-end 1))
+	  (goto-char (match-beginning 0))
+	  (insert (cdr cell))
+	  )
+	(setq rest (cdr rest))
+	))))
+
+(defun latex-math-decode-buffer ()
+  (interactive)
+  (latex-math-decode-region (point-min)(point-max))
+  )
+
+
+;;; @ end
+;;;
+
+(provide 'latex-math-symbol)
+
+;;; latex-math-symbol.el ends here
+;;; mel-b.el: Base64 encoder/decoder for GNU Emacs
+
+;; Copyright (C) 1992,1995,1996,1997 Free Software Foundation, Inc.
+
+;; Author: ENAMI Tsugutomo <enami@sys.ptg.sony.co.jp>
+;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1995/6/24
+;; Version: $Id$
+;; Keywords: MIME, Base64
+
+;; This file is part of MEL (MIME Encoding Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'emu)
+
+
+;;; @ variables
+;;;
+
+(defvar base64-external-encoder '("mmencode")
+  "*list of base64 encoder program name and its arguments.")
+
+(defvar base64-external-decoder '("mmencode" "-u")
+  "*list of base64 decoder program name and its arguments.")
+
+(defvar base64-internal-encoding-limit 1000
+  "*limit size to use internal base64 encoder.
+If size of input to encode is larger than this limit,
+external encoder is called.")
+
+(defvar base64-internal-decoding-limit 1000
+  "*limit size to use internal base64 decoder.
+If size of input to decode is larger than this limit,
+external decoder is called.")
+
+
+;;; @ internal base64 decoder/encoder
+;;;	based on base64 decoder by Enami Tsugutomo
+
+;;; @@ convert from/to base64 char
+;;;
+
+(defun base64-num-to-char (n)
+  (cond ((eq n nil) ?=)
+	((< n 26) (+ ?A n))
+	((< n 52) (+ ?a (- n 26)))
+	((< n 62) (+ ?0 (- n 52)))
+	((= n 62) ?+)
+	((= n 63) ?/)
+	(t (error "not a base64 integer %d" n))))
+
+(defun base64-char-to-num (c)
+  (cond ((and (<= ?A c) (<= c ?Z)) (- c ?A))
+	((and (<= ?a c) (<= c ?z)) (+ (- c ?a) 26))
+	((and (<= ?0 c) (<= c ?9)) (+ (- c ?0) 52))
+	((= c ?+) 62)
+	((= c ?/) 63)
+	((= c ?=) nil)
+	(t (error "not a base64 character %c" c))))
+
+
+;;; @@ encode/decode one base64 unit
+;;;
+
+(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))) "==")
+       ))))
+
+(defun base64-decode-1 (pack)
+  (let ((a (base64-char-to-num (car pack)))
+	(b (base64-char-to-num (nth 1 pack)))
+	(c (nth 2 pack))
+	(d (nth 3 pack)))
+    (concat (char-to-string (logior (ash a 2) (ash b -4)))
+	    (if (and c (setq c (base64-char-to-num c)))
+		(concat (char-to-string
+			 (logior (ash (logand b 15) 4) (ash c -2)))
+			(if (and d (setq d (base64-char-to-num d)))
+			    (char-to-string (logior (ash (logand c 3) 6) d))
+			  ))))))
+
+
+;;; @@ base64 encoder/decoder for string
+;;;
+
+(defun base64-encode-string (string)
+  "Encode STRING to base64, and return the result."
+  (let ((len (length string))
+	(b 0)(e 57)
+	dest)
+    (while (< e len)
+      (setq dest
+	    (concat dest
+		    (mapconcat
+		     (function base64-encode-1)
+		     (pack-sequence (substring string b e) 3)
+		     "")
+		    "\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) "==")
+			    ))
+      )))
+
+(defun base64-decode-string (string)
+  "Decode STRING which is encoded in base64, and return the result."
+  (mapconcat (function base64-decode-1)
+	     (pack-sequence string 4)
+	     ""))
+
+
+;;; @ base64 encoder/decoder for region
+;;;
+
+(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")
+	  )
+      )))
+
+(defun base64-internal-decode-region (beg end)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region beg end)
+      (goto-char (point-min))
+      (while (looking-at ".*\n")
+	(condition-case err
+	    (replace-match
+	     (base64-decode-string
+	      (buffer-substring (match-beginning 0) (1- (match-end 0))))
+	     t t)
+	  (error
+	   (prog1
+	       (message (nth 1 err))
+	     (replace-match "")))))
+      (if (looking-at ".*$")
+	  (condition-case err
+	      (replace-match
+	       (base64-decode-string
+		(buffer-substring (match-beginning 0) (match-end 0)))
+	       t t)
+	    (error
+	     (prog1
+		 (message (nth 1 err))
+	       (replace-match "")))
+	    ))
+      )))
+
+(defun base64-external-encode-region (beg end)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region beg end)
+      (as-binary-process (apply (function call-process-region)
+				beg end (car 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 "")
+	)
+      )))
+
+(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))
+		       )))
+
+(defun base64-encode-region (start end)
+  "Encode current region by base64.
+START and END are buffer positions.
+This function calls internal base64 encoder if size of region is
+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")
+  (if (and base64-internal-encoding-limit
+	   (> (- end start) base64-internal-encoding-limit))
+      (base64-external-encode-region start end)
+    (base64-internal-encode-region start end)
+    ))
+
+(defun base64-decode-region (start end)
+  "Decode current region by base64.
+START and END are buffer positions.
+This function calls internal base64 decoder if size of region is
+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
+	   (> (- end start) base64-internal-decoding-limit))
+      (base64-external-decode-region start end)
+    (base64-internal-decode-region start end)
+    ))
+
+
+;;; @ base64 encoder/decoder for file
+;;;
+
+(defun base64-insert-encoded-file (filename)
+  "Encode contents of file FILENAME to base64, and insert the result.
+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: ")))
+  (apply (function call-process) (car base64-external-encoder)
+	 filename t nil (cdr base64-external-encoder))
+  )
+
+
+;;; @ etc
+;;;
+
+(defun base64-encoded-length (string)
+  (let ((len (length string)))
+    (* (+ (/ len 3)
+	  (if (= (mod len 3) 0) 0 1)
+	  ) 4)
+    ))
+
+(defun pack-sequence (seq size)
+  "Split sequence SEQ into SIZE elements packs,
+and return list of packs. [mel-b; 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
+;;;
+
+(provide 'mel-b)
+
+;;; mel-b.el ends here.
+;;; mel-g.el: Gzip64 encoder/decoder for GNU Emacs
+
+;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
+;; Copyright (C) 1996 Shuhei KOBAYASHI
+
+;; Author: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
+;;	modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
+;; Created: 1995/10/25
+;; Version: $Id$
+;; Keywords: Gzip64, base64, gzip, MIME
+
+;; This file is not part of MEL (MIME Encoding Library) yet.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'emu)
+(require 'file-detect)
+
+
+;;; @ variables
+;;;
+
+(defvar gzip64-external-encoder
+  (let ((file (exec-installed-p "mmencode")))
+    (and 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"))))
+	 ))
+  "*list of gzip64 decoder program name and its arguments.")
+
+
+;;; @ encoder/decoder for region
+;;;
+
+(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))
+		       )
+    ;; for OS/2
+    ;;   regularize line break code
+    (goto-char (point-min))
+    (while (re-search-forward "\r$" nil t)
+      (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))
+		       )
+    ))
+
+(defalias 'gzip64-encode-region 'gzip64-external-encode-region)
+(defalias 'gzip64-decode-region 'gzip64-external-decode-region)
+
+
+;;; @ encoder/decoder for file
+;;;
+
+(defun gzip64-insert-encoded-file (filename)
+  (interactive (list (read-file-name "Insert encoded file: ")))
+  (apply (function call-process) (car gzip64-external-encoder)
+	 filename t nil
+	 (cdr gzip64-external-encoder))
+  )
+
+
+;;; @ end
+;;;
+
+(provide 'mel-g)
+
+;;; mel-g.el ends here.
+;;; mel-q.el: Quoted-Printable and Q-encoding encoder/decoder for GNU Emacs
+
+;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1995/6/25
+;; Version: $Id$
+;; Keywords: MIME, Quoted-Printable, Q-encoding
+
+;; This file is part of MEL (MIME Encoding Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; 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,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'emu)
+
+
+;;; @ Quoted-Printable encoder
+;;;
+
+(defconst quoted-printable-hex-chars "0123456789ABCDEF")
+
+(defsubst quoted-printable-quote-char (character)
+  (concat
+   "="
+   (char-to-string (aref quoted-printable-hex-chars (ash character -4)))
+   (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)
+	    enable-multibyte-characters)
+	(while (< (point)(point-max))
+	  (cond ((>= col 75)
+		 (insert "=\n")
+		 (setq col 0)
+		 )
+		((looking-at "^From ")
+		 (replace-match "=46rom ")
+		 (backward-char 1)
+		 (setq col (+ col 6))
+		 )
+		((looking-at "[ \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))
+			  ))
+		   )))
+	  )))))
+
+(defvar quoted-printable-external-encoder '("mmencode" "-q")
+  "*list of quoted-printable encoder program name and its arguments.")
+
+(defun quoted-printable-external-encode-region (start end)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region start end)
+      (as-binary-process
+       (apply (function call-process-region)
+	      start end (car 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 "")
+	)
+      )))
+
+(defvar quoted-printable-internal-encoding-limit
+  (if (and (featurep 'xemacs)(featurep 'mule))
+      0
+    (require 'file-detect)
+    (if (exec-installed-p "mmencode")
+	1000
+      (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,
+external encoder is called.")
+
+(defun quoted-printable-encode-region (start end)
+  "Encode current region by quoted-printable.
+START and END are buffer positions.
+This function calls internal quoted-printable encoder if size of
+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")
+  (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)
+    ))
+
+(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)
+    ))
+
+(defun quoted-printable-insert-encoded-file (filename)
+  "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))
+  )
+
+
+;;; @ Quoted-Printable decoder
+;;;
+
+(defun quoted-printable-decode-string (string)
+  "Decode STRING which is encoded in quoted-printable, and return the result."
+  (let (q h l)
+    (mapconcat (function
+		(lambda (chr)
+		  (cond ((eq chr ?=)
+			 (setq q t)
+			 "")
+			(q (setq h
+				 (cond ((<= ?a chr) (+ (- chr ?a) 10))
+				       ((<= ?A chr) (+ (- chr ?A) 10))
+				       ((<= ?0 chr) (- chr ?0))
+				       ))
+			   (setq q nil)
+			   "")
+			(h (setq l (cond ((<= ?a chr) (+ (- chr ?a) 10))
+					 ((<= ?A chr) (+ (- chr ?A) 10))
+					 ((<= ?0 chr) (- chr ?0))
+					 ))
+			   (prog1
+			       (char-to-string (logior (ash h 4) l))
+			     (setq h nil)
+			     )
+			   )
+			(t (char-to-string chr))
+			)))
+	       string "")))
+
+(defconst quoted-printable-octet-regexp
+  (concat "=[" quoted-printable-hex-chars
+	  "][" quoted-printable-hex-chars "]"))
+
+(defun quoted-printable-internal-decode-region (start end)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region start end)
+      (goto-char (point-min))
+      (while (re-search-forward "=\n" nil t)
+	(replace-match "")
+	)
+      (goto-char (point-min))
+      (let (b e str)
+	(while (re-search-forward quoted-printable-octet-regexp nil t)
+	  (setq b (match-beginning 0))
+	  (setq e (match-end 0))
+	  (setq str (buffer-substring b e))
+	  (delete-region b e)
+	  (insert (quoted-printable-decode-string str))
+	  ))
+      )))
+
+(defvar quoted-printable-external-decoder '("mmencode" "-q" "-u")
+  "*list of quoted-printable decoder program name and its arguments.")
+
+(defun quoted-printable-external-decode-region (start end)
+  (save-excursion
+    (as-binary-process
+     (apply (function call-process-region)
+	    start end (car quoted-printable-external-decoder)
+	    t t nil (cdr quoted-printable-external-decoder))
+     )))
+
+(defvar quoted-printable-internal-decoding-limit nil
+  "*limit size to use internal quoted-printable decoder.
+If size of input to decode is larger than this limit,
+external decoder is called.")
+
+(defun quoted-printable-decode-region (start end)
+  "Decode current region by quoted-printable.
+START and END are buffer positions.
+This function calls internal quoted-printable decoder if size of
+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")
+  (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)
+    ))
+
+
+;;; @ Q-encoding encode/decode string
+;;;
+
+(defconst q-encoding-special-chars-alist
+  '((text	?= ?? ?_)
+    (comment	?= ?? ?_ ?\( ?\) ?\\)
+    (phrase	?= ?? ?_ ?\( ?\) ?\\ ?\" ?# ?$ ?% ?& ?' ?, ?. ?/
+		?: ?\; ?< ?> ?@ ?\[ ?\] ?^ ?` ?{ ?| ?} ?~)
+    ))
+
+(defun q-encoding-encode-string (string &optional mode)
+  "Encode STRING to Q-encoding of encoded-word, and return the result.
+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)
+			   ))))
+    (mapconcat (function
+		(lambda (chr)
+		  (cond ((eq chr ? ) "_")
+			((or (< chr 32) (< 126 chr)
+			     (memq chr specials)
+			     )
+			 (quoted-printable-quote-char chr)
+			 )
+			(t
+			 (char-to-string chr)
+			 ))
+		  ))
+	       string "")
+    ))
+
+(defun q-encoding-decode-string (string)
+  "Decode STRING which is encoded in Q-encoding and return the result."
+  (let (q h l)
+    (mapconcat (function
+		(lambda (chr)
+		  (cond ((eq chr ?_) " ")
+			((eq chr ?=)
+			 (setq q t)
+			 "")
+			(q (setq h (cond ((<= ?a chr) (+ (- chr ?a) 10))
+					 ((<= ?A chr) (+ (- chr ?A) 10))
+					 ((<= ?0 chr) (- chr ?0))
+					 ))
+			   (setq q nil)
+			   "")
+			(h (setq l (cond ((<= ?a chr) (+ (- chr ?a) 10))
+					 ((<= ?A chr) (+ (- chr ?A) 10))
+					 ((<= ?0 chr) (- chr ?0))
+					 ))
+			   (prog1
+			       (char-to-string (logior (ash h 4) l))
+			     (setq h nil)
+			     )
+			   )
+			(t (char-to-string chr))
+			)))
+	       string "")))
+
+
+;;; @@ etc
+;;;
+
+(defun q-encoding-printable-char-p (chr mode)
+  (and (not (memq chr '(?= ?? ?_)))
+       (<= ?\   chr)(<= chr ?~)
+       (cond ((eq mode 'text) t)
+	     ((eq mode 'comment)
+	      (not (memq chr '(?\( ?\) ?\\)))
+	      )
+	     (t
+	      (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr))
+	      ))))
+
+(defun q-encoding-encoded-length (string &optional mode)
+  (let ((l 0)(i 0)(len (length string)) chr)
+    (while (< i len)
+      (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)) )
+    l))
+
+
+;;; @ end
+;;;
+
+(provide 'mel-q)
+
+;;; mel-q.el ends here