From: morioka Date: Tue, 10 Mar 1998 04:43:30 +0000 (+0000) Subject: tm 7.82. X-Git-Tag: tm7_82~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3059d264de1ed04e959a2392afdf35a501a167c;p=elisp%2Ftm.git tm 7.82. --- diff --git a/ChangeLog b/ChangeLog index 816933a..0b0793b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,86 @@ +Thu Sep 5 14:36:14 1996 MORIOKA Tomohiko + + * tl: Version 7.61.2 was released. + * tm: Version 7.82 was released. + * tm-mh-e: Version 7.68 was released. + * tm-gnus: Version 7.27 was released. + * gnus-mime: Version 0.7 was released. + + * Makefile: source tree was modified. + +Thu Sep 5 12:08:56 1996 MORIOKA Tomohiko + + * tm-edit.el (mime-editor/translate-header): New function. + (mime-editor/translate-buffer-hook): Use + `mime-editor/translate-header' instead of + `mime/encode-message-header'. + + * tm-def.el (mime-charset-type-list): add gb2312 as 8bit + charset. (cf. [kanji:704]) + +Thu Sep 5 04:49:18 1996 Alexandre Oliva + + (mime/editor-mode): The problem with resend message (S D r) in Red + Gnus is back. + +Wed Sep 4 22:02:02 1996 MORIOKA Tomohiko + + * tm-ew-e.el (mime/generate-X-Nsubject): New variable; variable + `mime/use-X-Nsubject' became obsolete. + (mime/encode-message-header): check X-Nsubject is already exist + when `mime/generate-X-Nsubject' is not nil. + +Wed Sep 4 21:42:51 1996 MORIOKA Tomohiko + + * tm-ew-e.el (mime/field-encoding-method-alist): New variable; + Variable `mime/no-encoding-header-fields' became obsolete. + (mime/encode-message-header): Use variable + `mime/field-encoding-method-alist'. + + * tm-ew-e.el (mime/use-X-Nsubject): add DOC-string. + + * tm-ew-e.el (mime/encode-message-header): Use iso-2022-jp-2 as + character encoding of X-Nsubject field. + + * tm-ew-e.el (mime/encode-field): Don't refer + `mime/no-encoding-header-fields'. + (mime/encode-message-header): New optional argument + `code-conversion'; Refer `mime/no-encoding-header-fields'. + + * mime-setup.el.in (message-maybe-setup-default-charset): Use + `buffer-live-p'. + + * inst-tm (compile-tm, install-tm): source directory of tm/mh-e + was moved to tm-mh-e. + +Wed Sep 4 15:32:36 1996 MORIOKA Tomohiko + + * TM-CFG: tm/mh-e was moved to tm-mh-e. + + * inst-tm: tm/mh-e was was moved to tm-mh-e. + +Wed Sep 4 14:18:38 1996 MORIOKA Tomohiko + + * TM-CFG (PREFIX): Use variable `install-prefix' as default value. + (LISPDIR): Use function `install-detect-elisp-directory'. + Variable `LISP_PREFIX' was abolished. + + * inst-tm: Function `install-tm-gnus' was abolished. + (compile-tm): Don't create .gnus-compile. + (install-tm): Don't use function `install-tm-gnus'. + + * TM-CFG: Variable `el-file-mode' was abolished. + + * TM-CFG: add "../gnus-mime" to load-path. + + * TM-CFG (Gnus_MIME_DIR): New variable. + +Wed Sep 4 11:43:29 1996 MORIOKA Tomohiko + + * mime-setup.el.in (message-maybe-setup-default-charset): New + function. + + Tue Sep 3 15:32:35 1996 MORIOKA Tomohiko * tl: Version 7.61.1 was released. diff --git a/Makefile b/Makefile index 7d35a1b..0c4f379 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 7.26 1996/09/03 15:32:35 morioka Exp $ +# $Id: Makefile,v 7.27 1996/09/05 14:36:14 morioka Exp $ # SHELL = /bin/sh @@ -34,11 +34,17 @@ TM_FILES = tm/README.en tm/ChangeLog \ tm/doc/Makefile tm/doc/*.ol tm/doc/*.tex \ tm/doc/*.texi tm/old-logs/*.en tm/old-logs/*.ja +TM_MH_E_FILES = tm-mh-e/Makefile tm-mh-e/mk-tmh tm-mh-e/TMH-ELS \ + tm-mh-e/code-jp.ol tm-mh-e/*.el tm-mh-e/ChangeLog + +GNUS_MIME_FILES = gnus-mime/Makefile gnus-mime/*-path \ + gnus-mime/Gnus-MIME-ELS gnus-mime/*.el gnus-mime/ChangeLog + +TM_GNUS_FILES = tm-gnus/Makefile tm-gnus/*-path tm-gnus/mk-tgnus \ + tm-gnus/TGNUS-ELS tm-gnus/*.el tm-gnus/ChangeLog + TM_MUA_FILES = tm/tm-rmail.el tm/tm-vm.el tm/tm-mail.el \ - tm/gnus/Makefile tm/gnus/*-path tm/gnus/mk-tgnus \ - tm/gnus/*.el tm/gnus/ChangeLog \ - tm/mh-e/Makefile tm/mh-e/mk-tmh tm/mh-e/TMH-ELS \ - tm/mh-e/code-jp.ol tm/mh-e/*.el tm/mh-e/ChangeLog + $(TM_MH_E_FILES) $(GNUS_MIME_FILES) $(TM_GNUS_FILES) MEL_FILES = mel/*.el mel/Makefile mel/mk-mel mel/MEL-ELS mel/ChangeLog @@ -50,11 +56,11 @@ TL_FILES = tl/README.en tl/Makefile tl/mk-tl tl/TL-ELS \ FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(MU_FILES) $(TL_FILES) -TARFILE = tm7.81.tar.gz +TARFILE = tm7.82.tar.gz elc: $(EMACS) $(FLAGS) -l inst-tm -f compile-tm - $(SHELL) .gnus-compile +# $(SHELL) .gnus-compile install-elc: elc $(EMACS) $(FLAGS) -l inst-tm -f install-tm diff --git a/TM-CFG b/TM-CFG index 3f14b7a..7104bb9 100644 --- a/TM-CFG +++ b/TM-CFG @@ -1,6 +1,6 @@ ;;; -*-Emacs-Lisp-*- ;;; -;;; $Id: TM-CFG,v 7.10 1996/09/02 15:25:45 morioka Exp morioka $ +;;; $Id: TM-CFG,v 7.15 1996/09/04 15:32:36 morioka Exp morioka $ ;;; (defvar default-load-path load-path) @@ -9,7 +9,8 @@ (lambda (path) (expand-file-name path (getenv "PWD")) )) - '("." "../tl" "../mu" "../mel" "mh-e") + '("." "../tl" "../mu" "../mel" + "../tm-mh-e" "../gnus-mime" "../tm-gnus") ) load-path)) @@ -44,12 +45,9 @@ ;;; ;; Please specify install path prefix. -(setq PREFIX - (if (or running-emacs-18 running-xemacs) - (expand-file-name "../../.." exec-directory) - (expand-file-name "../../../.." data-directory) - )) ; install to shared directory (maybe "/usr/local") -;;(setq PREFIX "~/") ; install to your home directory +;; If it is omitted, shared directory (maybe /usr/local is used). +(setq PREFIX install-prefix) +;;(setq PREFIX "~/") ;; Please specify install path prefix for binaries. (setq EXEC_PREFIX @@ -79,25 +77,25 @@ ;; lisp files of tm are installed into following directory tree: ;; -;; LISPDIR = PREFIX/DATA_PREFIX/LISP_PREFIX/ -;; LISPDIR/mime-setup.{el|elc} -;; LISPDIR/TM_PACKAGE_PREFIX/TL_PREFIX/ --- tl lisp files -;; LISPDIR/TM_PACKAGE_PREFIX/MU_PREFIX/ --- MU lisp files -;; LISPDIR/TM_PACKAGE_PREFIX/MEL_PREFIX/ --- MEL lisp files -;; LISPDIR/TM_PACKAGE_PREFIX/TM_PREFIX/ --- tm lisp files +;; = /DATA_PREFIX// +;; /mime-setup.{el|elc} +;; /// --- tl lisp files +;; /// --- MU lisp files +;; /// --- MEL lisp files +;; /// --- tm lisp files ;; -;; For example, if PREFIX = "/usr/local/" and you use Emacs 19.30, +;; For example, if = "/usr/local" and you use Emacs 19.34, ;; -;; LISPDIR = /usr/local/share/emacs/site-lisp/ +;; = /usr/local/share/emacs/site-lisp/ ;; /usr/local/share/emacs/site-lisp/mime-setup.{el|elc} ;; /usr/local/share/emacs/site-lisp/ --- tl lisp files ;; /usr/local/share/emacs/site-lisp/mu/ --- MU lisp files ;; /usr/local/share/emacs/site-lisp/mel/ --- MEL lisp files ;; /usr/local/share/emacs/site-lisp/tm/ --- tm lisp files ;; -;; For example, if PREFIX = "~/" and you use XEmacs, +;; For example, if = "~/" and you use XEmacs, ;; -;; LISPDIR = ~/share/xemacs/site-lisp/ +;; = ~/share/xemacs/site-lisp/ ;; ~/share/xemacs/site-lisp/mime-setup.{el|elc} ;; ~/share/xemacs/site-lisp/tl/ --- tl lisp files ;; ~/share/xemacs/site-lisp/mu/ --- MU lisp files @@ -120,41 +118,10 @@ ;;; @ optional settings ;;; -(setq LISP_PREFIX - (if (>= emacs-major-version 19) - "site-lisp" - "local.lisp")) - -(defvar LISPDIR - (or - (catch 'tag - (let ((rest default-load-path) - dir) - (while (setq dir (car rest)) - (if (string-match - (concat - "^" (expand-file-name (concat ".*/" LISP_PREFIX) PREFIX) "$") - dir) - (or (string-match (format "%d\\.%d" - emacs-major-version - emacs-minor-version) dir) - (throw 'tag dir) - )) - (setq rest (cdr rest)) - ))) - (expand-file-name (concat - (if running-emacs-19_29-or-later - "share/" - "lib/") - (cond ((boundp 'NEMACS) "nemacs/") - ((boundp 'MULE) "mule/") - (running-xemacs - (if (featurep 'mule) - "xmule/" - "xemacs/")) - (t "emacs/")) - LISP_PREFIX) PREFIX) - )) +;; It is generated by automatically. Please set variable `PREFIX'. +;; If you don't like default directory tree, please set it. +(setq LISPDIR (install-detect-elisp-directory PREFIX)) +;; (setq install-default-elisp-directory "~/lib/emacs/lisp") ;; Please specify mime-setup.{el|elc} install path. (setq SETUP_FILE_DIR LISPDIR) @@ -167,6 +134,7 @@ (setq TM_KERNEL_DIR (expand-file-name TM_PREFIX TM_LISPDIR)) (setq TM_MHE_DIR TM_KERNEL_DIR) (setq TM_GNUS_DIR TM_KERNEL_DIR) +(setq Gnus_MIME_DIR TM_KERNEL_DIR) (cond ((member LISPDIR default-load-path) (if (string-equal TM_PACKAGE_PREFIX "") @@ -206,8 +174,6 @@ (setq TM_GNUS_COMPILE ".gnus-compile") (setq MAKE "make") -(setq el-file-mode (+ (* 64 6)(* 8 4) 4)) - (setq BIN_SRC_DIR "src") (setq BINS '("ol2" "decode-b")) @@ -215,3 +181,5 @@ (setq METHODS '("tm-au" "tm-file" "tm-html" "tm-image" "tm-mpeg" "tm-plain" "tmdecode")) + +;;; TM-CFG ends here diff --git a/inst-tm b/inst-tm index 80b1c03..1e0009e 100644 --- a/inst-tm +++ b/inst-tm @@ -1,6 +1,6 @@ ;;; -*-Emacs-Lisp-*- ;;; -;;; $Id: inst-tm,v 7.30 1996/09/02 15:33:00 morioka Exp $ +;;; $Id: inst-tm,v 7.34 1996/09/04 15:43:19 morioka Exp $ ;;; (load-file "TM-CFG") @@ -8,7 +8,7 @@ (load-file "../mu/MU-ELS") (load-file "../mel/MEL-ELS") (load-file "TM-ELS") -(load-file "mh-e/TMH-ELS") +(load-file "../tm-mh-e/TMH-ELS") (defun make-mime-setup (tl-absolute-path tl-path mu-path mel-path tm-path) (let ((buf (find-file "mime-setup.el.in"))) @@ -48,18 +48,6 @@ (write-file "mime-setup.el") )) -(defun install-tm-gnus () - (erase-buffer) - (call-process SHELL - nil t t - SHELLOPTION - (format - TM_GNUS_INSTALL_FORMAT - (car command-line-args) TM_GNUS_DIR) - ) - (princ (buffer-string)) - ) - (defun compile-tm () (print load-path) (require 'mel-u) @@ -68,50 +56,43 @@ (require 'tm-mh-e) (make-mime-setup TL_DIR TL_RELATIVE_DIR MU_RELATIVE_DIR MEL_RELATIVE_DIR TM_KERNEL_RELATIVE_DIR) - (compile-elisp-modules tl-modules "../tl/") - (compile-elisp-modules mu-modules "../mu/") - (compile-elisp-modules mel-modules "../mel/") + (compile-elisp-modules tl-modules "../tl") + (compile-elisp-modules mu-modules "../mu") + (compile-elisp-modules mel-modules "../mel") (compile-elisp-modules tm-modules-to-compile ".") - (compile-elisp-modules tm-mh-e-modules "mh-e/") + (compile-elisp-modules tm-mh-e-modules "../tm-mh-e") (compile-elisp-module 'mime-setup ".") - (save-excursion - (set-buffer (get-buffer-create TM_GNUS_COMPILE)) - (let ((emacs (car command-line-args))) - (insert (format "cd gnus\n%s gnus EMACS=%s PWD=`pwd`\n" MAKE emacs)) - (cond (running-xemacs-19_14-or-later - ) - (running-xemacs - (insert (format "%s gnus5 EMACS=%s PWD=`pwd`\n" MAKE emacs)) - ) - (t (cond (running-emacs-18 - (insert (format "%s gnus3 EMACS=%s PWD=`pwd`\n" - MAKE emacs)) - (insert (format "%s gnus4 EMACS=%s PWD=`pwd`\n" - MAKE emacs)) - ) - ((<= emacs-minor-version 29) - (insert (format "%s gnus4 EMACS=%s PWD=`pwd`\n" - MAKE emacs)) - (insert (format "%s gnus5 EMACS=%s PWD=`pwd`\n" - MAKE emacs)) - ) - (t - (insert (format "%s gnus5 EMACS=%s PWD=`pwd`\n" - MAKE emacs)) - ))))) - (write-file TM_GNUS_COMPILE) - )) + (require 'gnus) + (cond ((featurep 'gnus-ems) + (load "../gnus-mime/Gnus-MIME-ELS") + (compile-elisp-modules gnus-mime-modules-to-compile "../gnus-mime") + ) + (t + (load "../tm-gnus/TGNUS-ELS") + (compile-elisp-modules tm-gnus-modules-to-compile "../tm-gnus") + )) + ) (defun install-tm () (princ (format "%s\n" emacs-version)) (print TL_DIR) - (install-elisp-modules tl-modules "../tl/" TL_DIR) - (install-elisp-modules mu-modules "../mu/" MU_DIR) - (install-elisp-modules mel-modules "../mel/" MEL_DIR) - (install-elisp-modules tm-modules "./" TM_KERNEL_DIR) - (install-elisp-modules tm-mh-e-modules "mh-e/" TM_MHE_DIR) - (install-tm-gnus) - (install-elisp-modules '(mime-setup) "./" SETUP_FILE_DIR) + (install-elisp-modules tl-modules "../tl" TL_DIR) + (install-elisp-modules mu-modules "../mu" MU_DIR) + (install-elisp-modules mel-modules "../mel" MEL_DIR) + (install-elisp-modules tm-modules "." TM_KERNEL_DIR) + (install-elisp-modules tm-mh-e-modules "../tm-mh-e" TM_MHE_DIR) + ;;(install-tm-gnus) + (require 'gnus) + (cond ((featurep 'gnus-ems) + (load "../gnus-mime/Gnus-MIME-ELS") + (install-elisp-modules gnus-mime-modules + "../gnus-mime" Gnus_MIME_DIR) + ) + (t + (load "../tm-gnus/TGNUS-ELS") + (install-elisp-modules tm-gnus-modules "../tm-gnus" TM_GNUS_DIR) + )) + (install-elisp-modules '(mime-setup) "." SETUP_FILE_DIR) ) (defun install-execs () diff --git a/mime-setup.el.in b/mime-setup.el.in index e8d473e..3ea32fb 100644 --- a/mime-setup.el.in +++ b/mime-setup.el.in @@ -5,7 +5,7 @@ ;; Author: MORIOKA Tomohiko ;; Maintainer: Shuhei KOBAYASHI ;; Version: -;; $Id: mime-setup.el.in,v 7.25 1996/08/18 17:03:42 morioka Exp $ +;; $Id: mime-setup.el.in,v 7.27 1996/09/04 16:14:03 morioka Exp $ ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;; This file is part of tm (Tools for MIME). @@ -134,9 +134,22 @@ ;;; @ for message (September Gnus 0.58 or later) ;;; +(defun message-maybe-setup-default-charset () + (let ((charset + (and (buffer-live-p gnus-summary-buffer) + (save-excursion + (set-buffer gnus-summary-buffer) + default-mime-charset)))) + (if charset + (progn + (make-local-variable 'default-mime-charset) + (setq default-mime-charset charset) + )))) + (or (boundp 'epoch::version) (progn (add-hook 'message-setup-hook 'mime/editor-mode) + (add-hook 'message-setup-hook 'message-maybe-setup-default-charset) (add-hook 'message-send-hook 'mime-editor/maybe-translate) (add-hook 'message-header-hook 'mime/encode-message-header) diff --git a/tm-def.el b/tm-def.el index d8688aa..6d920e3 100644 --- a/tm-def.el +++ b/tm-def.el @@ -1,30 +1,28 @@ -;;; ;;; tm-def.el --- definition module for tm -;;; -;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1995,1996 MORIOKA Tomohiko -;;; -;;; Author: MORIOKA Tomohiko -;;; Version: -;;; $Id: tm-def.el,v 7.62 1996/07/18 06:04:28 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. -;;; + +;; Copyright (C) 1995,1996 Free Software Foundation, Inc. + +;; Author: MORIOKA Tomohiko +;; Version: $Id: tm-def.el,v 7.63 1996/09/05 09:08:31 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; 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) @@ -73,6 +71,7 @@ (iso-2022-jp 7 "base64") (iso-2022-kr 7 "base64") (euc-kr 8 "base64") + (gb2312 8 "quoted-printable") (big5 8 "base64") (iso-2022-jp-2 7 "base64") (iso-2022-int-1 7 "base64") diff --git a/tm-edit.el b/tm-edit.el index e4e8b03..a461ae2 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -6,7 +6,7 @@ ;; MORIOKA Tomohiko ;; Maintainer: MORIOKA Tomohiko ;; Created: 1994/08/21 renamed from mime.el -;; Version: $Revision: 7.81 $ +;; Version: $Revision: 7.82 $ ;; Keywords: mail, news, MIME, multimedia, multilingual ;; This file is part of tm (Tools for MIME). @@ -121,7 +121,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.81 1996/09/02 16:42:24 morioka Exp $") + "$Id: tm-edit.el,v 7.82 1996/09/05 12:08:56 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -769,11 +769,12 @@ User customizable variables (not documented all of them): (setq mime/editor-mode-flag t) ;; Remember old key bindings. (if running-xemacs - nil + (use-local-map (or (current-local-map) (make-sparse-keymap))) (make-local-variable 'mime/editor-mode-old-local-map) (setq mime/editor-mode-old-local-map (current-local-map)) ;; Add MIME commands to current local map. - (use-local-map (copy-keymap (current-local-map))) + (use-local-map (copy-keymap (or (current-local-map) + (make-sparse-keymap)))) ) (if (not (lookup-key (current-local-map) mime-prefix)) (define-key (current-local-map) mime-prefix mime-editor/mime-map)) @@ -1404,9 +1405,15 @@ while if FLAG is `\\^M' (control-M) the text is hidden." (defvar mime-editor/translate-buffer-hook '(mime-editor/pgp-enclose-buffer - mime/encode-message-header + mime-editor/translate-header mime-editor/translate-body)) +(defun mime-editor/translate-header () + "Encode the message header into network representation." + (mime/encode-message-header 'code-conversion) + (run-hooks 'mime-editor/translate-header-hook) + ) + (defun mime-editor/translate-buffer () "Encode the tagged MIME message in current buffer in MIME compliant message." (interactive) diff --git a/tm-ew-e.el b/tm-ew-e.el index a08771e..d78a5cb 100644 --- a/tm-ew-e.el +++ b/tm-ew-e.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1995,1996 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; Version: $Revision: 7.47 $ +;; Version: $Revision: 7.53 $ ;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word ;; This file is part of tm (Tools for MIME). @@ -28,22 +28,54 @@ (require 'mel) (require 'std11) (require 'tm-def) +(require 'tl-list) ;;; @ version ;;; (defconst tm-ew-e/RCS-ID - "$Id: tm-ew-e.el,v 7.47 1996/08/30 04:26:46 morioka Exp $") + "$Id: tm-ew-e.el,v 7.53 1996/09/04 22:02:02 morioka Exp $") (defconst mime-eword/encoder-version (get-version-string tm-ew-e/RCS-ID)) ;;; @ variables ;;; -(defvar mime/no-encoding-header-fields '("X-Nsubject" "Newsgroups")) - -(defvar mime/use-X-Nsubject nil) +(defvar mime/field-encoding-method-alist + (if (boundp 'mime/no-encoding-header-fields) + (nconc + (mapcar (function + (lambda (field-name) + (cons field-name 'default-mime-charset) + )) + mime/no-encoding-header-fields) + '((t . mime)) + ) + '(("X-Nsubject" . iso-2022-jp-2) + ("Newsgroups" . nil) + (t . mime) + )) + "*Alist to specify field encoding method. +Its key is field-name, value is encoding method. + +If method is `mime', this field will be encoded into MIME format. + +If method is a MIME-charset, this field will be encoded as the charset +when it must be convert into network-code. + +If method is `default-mime-charset', this field will be encoded as +variable `default-mime-charset' when it must be convert into +network-code. + +If method is nil, this field will not be encoded. [tm-ew-e.el]") + +(defvar mime/generate-X-Nsubject + (and (boundp 'mime/use-X-Nsubject) + mime/use-X-Nsubject) + "*If it is not nil, X-Nsubject field is generated +when Subject field is encoded by `mime/encode-message-header'. +\[tm-ew-e.el]") (defvar mime-eword/charset-encoding-alist '((us-ascii . nil) @@ -493,21 +525,11 @@ (+ (length field-name) 2) field-body)) ) (t - (catch 'tag - (let ((r mime/no-encoding-header-fields) - fn) - (while r - (setq fn (car r)) - (if (string-equal (downcase fn) fname) - (throw 'tag field-body) - ) - (setq r (cdr r)) - )) - (car (tm-eword::encode-string - (+ (length field-name) 1) - field-body 'text)) - )) - )) + (car (tm-eword::encode-string + (+ (length field-name) 1) + field-body 'text)) + )) + ) (concat field-name ": " ret) ))) (car (tm-eword::encode-string 0 str)) @@ -518,35 +540,74 @@ (if (and str (string-match mime/encoded-word-regexp str)) str))) -(defun mime/encode-message-header () +(defun mime/encode-message-header (&optional code-conversion) (interactive "*") (save-excursion (save-restriction (std11-narrow-to-header mail-header-separator) (goto-char (point-min)) - (let (beg end field) + (let ((default-cs (mime-charset-to-coding-system default-mime-charset)) + beg end field-name) (while (re-search-forward std11-field-head-regexp nil t) (setq beg (match-beginning 0)) + (setq field-name (buffer-substring beg (1- (match-end 0)))) (setq end (std11-field-end)) - (if (and (find-charset-region beg end) - (setq field - (mime/encode-field - (buffer-substring-no-properties beg end) - )) - ) - (progn - (delete-region beg end) - (insert field) - )) + (and (find-charset-region beg end) + (let ((ret (or (ASSOC (downcase field-name) + mime/field-encoding-method-alist + :test (function + (lambda (str1 str2) + (and (stringp str2) + (string= str1 + (downcase str2)) + )))) + (assq t mime/field-encoding-method-alist) + ))) + (if ret + (let ((method (cdr ret))) + (cond ((eq method 'mime) + (let ((field + (buffer-substring-no-properties beg end) + )) + (delete-region beg end) + (insert (mime/encode-field field)) + )) + (code-conversion + (let ((cs + (or (mime-charset-to-coding-system + method) + default-cs))) + (encode-coding-region beg end cs) + ))) + )) + )) )) - (if mime/use-X-Nsubject - (let ((str (mime/exist-encoded-word-in-subject))) - (if str - (insert - (concat - "\nX-Nsubject: " - (mime-eword/decode-string (std11-unfold-string str)) - ))))) + (and mime/generate-X-Nsubject + (or (std11-field-body "X-Nsubject") + (let ((str (mime/exist-encoded-word-in-subject))) + (if str + (progn + (setq str + (mime-eword/decode-string + (std11-unfold-string str))) + (if code-conversion + (setq str + (encode-mime-charset-string + str + (or (cdr (ASSOC + "x-nsubject" + mime/field-encoding-method-alist + :test + (function + (lambda (str1 str2) + (and (stringp str2) + (string= str1 + (downcase str2)) + ))))) + 'iso-2022-jp-2))) + ) + (insert (concat "\nX-Nsubject: " str)) + ))))) ))) (defun mime-eword/encode-string (str &optional column mode)