From 05b13728a22475e6336880af82c01e03038c1481 Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 9 Mar 1998 19:19:57 +0000 Subject: [PATCH] tm 7.68. --- ChangeLog | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- tm-edit.el | 11 ++---- tm-ew-e.el | 115 +++++++++++++++++++++++++++++++---------------------------- tm-image.el | 105 +++++++++++++++++++++++++++++++++++------------------ tm-rmail.el | 12 +++++-- 6 files changed, 249 insertions(+), 102 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbf8656..fc11afb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,109 @@ +Wed Jun 12 05:53:26 1996 MORIOKA Tomohiko + + * tl: Version 7.30 was released. + * MEL: Version 5.5 was released. + * tm: Version 7.68 was released. + + * tm-edit.el (mime-editor/split-message-sender-alist): setting for + `mail-mode' was moved to tm-rmail.el. + +Wed Jun 12 05:38:23 1996 MORIOKA Tomohiko + + * tm-rmail.el: Setting for + `mime-editor/split-message-sender-alist' was moved from + tm-edit.el. + +Tue Jun 11 22:19:45 1996 MORIOKA Tomohiko + + * tm-image.el: Function `image-read-file' was abolished. + + * tm-image.el (mime-preview/filter-for-inline-image): New + implementation; Don't make temporary file. + + (mime-preview/filter-for-application/postscript): New function for + XEmacs 19.14 or later. + +Tue Jun 11 14:34:28 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encode-string-1): Use function + `char-length' instead of `char-bytes'. + + * tm-ew-e.el (tm-eword::parse-lc-word): Use function `char-length' + instead of `char-bytes'. + +Mon Jun 10 05:12:37 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encode-string-1): Use macro + `tm-eword::rword-charset', `tm-eword::rword-encoding' and + `tm-eword::rword-type'. + + (tm-eword::encoded-word-length): set `type'. + +Mon Jun 10 04:34:27 1996 MORIOKA Tomohiko + + * tm-ew-e.el (mime/encode-field): set `type'. + +Mon Jun 10 04:29:31 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encode-rwl): optional argument `mode' was + abolished. + + (tm-eword::encode-string): modified for new interface. + + (mime-eword/encode-string): modified for new interface. + +Mon Jun 10 04:21:03 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encode-string-1): optional argument `mode' + was abolished. + + (tm-eword::encode-rwl): don't use `mode'. + + * tm-ew-e.el (tm-eword::split-string): New optional argument + `mode'. + + (tm-eword::mailbox-to-rwl): set `type'. + +Mon Jun 10 04:10:05 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::make-rword): New macro. + + (tm-eword::words-to-ruled-words): new optional argument `mode'; + Use macro `tm-eword::make-rword'. + + (tm-eword::phrase-to-rwl): set `mode'. + +Mon Jun 10 03:29:31 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encoded-word-length): Use macro + `tm-eword::rword-text', `tm-eword::rword-charset' and + `tm-eword::rword-encoding'. + +Mon Jun 10 03:12:18 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encoded-word-length): Use function + `base64-encoded-length' instead of `base64-length'. + + Function `q-encoding-length' was abolished. + +Mon Jun 10 03:09:05 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::encoded-word-length): Use function + `base64-encoded-length' instead of `base64-length'. + + Function `base64-length' was abolished. + +Mon Jun 10 02:59:06 1996 MORIOKA Tomohiko + + * tm-ew-e.el (tm-eword::rword-text): New macro. + (tm-eword::rword-charset): New macro. + (tm-eword::rword-encoding): New macro. + (tm-eword::rword-type): New macro. + + (tm-eword::space-process): Use macro `tm-eword::rword-text', + `tm-eword::rword-charset' and `tm-eword::rword-encoding'. + + Mon Jun 10 01:56:38 1996 MORIOKA Tomohiko * tm: Version 7.67 was released. diff --git a/Makefile b/Makefile index f5808d9..dc46e7d 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ TL_FILES = tl/README.en tl/Makefile tl/mk-tl tl/tl-els \ FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(TL_FILES) -TARFILE = tm7.67.tar.gz +TARFILE = tm7.68.tar.gz elc: $(EMACS) $(FLAGS) -l inst-tm -f compile-tm diff --git a/tm-edit.el b/tm-edit.el index 847e8eb..06338da 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -8,7 +8,7 @@ ;;; MORIOKA Tomohiko ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1994/08/21 renamed from mime.el -;;; Version: $Revision: 7.67 $ +;;; Version: $Revision: 7.68 $ ;;; Keywords: mail, news, MIME, multimedia, multilingual ;;; ;;; This file is part of tm (Tools for MIME). @@ -122,7 +122,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.67 1996/06/09 07:03:58 morioka Exp $") + "$Id: tm-edit.el,v 7.68 1996/06/12 05:53:26 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -402,12 +402,7 @@ Each elements are regexp of field-name. [tm-edit.el]") "\\(^[BDFbdf]cc:\\|^cc:[ \t]*$\\)") (defvar mime-editor/split-message-sender-alist - '((mail-mode - . (lambda () - (interactive) - (sendmail-send-it) - )) - (mh-letter-mode + '((mh-letter-mode . (lambda (&optional arg) (interactive "P") (write-region (point-min) (point-max) diff --git a/tm-ew-e.el b/tm-ew-e.el index a74c265..ec267f2 100644 --- a/tm-ew-e.el +++ b/tm-ew-e.el @@ -6,7 +6,7 @@ ;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko -;;; Version: $Revision: 7.21 $ +;;; Version: $Revision: 7.33 $ ;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -36,7 +36,7 @@ ;;; (defconst tm-ew-e/RCS-ID - "$Id: tm-ew-e.el,v 7.21 1996/06/06 15:03:38 morioka Exp $") + "$Id: tm-ew-e.el,v 7.33 1996/06/11 14:34:28 morioka Exp $") (defconst mime-eword/encoder-version (get-version-string tm-ew-e/RCS-ID)) @@ -94,14 +94,14 @@ (defun tm-eword::parse-lc-word (str) (let* ((chr (sref str 0)) (lc (tm-eword::char-type chr)) - (i (char-bytes chr)) + (i (char-length chr)) (len (length str)) ) (while (and (< i len) (setq chr (sref str i)) (eq lc (tm-eword::char-type chr)) ) - (setq i (+ i (char-bytes chr))) + (setq i (+ i (char-length chr))) ) (cons (cons lc (substring str 0 i)) (substring str i)) )) @@ -158,6 +158,17 @@ ;;; @ rule ;;; +(defmacro tm-eword::make-rword (text charset encoding type) + (` (list (, text)(, charset)(, encoding)(, type)))) +(defmacro tm-eword::rword-text (rword) + (` (car (, rword)))) +(defmacro tm-eword::rword-charset (rword) + (` (car (cdr (, rword))))) +(defmacro tm-eword::rword-encoding (rword) + (` (car (cdr (cdr (, rword)))))) +(defmacro tm-eword::rword-type (rword) + (` (car (cdr (cdr (cdr (, rword))))))) + (defun tm-eword::find-charset-rule (lcl) (if lcl (let* ((charset (mime/find-charset lcl)) @@ -167,11 +178,12 @@ (list charset encoding) ))) -(defun tm-eword::words-to-ruled-words (wl) +(defun tm-eword::words-to-ruled-words (wl &optional mode) (mapcar (function (lambda (word) - (cons (cdr word) (tm-eword::find-charset-rule (car word))) - )) + (let ((ret (tm-eword::find-charset-rule (car word)))) + (tm-eword::make-rword (cdr word) (car ret)(nth 1 ret) mode) + ))) wl)) (defun tm-eword::space-process (seq) @@ -180,12 +192,13 @@ (setq b (car seq)) (setq seq (cdr seq)) (setq c (car seq)) - (setq cc (nth 1 c)) - (if (null (nth 1 b)) + (setq cc (tm-eword::rword-charset c)) + (if (null (tm-eword::rword-charset b)) (progn (setq a (car prev)) - (setq ac (nth 1 a)) - (if (and (nth 2 a)(nth 2 c)) + (setq ac (tm-eword::rword-charset a)) + (if (and (tm-eword::rword-encoding a) + (tm-eword::rword-encoding c)) (cond ((equal ac cc) (setq prev (cons (cons (concat (car a)(car b)(car c)) @@ -208,48 +221,30 @@ (reverse prev) )) -(defun tm-eword::split-string (str) +(defun tm-eword::split-string (str &optional mode) (tm-eword::space-process - (tm-eword::words-to-ruled-words - (tm-eword::lc-words-to-words - (tm-eword::split-to-lc-words str) - )))) + (tm-eword::words-to-ruled-words (tm-eword::lc-words-to-words + (tm-eword::split-to-lc-words str)) + mode))) ;;; @ length ;;; -(defun base64-length (string) - (let ((l (length string))) - (* (+ (/ l 3) - (if (= (mod l 3) 0) 0 1) - ) 4) - )) - -(defun q-encoding-length (string) - (let ((l 0)(i 0)(len (length string)) chr) - (while (< i len) - (setq chr (elt string i)) - (if (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr)) - (setq l (+ l 1)) - (setq l (+ l 3)) - ) - (setq i (+ i 1)) ) - l)) - (defun tm-eword::encoded-word-length (rword) - (let ((charset (nth 1 rword)) - (encoding (nth 2 rword)) - (string (car rword)) + (let ((string (tm-eword::rword-text rword)) + (charset (tm-eword::rword-charset rword)) + (encoding (tm-eword::rword-encoding rword)) ret) (setq ret (cond ((equal encoding "B") (setq string (mime-charset-encode-string string charset)) - (base64-length string) + (base64-encoded-length string) ) ((equal encoding "Q") (setq string (mime-charset-encode-string string charset)) - (q-encoding-length string) + (q-encoding-encoded-length string + (tm-eword::rword-type rword)) ))) (if ret (cons (+ 7 (length charset) ret) string) @@ -259,7 +254,7 @@ ;;; @ encode-string ;;; -(defun tm-eword::encode-string-1 (column rwl &optional mode) +(defun tm-eword::encode-string-1 (column rwl) (let* ((rword (car rwl)) (ret (tm-eword::encoded-word-length rword)) string len) @@ -278,7 +273,10 @@ ) (setq string (tm-eword::encode-encoded-text - (nth 1 rword) (nth 2 rword) (cdr ret) + (tm-eword::rword-charset rword) + (tm-eword::rword-encoding rword) + (cdr ret) + (tm-eword::rword-type rword) )) (setq len (+ (length string) column)) (setq rwl (cdr rwl)) @@ -290,7 +288,7 @@ (str "") nstr) (while (and (< p len) (progn - (setq np (+ p (char-bytes (sref string p)))) + (setq np (+ p (char-length (sref string p)))) (setq nstr (substring string 0 np)) (setq ret (tm-eword::encoded-word-length (cons nstr (cdr rword)) @@ -308,7 +306,10 @@ (cdr rwl))) (setq string (tm-eword::encode-encoded-text - (nth 1 rword) (nth 2 rword) str)) + (tm-eword::rword-charset rword) + (tm-eword::rword-encoding rword) + str + (tm-eword::rword-type rword))) (setq len (+ (length string) column)) ) ))) @@ -316,7 +317,7 @@ (list string len rwl) )) -(defun tm-eword::encode-rwl (column rwl &optional mode) +(defun tm-eword::encode-rwl (column rwl) (let (ret dest ps special str ew-f pew-f) (while rwl (setq ew-f (nth 2 (car rwl))) @@ -325,13 +326,13 @@ pew-f nil) (setq pew-f ew-f) ) - (setq ret (tm-eword::encode-string-1 column rwl mode)) + (setq ret (tm-eword::encode-string-1 column rwl)) (setq str (car ret)) (if (eq (elt str 0) ?\n) (if (eq special ?\() (progn (setq dest (concat dest "\n (")) - (setq ret (tm-eword::encode-string-1 2 rwl mode)) + (setq ret (tm-eword::encode-string-1 2 rwl)) (setq str (car ret)) )) (cond ((eq special 32) @@ -366,7 +367,7 @@ )) (defun tm-eword::encode-string (column str &optional mode) - (tm-eword::encode-rwl column (tm-eword::split-string str) mode) + (tm-eword::encode-rwl column (tm-eword::split-string str mode)) ) @@ -383,8 +384,11 @@ (setq dest (append dest (list - (cons str (tm-eword::find-charset-rule - (find-charset-string str))) + (let ((ret (tm-eword::find-charset-rule + (find-charset-string str)))) + (tm-eword::make-rword + str (car ret)(nth 1 ret) 'phrase) + ) ))) ) ((eq type 'comment) @@ -393,7 +397,8 @@ '(("(" nil nil)) (tm-eword::words-to-ruled-words (tm-eword::lc-words-to-words - (tm-eword::split-to-lc-words (cdr token)))) + (tm-eword::split-to-lc-words (cdr token))) + 'comment) '((")" nil nil)) )) ) @@ -402,7 +407,7 @@ (tm-eword::words-to-ruled-words (tm-eword::lc-words-to-words (tm-eword::split-to-lc-words (cdr token)) - )))) + ) 'phrase))) )) (setq phrase (cdr phrase)) ) @@ -443,7 +448,7 @@ (append dest '((" " nil nil) ("(" nil nil)) - (tm-eword::split-string comment) + (tm-eword::split-string comment 'comment) '((")" nil nil)) ))) dest)) @@ -503,7 +508,8 @@ (setq r (cdr r)) )) (car (tm-eword::encode-string - (+ (length field-name) 1) field-body)) + (+ (length field-name) 1) + field-body 'text)) )) )) (concat field-name ": " ret) @@ -554,8 +560,7 @@ ))) (defun mime-eword/encode-string (str &optional column mode) - (car (tm-eword::encode-rwl (or column 0) - (tm-eword::split-string str) mode)) + (car (tm-eword::encode-rwl (or column 0) (tm-eword::split-string str mode))) ) diff --git a/tm-image.el b/tm-image.el index 2566c35..c9001ea 100644 --- a/tm-image.el +++ b/tm-image.el @@ -10,7 +10,7 @@ ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1995/12/15 ;;; Version: -;;; $Id: tm-image.el,v 7.5 1996/05/27 08:08:00 morioka Exp $ +;;; $Id: tm-image.el,v 7.8 1996/06/12 05:22:11 morioka Exp $ ;;; ;;; Keywords: mail, news, MIME, multimedia, image, picture ;;; @@ -76,9 +76,15 @@ "image/x-mag" (function mime-preview/filter-for-image)) (defvar tm-image/inline-image-types - '("image/jpeg" "image/gif" "image/tiff" - "image/x-tiff" "image/x-pic" "image/x-mag" - "image/x-xbm" "image/x-xpixmap")) + (if (featurep 'gif) + (nconc + '("image/jpeg" "image/gif" "image/tiff" + "image/x-tiff" "image/x-pic" "image/x-mag" + "image/x-xbm" "image/x-xpixmap") + (if (featurep 'gif) + '("application/postscript") + ) + ))) (defun bitmap-read-xbm (file) (let (gl) @@ -97,17 +103,6 @@ ("image/x-xpixmap" . xpm) )) - (defun image-read-file (ctype file) - (let ((minor (assoc-value ctype mime-viewer/image-converter-alist)) - gl) - (while (progn - (setq gl (make-glyph (vector minor :file file))) - (eq (image-instance-type (glyph-image-instance gl)) - 'text) - )) - (make-annotation gl (point) 'text) - )) - (defvar mime-viewer/use-highlight-headers t) (defvar mime-preview/x-face-function @@ -221,50 +216,90 @@ ))) +;;; @ content filter for xbm +;;; + +(defun mime-preview/filter-for-image/xbm (ctype params encoding) + (let* ((mode mime::preview/original-major-mode) + (m (assq mode mime-viewer/code-converter-alist)) + (charset (assoc "charset" params)) + (beg (point-min)) (end (point-max)) + (xbm-file (make-temp-name (expand-file-name "tm" mime/tmp-dir))) + ) + (remove-text-properties beg end '(face nil)) + (mime-decode-region beg end encoding) + (write-region (point-min)(point-max) xbm-file) + (delete-region (point-min)(point-max)) + (bitmap-read-xbm xbm-file) + (delete-file xbm-file) + )) + +(set-alist 'mime-viewer/content-filter-alist + "image/xbm" (function mime-preview/filter-for-image/xbm)) + +(set-alist 'mime-viewer/content-filter-alist + "image/x-xbm" (function mime-preview/filter-for-image/xbm)) + + ;;; @ content filter for support in-line image types ;;; ;; (for XEmacs 19.14 or later) (defun mime-preview/filter-for-inline-image (ctype params encoding) (let* ((mode mime::preview/original-major-mode) - (m (assq mode mime-viewer/code-converter-alist)) - (charset (assoc "charset" params)) - (beg (point-min)) (end (point-max)) - (image-file (make-temp-name (expand-file-name "tm" mime/tmp-dir))) - ) + (m (assq mode mime-viewer/code-converter-alist)) + (charset (assoc "charset" params)) + (beg (point-min)) (end (point-max)) + ) (remove-text-properties beg end '(face nil)) (mime-decode-region beg end encoding) - (write-region (point-min)(point-max) image-file) - (delete-region (point-min)(point-max)) - (image-read-file ctype image-file) - (delete-file image-file) + (let ((data (buffer-string)) + (minor (assoc-value ctype mime-viewer/image-converter-alist)) + gl) + (delete-region (point-min)(point-max)) + (while (progn + (setq gl (make-glyph (vector minor :data data))) + (eq (image-instance-type (glyph-image-instance gl)) + 'text) + )) + (make-annotation gl (point) 'text) + ) (insert "\n") )) -;;; @ content filter for xbm +;;; @ content filter for Postscript ;;; +;; (for XEmacs 19.14 or later) -(defun mime-preview/filter-for-image/xbm (ctype params encoding) +(defun mime-preview/filter-for-application/postscript (ctype params encoding) (let* ((mode mime::preview/original-major-mode) (m (assq mode mime-viewer/code-converter-alist)) - (charset (assoc "charset" params)) (beg (point-min)) (end (point-max)) - (xbm-file (make-temp-name (expand-file-name "tm" mime/tmp-dir))) + (file-base (make-temp-name (expand-file-name "tm" mime/tmp-dir))) + (ps-file (concat file-base ".ps")) + (gif-file (concat file-base ".gif")) ) (remove-text-properties beg end '(face nil)) (mime-decode-region beg end encoding) - (write-region (point-min)(point-max) xbm-file) + (write-region (point-min)(point-max) ps-file) (delete-region (point-min)(point-max)) - (bitmap-read-xbm xbm-file) - (delete-file xbm-file) + (call-process "pstogif" nil nil nil ps-file) + (let (gl) + (while (progn + (setq gl (make-glyph (vector 'gif :file gif-file))) + (eq (image-instance-type (glyph-image-instance gl)) + 'text) + )) + (make-annotation gl (point) 'text) + ) + (delete-file ps-file) + (delete-file gif-file) )) (set-alist 'mime-viewer/content-filter-alist - "image/xbm" (function mime-preview/filter-for-image/xbm)) - -(set-alist 'mime-viewer/content-filter-alist - "image/x-xbm" (function mime-preview/filter-for-image/xbm)) + "application/postscript" + (function mime-preview/filter-for-application/postscript)) ;;; @ setting diff --git a/tm-rmail.el b/tm-rmail.el index d6a40b6..24f4971 100644 --- a/tm-rmail.el +++ b/tm-rmail.el @@ -1,12 +1,12 @@ ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; modified by KOBAYASHI Shuhei ;;; Created: 1994/8/30 ;;; Version: -;;; $Revision: 7.24 $ +;;; $Revision: 7.25 $ ;;; Keywords: mail, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -40,7 +40,7 @@ ;;; (defconst tm-rmail/RCS-ID - "$Id: tm-rmail.el,v 7.24 1996/04/16 18:24:58 morioka Exp $") + "$Id: tm-rmail.el,v 7.25 1996/06/12 05:38:23 morioka Exp $") (defconst tm-rmail/version (get-version-string tm-rmail/RCS-ID)) (defvar tm-rmail/decode-all nil) @@ -357,6 +357,12 @@ GNUS. The message will be appended if being composed." (require 'tm-mail) (set-alist 'mime-editor/message-inserter-alist 'mail-mode (function tm-mail/insert-message)) + (set-alist 'mime-editor/split-message-sender-alist + 'mail-mode (function + (lambda () + (interactive) + (sendmail-send-it) + ))) ))) ))) -- 1.7.10.4