From 41d5dc858309ac959ea7305b10d776b1398c73d1 Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 9 Mar 1998 12:42:18 +0000 Subject: [PATCH] tm 7.40. --- Changes-7.40.en | 92 +++++++++++++++++++++++++ Makefile | 6 +- doc/tm-view=en.texi | 4 +- gnus/tm-sgnus.el | 55 ++++++++++++--- tm-def.el | 59 +++++++++++++++- tm-edit.el | 188 +++++++++++---------------------------------------- tm-ew-e.el | 73 ++++++++++++++------ tm-mule.el | 168 ++++++++++++--------------------------------- tm-nemacs.el | 38 +++++++---- tm-orig.el | 40 ++++++----- 10 files changed, 384 insertions(+), 339 deletions(-) create mode 100644 Changes-7.40.en diff --git a/Changes-7.40.en b/Changes-7.40.en new file mode 100644 index 0000000..a69d38f --- /dev/null +++ b/Changes-7.40.en @@ -0,0 +1,92 @@ +Wed Jan 17 08:27:26 1996 Morioka Tomohiko + + * tl: version 7.08 was released. + * tm: version 7.40 was released. + +Sun Jan 14 05:52:49 1996 Morioka Tomohiko + + * tm-edit.el (mime-editor/choose-charset): New implementation: use + function `mime/find-charset-region' instead of + `mime-body-charset-chooser'. + + * tm-edit.el: Variable `mime-body-charset-chooser' and its + implementations were deleted. + + * tm-edit.el (mime-editor/normalize-body): use variable + `mime/charset-default-encoding-alist' instead of function + `mime-editor/choose-encoding'. + + * tm-edit.el: Function `mime-editor/choose-encoding' was deleted. + +Fri Jan 12 13:59:13 1996 Morioka Tomohiko + + * tm-def.el (mime/find-charset-region): New function + + * tm-def.el (mime/charset-default-encoding-alist): New variable + +Thu Jan 11 18:31:43 1996 Morioka Tomohiko + + * tm-ew-e.el: Variable `mime/default-charset-encoding-alist' was + renamed to `mime-eword/charset-encoding-alist'. + + * tm-ew-e.el: Constant `mime/eword-encoder-version' was renamed to + `mime-eword/encoder-version'. + + * tm-ew-e.el: Variable `mime/default-charset-encoding-alist' was + moved from tm-def.el. + + * tm-def.el: Variable `mime/default-charset-encoding-alist' was + moved to tm-ew-e.el. + + * tm-ew-e.el: Function `mime/find-charset-rule' was renamed to + `tm-eword::find-charset-rule'. + + * tm-ew-e.el (mime/find-charset-rule): modified to use function + `mime/find-charset' + + * tm-def.el (mime/find-charset): new function + +Thu Jan 11 05:33:53 1996 Morioka Tomohiko + + * tm-ew-e.el (mime/find-charset-rule): new implementation + + * tm-orig.el: Variable `mime/decoding-charset-list' was deleted. + +Thu Jan 11 05:12:50 1996 Morioka Tomohiko + + * tm-nemacs.el, tm-orig.el: + Variable `mime/lc-charset-rule-list' was deleted. + + * tm-mule.el: + Variable `mime/lc-charset-rule-list' and + `mime/unknown-charset-rule' were deleted. + +Thu Jan 11 05:09:28 1996 Morioka Tomohiko + + * tm-def.el (mime/default-charset-encoding-alist): new variable + +Thu Jan 11 04:56:08 1996 Morioka Tomohiko + + * tm-orig.el, tm-nemacs.el, tm-mule.el + (mime/lc-charset-alist, mime/unknown-charset): new variable + +Wed Jan 10 00:07:57 1996 Morioka Tomohiko + + * tm-edit.el: + (mime-editor/translate-body, mime-editor/translate-region): + Spaces in boundary are replaced by underlines. + (cf. [tm-en:255,258]) + +Tue Jan 9 19:08:21 1996 Morioka Tomohiko + + * tm-mule.el: Obsolete definitions were deleted. + +Tue Jan 9 18:43:12 1996 Morioka Tomohiko + + * tm-orig.el, tm-nemacs.el, tm-mule.el: + Variable `mime/latin-lc-list' was deleted. + +Tue Jan 9 16:28:44 1996 Morioka Tomohiko + + * tm-orig.el, tm-nemacs.el, tm-mule.el: + Variable `mime/lc-charset-and-encoding-alist' was deleted. diff --git a/Makefile b/Makefile index 2d809f4..be126e2 100644 --- a/Makefile +++ b/Makefile @@ -31,14 +31,14 @@ TM_MUA_FILES = tm/tm-rmail.el tm/tm-vm.el tm/tm-mail.el \ tm/mh-e/Makefile tm/mh-e/mk-tmh tm/mh-e/code-jp.ol \ tm/mh-e/*.el tm/mh-e/ChangeLog-* -MEL_FILES = mel/*.el mel/Makefile mel/mk-mel mel/Changes* +MEL_FILES = mel/*.el mel/Makefile mel/mk-mel mel/ChangeLog TL_FILES = tl/README.en tl/Makefile tl/mk-tl tl/*.el tl/doc/*.texi \ - tl/Changes* + tl/ChangeLog FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(TL_FILES) -TARFILE = tm7.39.tar.gz +TARFILE = tm7.40.tar.gz 18: diff --git a/doc/tm-view=en.texi b/doc/tm-view=en.texi index fdde8a2..ae34168 100644 --- a/doc/tm-view=en.texi +++ b/doc/tm-view=en.texi @@ -1,4 +1,4 @@ -@c{$Id: tm-view=en.texi,v 7.7 1995/12/25 10:00:44 morioka Exp $} +@c{$Id: tm-view=en.texi,v 7.8 1995/12/26 00:23:32 morioka Exp $} @node tm-view, encoded-word, tm-MUA, Top @comment node-name, next, previous, up @@ -237,7 +237,7 @@ article buffer. As this time, tm-view modifies header and body of each contents of the message. It is done by definition for Content-Types. On the preview buffer created by tm-view, user can manipulate a -message to decode, such as run external vewer, extract files, or +message to decode, such as run external viewer, extract files, or print. Notice: In this document, I call @strong{content-type} as diff --git a/gnus/tm-sgnus.el b/gnus/tm-sgnus.el index 8798eea..dd7cf1f 100644 --- a/gnus/tm-sgnus.el +++ b/gnus/tm-sgnus.el @@ -8,7 +8,7 @@ ;;; MURATA Masahiro ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1995/09/24 -;;; Version: $Revision: 7.30 $ +;;; Version: $Revision: 7.33 $ ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -43,7 +43,7 @@ ;;; (defconst tm-gnus/RCS-ID - "$Id: tm-sgnus.el,v 7.30 1995/12/25 08:15:56 morioka Exp $") + "$Id: tm-sgnus.el,v 7.33 1996/01/09 12:06:29 morioka Exp $") (defconst tm-gnus/version (concat (get-version-string tm-gnus/RCS-ID) " for September")) @@ -94,10 +94,6 @@ This variable is set to `gnus-show-mime'.") (goto-char (point-min)) (search-forward "\n\n") 'invisible t) )) - (mime-viewer/ignored-field-regexp - (if hidden - "^:$" - mime-viewer/ignored-field-regexp)) (mime-viewer/redisplay t) ) (gnus-summary-select-article hidden t) @@ -172,8 +168,10 @@ This variable is set to `gnus-show-mime'.") (make-local-variable 'tm:mother-button-dispatcher) (setq tm:mother-button-dispatcher (function gnus-article-push-button)) - (mime/viewer-mode nil nil nil gnus-original-article-buffer - gnus-article-buffer) + (let ((mime-viewer/ignored-field-regexp "^:$")) + (mime/viewer-mode nil nil nil gnus-original-article-buffer + gnus-article-buffer) + ) (setq tm-gnus/automatic-mime-preview t) (run-hooks 'tm-gnus/article-prepare-hook) ) @@ -189,6 +187,47 @@ This variable is set to `gnus-show-mime'.") (function tm-gnus/article-decode-encoded-word)) +;;; @ for tm-edit +;;; + +(defun tm-gnus/forward-insert-buffer (buffer) + (save-excursion + (save-restriction + (if gnus-signature-before-forwarded-message + (goto-char (point-max)) + (goto-char (point-min)) + (re-search-forward + (concat "^" (regexp-quote mail-header-separator) "$")) + (forward-line 1)) + ;; Narrow to the area we are to insert. + (narrow-to-region (point) (point)) + ;; Insert the separators and the forwarded buffer. + (mime-editor/insert-tag "message" "rfc822") + (insert-buffer-substring buffer) + ;; Delete any invisible text. + (goto-char (point-min)) + (let (beg) + (while (setq beg (next-single-property-change (point) 'invisible)) + (goto-char beg) + (delete-region beg (or (next-single-property-change + (point) 'invisible) + (point-max)))))))) + +(call-after-loaded + 'mime-setup + (lambda () + (cond ((string-match "XEmacs" emacs-version) + (require 'gnus-msg) + (fset 'gnus-forward-insert-buffer 'tm-gnus/forward-insert-buffer) + ) + (t + (eval-after-load + "gnus-msg" + '(fset 'gnus-forward-insert-buffer 'tm-gnus/forward-insert-buffer) + ) + )))) + + ;;; @ for BBDB ;;; diff --git a/tm-def.el b/tm-def.el index 6284cec..26fcd6d 100644 --- a/tm-def.el +++ b/tm-def.el @@ -2,15 +2,30 @@ ;;; tm-def.el --- definition module for tm ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1995 MORIOKA Tomohiko +;;; Copyright (C) 1995,1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: tm-def.el,v 7.8 1995/12/23 12:43:20 morioka Exp $ +;;; $Id: tm-def.el,v 7.12 1996/01/12 13:59:13 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, definition ;;; ;;; This file is part of tm (Tools for MIME). ;;; +;;; 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. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'emu) (require 'tl-822) @@ -47,6 +62,44 @@ ) +;;; @ charset and encoding +;;; + +(defun mime/find-charset (lcl) + (if lcl + (or (cdr (some-element + (function + (lambda (elt) + (subsetp lcl (car elt)) + )) + mime/lc-charset-alist) + ) + mime/unknown-charset) + )) + +(defun mime/find-charset-region (beg end) + (mime/find-charset (cons lc-ascii (find-charset-region beg end))) + ) + +(defvar mime/charset-default-encoding-alist + '(("US-ASCII" . nil) + ("ISO-8859-1" . "quoted-printable") + ("ISO-8859-2" . "quoted-printable") + ("ISO-8859-3" . "quoted-printable") + ("ISO-8859-4" . "quoted-printable") +;;; ("ISO-8859-5" . "quoted-printable") + ("KOI8-R" . "quoted-printable") + ("ISO-8859-7" . "quoted-printable") + ("ISO-8859-8" . "quoted-printable") + ("ISO-8859-9" . "quoted-printable") + ("ISO-2022-JP" . nil) + ("ISO-2022-KR" . nil) + ("EUC-KR" . nil) + ("ISO-2022-JP-2" . nil) + ("ISO-2022-INT-1" . nil) + )) + + ;;; @ button ;;; @@ -277,3 +330,5 @@ ROT47 will be performed for Japanese text in any case." ;;; (provide 'tm-def) + +;;; tm-def.el ends here diff --git a/tm-edit.el b/tm-edit.el index 2d931ce..e79cd70 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -1,30 +1,31 @@ ;;; ;;; tm-edit.el --- Simple MIME Composer for GNU Emacs ;;; - -;; Copyright (C) 1993 UMEDA Masanobu -;; Copyright (C) 1994,1995 MORIOKA Tomohiko - -;; Author: UMEDA Masanobu -;; MORIOKA Tomohiko -;; Version: $Revision: 7.38 $ -;; Keywords: mail, news, MIME, multimedia, multilingual - -;; This file is not part of GNU Emacs. - -;; GNU Emacs 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. - -;; GNU Emacs 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, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; Copyright (C) 1993 UMEDA Masanobu +;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; +;;; Author: UMEDA Masanobu +;;; MORIOKA Tomohiko +;;; Maintainer: MORIOKA Tomohiko +;;; Created: 1994/08/21 renamed from mime.el +;;; Version: $Revision: 7.40 $ +;;; Keywords: mail, news, MIME, multimedia, multilingual +;;; +;;; This file is part of tm (Tools for MIME). +;;; +;;; 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. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Commentary: @@ -49,7 +50,7 @@ ;; definition to load mime/editor-mode automatically: ;; ;; (autoload 'mime/editor-mode "tm-edit" -;; "Minor mode for editing MIME message." t) +;; "Minor mode for editing MIME message." t) ;; ;; In case of Mail mode (includes VM mode), you need the following ;; hook definition: @@ -105,11 +106,6 @@ ;; ;;--[[audio/basic][base64]]^M...audio encoded in base64 comes here... -;; LCD Archive Entry: -;; mime|Masanobu UMEDA|umerin@mse.kyutech.ac.jp| -;; Simple MIME Composer| -;; $Date: 1995/12/21 18:27:09 $|$Revision: 7.38 $|~/misc/mime.el.Z| - ;;; Code: (require 'sendmail) @@ -126,7 +122,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.38 1995/12/21 18:27:09 morioka Exp $") + "$Id: tm-edit.el,v 7.40 1996/01/14 05:52:49 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -153,19 +149,6 @@ If non-nil, the text tag is not inserted unless something different.") (defvar mime-auto-hide-body t "*Hide non-textual body encoded in base64 after insertion if non-nil.") -(defvar mime-body-charset-chooser - (cond ((boundp 'NEMACS) - (function mime-body-charset-chooser-for-nemacs)) - ((featurep 'mule) - (function mime-body-charset-chooser-for-mule)) - ((string-match "^19\\." emacs-version) - (function mime-body-charset-chooser-for-emacs19)) - (t ;ASCII only emacs - (function mime-body-charset-chooser-for-emacs18))) - "*Function to identify charset and encoding of a text in a given region. -The value is a form of (CHARSET . ENCODING), where ENCODING must be a -full name, such as base64.") - (defvar mime-string-encoder (cond ((boundp 'NEMACS) (function mime-string-encoder-for-nemacs)) @@ -708,11 +691,6 @@ User customizable variables (not documented all of them): Hide a non-textual body message encoded in base64 after insertion if non-nil. - mime-body-charset-chooser - Specifies a function to identify charset and encoding of a text in - a given region. The value is a form of (CHARSET . ENCODING), - where ENCODING must be a full name, such as base64. - mime-string-encoder Specifies a function to encode a string for given encoding method. The method is a form of (CHARSET . ENCODING). @@ -830,7 +808,7 @@ just return to previous mode." (defun mime-editor/insert-text () "Insert a text message. -Charset is automatically obtained from the mime-body-charset-chooser." +Charset is automatically obtained from the `mime/lc-charset-alist'." (interactive) (if (and (mime-editor/insert-tag "text" nil nil) (looking-at mime-editor/single-part-tag-regexp)) @@ -1222,17 +1200,8 @@ Optional argument ENCODING specifies an encoding method such as base64." (defun mime-editor/choose-charset () "Choose charset of a text following current point." - (save-excursion - (let* ((beg (point)) - (end (mime-editor/content-end))) - (car (funcall mime-body-charset-chooser beg end))))) - -(defun mime-editor/choose-encoding () - "Choose encoding of a text following current point." - (save-excursion - (let* ((beg (point)) - (end (mime-editor/content-end))) - (cdr (funcall mime-body-charset-chooser beg end))))) + (mime/find-charset-region (point) (mime-editor/content-end)) + ) (defun mime-make-text-tag (&optional subtype) "Make a tag for a text after current point. @@ -1791,12 +1760,13 @@ Content-Transfer-Encoding: 7bit (interactive) (save-excursion (let ((boundary - (concat mime-multipart-boundary " " (current-time-string))) + (concat mime-multipart-boundary "_" + (replace-space-with-underline (current-time-string)) + )) (i 1) - (time (current-time-string)) ret) (while (mime-editor/process-multipart-1 - (format "%s %s-%d" mime-multipart-boundary time i)) + (format "%s-%d" boundary i)) (setq i (1+ i)) ) (save-restriction @@ -1818,7 +1788,7 @@ Content-Transfer-Encoding: 7bit (point)))) (setq ret (mime-editor/translate-region beg end - (format "%s %s-%d" mime-multipart-boundary time i))) + (format "%s-%d" boundary i))) )) (let ((contype (car ret)) ;Content-Type (encoding (nth 1 ret)) ;Content-Transfer-Encoding @@ -1846,7 +1816,8 @@ Content-Transfer-Encoding: 7bit (defun mime-editor/translate-region (beg end &optional boundary multipart) (if (null boundary) (setq boundary - (concat mime-multipart-boundary " " (current-time-string))) + (concat mime-multipart-boundary "_" + (replace-space-with-underline (current-time-string)))) ) (save-excursion (save-restriction @@ -1954,7 +1925,10 @@ Content-Transfer-Encoding: 7bit ;; Point is now on current tag. ;; Define encoding and encode text if necessary. (if (null encoding) ;Encoding is not specified. - (let* ((encoding (mime-editor/choose-encoding)) + (let* ((encoding + (cdr + (assoc charset mime/charset-default-encoding-alist) + )) (beg (mime-editor/content-beginning)) (end (mime-editor/content-end)) (body (buffer-substring beg end)) @@ -2005,12 +1979,6 @@ Content-Transfer-Encoding: 7bit ;; Emacs 18 implementations -(defun mime-body-charset-chooser-for-emacs18 (begin end) - "Return a cons of charset and encoding of a message in a given region. -Encoding name must be a canonical name, such as `base64'." - '("US-ASCII" . nil) ;Default charset of MIME. - ) - (defun mime-string-encoder-for-emacs18 (method string) "For given METHOD that is a cons of charset and encoding, encode a STRING." (let ((charset (car method)) @@ -2024,18 +1992,6 @@ Encoding name must be a canonical name, such as `base64'." ;; Emacs 19 implementations -(defun mime-body-charset-chooser-for-emacs19 (begin end) - "Return a cons of charset and encoding of a message in a given region. -Encoding name must be a canonical name, such as `base64'. -US-ASCII and ISO-8859-1 are supported on Emacs 19." - (cond ((save-excursion - (goto-char begin) - (re-search-forward "[\200-\377]" end t)) - '("ISO-8859-1" . "quoted-printable")) - (t - '("US-ASCII" . nil)) ;Default charset of MIME. - )) - (defun mime-string-encoder-for-emacs19 (method string) "For given METHOD that is a cons of charset and encoding, encode a STRING." (let ((charset (car method)) @@ -2049,22 +2005,6 @@ US-ASCII and ISO-8859-1 are supported on Emacs 19." ;; NEmacs implementations -(defun mime-body-charset-chooser-for-nemacs (begin end) - "Return a cons of charset and encoding of a message in a given region. -Encoding name must be a canonical name, such as `base64'. -US-ASCII and ISO-2022-JP are supported on NEmacs." - (cond ((check-region-kanji-code begin end) - ;; The following are safe encoding methods for use in - ;; USENET News systems that strip off all ESCs. - ;; '("ISO-2022-JP" . "quoted-printable") - ;; '("ISO-2022-JP" . "base64") - ;; The following expects transport systems are all MIME - ;; compliants. For instance, ESCs are never stripped off. - '("ISO-2022-JP" . nil)) - (t - '("US-ASCII" . nil)) ;Default charset of MIME. - )) - (defun mime-string-encoder-for-nemacs (method string) "For given METHOD that is a cons of charset and encoding, encode a STRING. US-ASCII and ISO-2022-JP are supported on NEmacs." @@ -2088,52 +2028,6 @@ US-ASCII and ISO-2022-JP are supported on NEmacs." ;; Thanks to contributions by wkenji@flab.fujitsu.co.jp (Kenji ;; WAKAMIYA) and handa@etl.go.jp (Kenichi Handa). -(defun mime-body-charset-chooser-for-mule (begin end) - "Return a cons of charset and encoding of a message in a given -region. Encoding name must be a canonical name, such as `base64'. -US-ASCII, ISO-8859-* (except for ISO-8859-6), ISO-2022-JP, -ISO-2022-JP-2 and ISO-2022-INT-1 are supported on Mule. Either of -charset ISO-2022-JP-2 or ISO-2022-INT-1 is used for multilingual text -in Mule." - (let ((lclist (find-charset-region begin end))) - (cond ((null lclist) - '("US-ASCII" . nil)) ;Default charset of MIME. - ;; Multilingual capability requred. - ((and (> (length lclist) 1) - (boundp '*iso-2022-int-1*)) - '("ISO-2022-INT-1" . nil)) - ((> (length lclist) 1) - '("ISO-2022-JP-2" . nil)) - ;; Simple charset. - ((memq lc-ltn1 lclist) - '("ISO-8859-1" . "quoted-printable")) - ((memq lc-ltn2 lclist) - '("ISO-8859-2" . "quoted-printable")) - ((memq lc-ltn3 lclist) - '("ISO-8859-3" . "quoted-printable")) - ((memq lc-ltn4 lclist) - '("ISO-8859-4" . "quoted-printable")) - ((memq lc-crl lclist) - '("ISO-8859-5" . "quoted-printable")) - ;;((memq lc-arb lclist) - ;; '("ISO-8859-6" . "quoted-printable")) - ((memq lc-grk lclist) - '("ISO-8859-7" . "quoted-printable")) - ((memq lc-hbw lclist) - '("ISO-8859-8" . "quoted-printable")) - ((memq lc-ltn5 lclist) - '("ISO-8859-9" . "quoted-printable")) - ((memq lc-jp lclist) - '("ISO-2022-JP" . nil)) - ((memq lc-kr lclist) - '("ISO-2022-KR" . nil)) - ;; Unknown charset. - ((boundp '*iso-2022-int-1*) - '("ISO-2022-INT-1" . nil)) - (t - '("ISO-2022-JP-2" . nil)) - ))) - (defun mime-string-encoder-for-mule (method string) "For given METHOD that is a cons of charset and encoding, encode a STRING. US-ASCII, ISO-8859-* (except for ISO-8859-6), ISO-2022-JP, diff --git a/tm-ew-e.el b/tm-ew-e.el index 203f0e5..7c554ce 100644 --- a/tm-ew-e.el +++ b/tm-ew-e.el @@ -1,13 +1,31 @@ ;;; -;;; tm-ew-d.el --- RFC 1522 based multilingual MIME message header +;;; tm-ew-e.el --- RFC 1522 based multilingual MIME message header ;;; encoder for GNU Emacs ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1993,1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko ;;; -;;; Author: MORIOKA Tomohiko +;;; Author: MORIOKA Tomohiko +;;; Version: $Revision: 7.12 $ ;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word ;;; +;;; This file is part of tm (Tools for MIME). +;;; +;;; 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. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'mel) (require 'tl-822) @@ -18,8 +36,8 @@ ;;; (defconst tm-ew-e/RCS-ID - "$Id: tm-ew-e.el,v 7.6 1995/12/01 13:03:44 morioka Exp $") -(defconst mime/eword-encoder-version (get-version-string tm-ew-e/RCS-ID)) + "$Id: tm-ew-e.el,v 7.12 1996/01/11 18:31:43 morioka Exp $") +(defconst mime-eword/encoder-version (get-version-string tm-ew-e/RCS-ID)) ;;; @ variables @@ -29,6 +47,24 @@ (defvar mime/use-X-Nsubject nil) +(defvar mime-eword/charset-encoding-alist + '(("US-ASCII" . nil) + ("ISO-8859-1" . "Q") + ("ISO-8859-2" . "Q") + ("ISO-8859-3" . "Q") + ("ISO-8859-4" . "Q") +;;; ("ISO-8859-5" . "Q") + ("KOI8-R" . "Q") + ("ISO-8859-7" . "Q") + ("ISO-8859-8" . "Q") + ("ISO-8859-9" . "Q") + ("ISO-2022-JP" . "B") + ("ISO-2022-KR" . "B") + ("EUC-KR" . "B") + ("ISO-2022-JP-2" . "B") + ("ISO-2022-INT-1" . "B") + )) + ;;; @ encoded-text encoder ;;; @@ -124,26 +160,19 @@ ;;; @ rule ;;; -(defun mime/find-charset-rule (lcl) +(defun tm-eword::find-charset-rule (lcl) (if lcl - (let ((ret (some-element - (function - (lambda (elt) - (subsetp lcl (car elt)) - )) - mime/lc-charset-rule-list) - )) - (if ret - (cdr ret) - mime/unknown-charset-rule) - ) - '(nil nil) - )) + (let* ((charset (mime/find-charset lcl)) + (encoding + (cdr (assoc charset mime-eword/charset-encoding-alist)) + )) + (list charset encoding) + ))) (defun tm-eword::words-to-ruled-words (wl) (mapcar (function (lambda (word) - (cons (cdr word) (mime/find-charset-rule (car word))) + (cons (cdr word) (tm-eword::find-charset-rule (car word))) )) wl)) @@ -354,7 +383,7 @@ (setq dest (append dest (list - (cons str (mime/find-charset-rule + (cons str (tm-eword::find-charset-rule (find-charset-string str))) ))) ) @@ -532,3 +561,5 @@ ;;; (provide 'tm-ew-e) + +;;; tm-ew-e.el ends here diff --git a/tm-mule.el b/tm-mule.el index 9eb71d4..0bd2cee 100644 --- a/tm-mule.el +++ b/tm-mule.el @@ -2,15 +2,30 @@ ;;; tm-mule.el --- tm definitions depended on Mule ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994,1995,1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: tm-mule.el,v 7.1 1995/10/03 04:49:53 morioka Exp $ +;;; $Id: tm-mule.el,v 7.6 1996/01/11 05:09:28 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). ;;; +;;; 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. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'emu) (require 'tl-list) @@ -40,121 +55,35 @@ )) -;;; @ charset and encoding +;;; @ leading-character and charset ;;; -(defvar mime/lc-charset-rule-list +(defvar mime/lc-charset-alist (list - (list (list lc-ascii) "US-ASCII" nil) - (list (list lc-ascii lc-ltn1) "ISO-8859-1" "Q") - (list (list lc-ascii lc-ltn2) "ISO-8859-2" "Q") - (list (list lc-ascii lc-ltn3) "ISO-8859-3" "Q") - (list (list lc-ascii lc-ltn4) "ISO-8859-4" "Q") -;;;(list (list lc-ascii lc-crl) "ISO-8859-5" "Q") - (list (list lc-ascii lc-crl) "KOI8-R" "Q") - (list (list lc-ascii lc-grk) "ISO-8859-7" "Q") - (list (list lc-ascii lc-hbw) "ISO-8859-8" "Q") - (list (list lc-ascii lc-ltn5) "ISO-8859-9" "Q") - (list (list lc-ascii lc-jp) "ISO-2022-JP" "B") - (list (list lc-ascii lc-kr) "EUC-KR" "B") - (list (list lc-ascii + (cons (list lc-ascii) "US-ASCII") + (cons (list lc-ascii lc-ltn1) "ISO-8859-1") + (cons (list lc-ascii lc-ltn2) "ISO-8859-2") + (cons (list lc-ascii lc-ltn3) "ISO-8859-3") + (cons (list lc-ascii lc-ltn4) "ISO-8859-4") +;;;(cons (list lc-ascii lc-crl) "ISO-8859-5") + (cons (list lc-ascii lc-crl) "KOI8-R") + (cons (list lc-ascii lc-grk) "ISO-8859-7") + (cons (list lc-ascii lc-hbw) "ISO-8859-8") + (cons (list lc-ascii lc-ltn5) "ISO-8859-9") + (cons (list lc-ascii lc-jp) "ISO-2022-JP") + (cons (list lc-ascii lc-kr) "EUC-KR") + (cons (list lc-ascii lc-jp lc-cn lc-kr lc-jp2 - lc-ltn1 lc-grk) "ISO-2022-JP-2" "B") - (list (list lc-ascii + lc-ltn1 lc-grk) "ISO-2022-JP-2") + (cons (list lc-ascii lc-jp lc-cn lc-kr lc-jp2 lc-cns1 lc-cns2 - lc-ltn1 lc-grk) "ISO-2022-INT-1" "B") - )) - -(defvar mime/unknown-charset-rule '("ISO-2022-INT-1" "B")) - - -;;; @ (obsoleted) -;;; - -(defvar mime/lc-charset-and-encoding-alist - (list - (cons lc-ascii nil) - (cons lc-jp '("ISO-2022-JP" . "B")) - (cons lc-cn '("ISO-2022-CN" . "B")) - (cons lc-kr '("EUC-KR" . "B")) - (cons lc-ltn1 '("ISO-8859-1" . "Q")) - (cons lc-ltn2 '("ISO-8859-2" . "Q")) - (cons lc-ltn3 '("ISO-8859-3" . "Q")) - (cons lc-ltn4 '("ISO-8859-4" . "Q")) - (cons lc-crl '("ISO-8859-5" . "B")) -;;;(cons lc-arb '("ISO-8859-6" . "B")) - (cons lc-grk '("ISO-8859-7" . "B")) - (cons lc-hbw '("ISO-8859-8" . "B")) - (cons lc-ltn5 '("ISO-8859-9" . "Q")) + lc-ltn1 lc-grk) "ISO-2022-INT-1") )) -(defvar mime/latin-lc-list - (list lc-ascii lc-ltn1 lc-ltn2 lc-ltn3 lc-ltn4 lc-ltn5)) - -(defvar mime/charset-lc-alist - (list - (cons "ISO-8859-1" lc-ltn1) ; Latin-1 - (cons "ISO-8859-2" lc-ltn2) ; Latin-2 - (cons "ISO-8859-3" lc-ltn3) ; Latin-3 - (cons "ISO-8859-4" lc-ltn4) ; Latin-4 - (cons "ISO-8859-5" lc-crl ) ; Cyrillic -;;;(cons "ISO-8859-6" lc-arb ) ; Arabic - (cons "ISO-8859-7" lc-grk ) ; Greek - (cons "ISO-8859-8" lc-hbw ) ; Hebrew - (cons "ISO-8859-9" lc-ltn5) ; Latin-5 - )) - -(defun mime/set-charset-and-encoding (lc cs charset encoding) - (setq mime/lc-charset-and-encoding-alist - (put-alist lc (cons charset encoding) - mime/lc-charset-and-encoding-alist)) - (if cs - (setq mime/charset-coding-system-alist - (put-alist charset cs mime/charset-coding-system-alist)) - (setq mime/charset-lc-alist - (put-alist charset lc mime/charset-lc-alist)) - )) -;;; example -;;; -;;; (mime/set-charset-and-encoding lc-kr *euc-kr* "EUC-KR" "B") -;;; (mime/set-charset-and-encoding lc-koi8 nil "KOI8" "B") - - -(defun mime/remove-leading-character (str) - (let ((dest "") (i 0) (len (length str)) chr) - (while (< i len) - (setq chr (elt str i)) - (if (< chr 128) - (progn - (setq dest (concat dest (char-to-string chr))) - (setq i (+ i 1)) - ) - (progn - (setq dest (concat dest (char-to-string (elt str (+ i 1))))) - (setq i (+ i 2)) - )) - ) - dest)) - -(defun mime/insert-leading-character (str lc) - (let ((lc-str (char-to-string lc)) - (dest "") - (i 0) (len (length str)) - chr chr-str) - (while (< i len) - (setq chr (elt str i)) - (setq chr-str (char-to-string chr)) - (setq dest (concat dest - (if (< chr 128) - chr-str - (concat lc-str chr-str) - ))) - (setq i (+ i 1)) - ) - dest)) +(defvar mime/unknown-charset "ISO-2022-INT-1") ;;; @ functions @@ -162,26 +91,15 @@ (defun mime/convert-string-to-emacs (charset str) (let ((cs (cdr (assoc charset mime/charset-coding-system-alist)))) - (cond (cs - (code-convert-string str cs *internal*) - ) - (t - (let ((lc (cdr (assoc charset mime/charset-lc-alist)))) - (if lc - (mime/insert-leading-character str lc) - ) - ))))) + (if cs + (code-convert-string str cs *internal*) + ))) (defun mime/convert-string-from-emacs (str charset) (let ((cs (cdr (assoc charset mime/charset-coding-system-alist)))) - (cond (cs - (code-convert-string str *internal* cs) - ) - (t - (if (assoc charset mime/charset-lc-alist) - (mime/remove-leading-character str) - str))))) - + (if cs + (code-convert-string str *internal* cs) + ))) (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding) (if (stringp charset) @@ -202,3 +120,5 @@ (provide 'tm-mule) (run-hooks 'tm-mule-load-hook) + +;;; tm-mule.el ends here diff --git a/tm-nemacs.el b/tm-nemacs.el index b180ce8..aad2249 100644 --- a/tm-nemacs.el +++ b/tm-nemacs.el @@ -2,15 +2,30 @@ ;;; tm-nemacs.el --- tm definitions depended on NEmacs ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994,1995,1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: tm-nemacs.el,v 7.2 1995/12/06 08:04:50 morioka Exp $ +;;; $Id: tm-nemacs.el,v 7.6 1996/01/11 05:12:50 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). ;;; +;;; 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. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'emu) @@ -20,22 +35,13 @@ (defvar mime/default-coding-system *junet*) -(defvar mime/lc-charset-rule-list +(defvar mime/lc-charset-alist (list - (list (list lc-ascii) "US-ASCII" nil) - (list (list lc-ascii lc-jp) "ISO-2022-JP" "B") + (cons (list lc-ascii) "US-ASCII") + (cons (list lc-ascii lc-jp) "ISO-2022-JP") )) - -;;; @@ (obsolete) -;;; - -(defvar mime/lc-charset-and-encoding-alist - (list (cons lc-ascii nil) - (cons lc-jp '("ISO-2022-JP" . "B")) - )) - -(defvar mime/latin-lc-list (list lc-ascii)) +(defvar mime/unknown-charset "ISO-2022-JP") ;;; @ functions @@ -70,3 +76,5 @@ (provide 'tm-nemacs) (run-hooks 'tm-nemacs-load-hook) + +;;; tm-nemacs.el ends here diff --git a/tm-orig.el b/tm-orig.el index aa02eb8..43e5ec5 100644 --- a/tm-orig.el +++ b/tm-orig.el @@ -2,15 +2,30 @@ ;;; tm-orig.el --- tm definitions depended on FSF Original Emacs ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994,1995,1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: tm-orig.el,v 7.1 1995/10/03 04:52:16 morioka Exp $ +;;; $Id: tm-orig.el,v 7.6 1996/01/11 05:15:05 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). ;;; +;;; 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. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'emu) @@ -20,24 +35,13 @@ (defvar mime/default-coding-system nil) -(defvar mime/lc-charset-rule-list +(defvar mime/lc-charset-alist (list - (list (list lc-ascii) "US-ASCII" nil) - (list (list lc-ascii lc-ltn1) "ISO-8859-1" "Q") + (cons (list lc-ascii) "US-ASCII") + (cons (list lc-ascii lc-ltn1) "ISO-8859-1") )) -(defvar mime/decoding-charset-list '("US-ASCII" "ISO-8859-1")) - - -;;; @@ (obsolete) -;;; - -(defvar mime/lc-charset-and-encoding-alist - (list (cons lc-ascii nil) - (cons lc-ltn1 '("ISO-8859-1" . "Q")) - )) - -(defvar mime/latin-lc-list (list lc-ascii lc-ltn1)) +(defvar mime/unknown-charset "ISO-8859-1") ;;; @ functions @@ -63,3 +67,5 @@ (provide 'tm-orig) (run-hooks 'tm-orig-load-hook) + +;;; tm-orig.el ends here -- 1.7.10.4