From: morioka Date: Mon, 9 Mar 1998 07:06:44 +0000 (+0000) Subject: tm 6.74. X-Git-Tag: tm6_74~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83545c0017fdbc9bf61032c5d5e80a7555483fbe;p=elisp%2Ftm.git tm 6.74. --- diff --git a/Changes-6.74.en b/Changes-6.74.en new file mode 100644 index 0000000..87b28b4 --- /dev/null +++ b/Changes-6.74.en @@ -0,0 +1,124 @@ +* mel + + Attached version 1.8. + +** mel/mel-q.el +---------------------------- +revision 1.8 +date: 1995/08/27 19:29:17; author: morioka; state: Exp; lines: +3 -2 +Fixed problem of function `quoted-printable-internal-decode-region' in +Mule. +---------------------------- +revision 1.7 +date: 1995/08/27 17:45:52; author: morioka; state: Exp; lines: +2 -2 +Fixed (provide 'qprint) to (provide 'mel-q). +---------------------------- +revision 1.6 +date: 1995/08/27 17:06:53; author: morioka; state: Exp; lines: +5 -6 +(1) Fixed function `q-encoding-encode-string-for-phrase' to encode + space to `_'. +(2) Fixed function `q-encoding-encode-string' to call function + `q-encoding-encode-string-for-phrase' in default mode. +---------------------------- + +* tm + +** tm/tiny-mime.el +---------------------------- +revision 6.2 +date: 1995/08/27 19:05:07; author: morioka; state: Exp; lines: +3 -2 +Defined constant `mime/tspecials', constant `mime/token-regexp' is +defined by it. +---------------------------- +revision 6.1 +date: 1995/08/27 17:42:42; author: morioka; state: Exp; lines: +1 -2 +Eliminated (require 'tl-num). +---------------------------- +revision 6.0 +date: 1995/08/27 17:22:36; author: morioka; state: Exp; lines: +10 -10 +Eliminated unnecessary condition in function `mime/encode-string'. +---------------------------- +revision 5.22 +date: 1995/08/27 17:17:38; author: morioka; state: Exp; lines: +15 -175 +Use mel to encode. +---------------------------- +revision 5.21 +date: 1995/08/27 14:22:54; author: morioka; state: Exp; lines: +4 -3 +Fixed problem of constant `mime/charset-regexp'. +---------------------------- +revision 5.20 +date: 1995/08/27 13:35:27; author: morioka; state: Exp; lines: +25 -8 +(1) Function `mime/decode-encoded-text' was moved from + tm-{nemacs,orig,mule}.el. +(2) Use mel in function `mime/decode-encoded-text'. +---------------------------- +revision 5.19 +date: 1995/08/26 23:11:06; author: morioka; state: Exp; lines: +2 -2 +In function `mime/decode-encoded-word', encoding is regulated to upper +case. +---------------------------- + +** tm/tm-comp.el +---------------------------- +revision 6.8 +date: 1995/08/30 00:40:26; author: morioka; state: Exp; lines: +8 -80 +(1) Moved GNUS 4.* setting to tm-gnus4.el. +(2) Value part of variable `mime/message-after-send-hook-alist' does not + quote. +---------------------------- + +** tm/tm-mule.el +---------------------------- +revision 6.4 +date: 1995/08/27 13:33:13; author: morioka; state: Exp; lines: +6 -13 +Moved function `mime/decode-encoded-text' to tiny-mime.el. +---------------------------- + +** tm/tm-nemacs.el +---------------------------- +revision 6.3 +date: 1995/08/27 14:24:22; author: morioka; state: Exp; lines: +12 -18 +(1) Use string= if possible. +(2) Use constants if possible. +---------------------------- +revision 6.2 +date: 1995/08/27 13:31:02; author: morioka; state: Exp; lines: +11 -20 +Moved function `mime/decode-encoded-text' to tiny-mime.el. +---------------------------- + +** tm/tm-orig.el +---------------------------- +revision 6.3 +date: 1995/08/27 14:26:18; author: morioka; state: Exp; lines: +13 -17 +Use string= if possible. +---------------------------- +revision 6.2 +date: 1995/08/27 13:32:02; author: morioka; state: Exp; lines: +1 -14 +Moved function `mime/decode-encoded-text' to tiny-mime.el. +---------------------------- + +** tm/tm-view.el +---------------------------- +revision 6.74 +date: 1995/08/27 19:05:58; author: morioka; state: Exp; lines: +1 -4 +Use definition of constant `mime/token-regexp' in tiny-mime.el. +---------------------------- + + +* tm/gnus + + Attached version 6.16. + +** tm/gnus/tm-gnus4.el +---------------------------- +revision 6.1 +date: 1995/08/30 00:41:17; author: morioka; state: Exp; lines: +98 -1 +Added setting for tm-comp. +---------------------------- + +** tm/gnus/tm-dgnus.el +---------------------------- +revision 6.16 +date: 1995/08/30 02:44:11; author: morioka; state: Exp; lines: +14 -1 +Added setting for tm-comp. +---------------------------- diff --git a/Changes-6.74.ja b/Changes-6.74.ja new file mode 100644 index 0000000..d00dc7c --- /dev/null +++ b/Changes-6.74.ja @@ -0,0 +1,125 @@ +* mel + + Version 1.8 を添付した。 + +** mel/mel-q.el +---------------------------- +revision 1.8 +date: 1995/08/27 19:29:17; author: morioka; state: Exp; lines: +3 -2 +関数 quoted-printable-internal-decode-region の Mule における不具合を +修正した。 +---------------------------- +revision 1.7 +date: 1995/08/27 17:45:52; author: morioka; state: Exp; lines: +2 -2 +(provide 'qprint) を (provide 'mel-q) に直した。 +---------------------------- +revision 1.6 +date: 1995/08/27 17:06:53; author: morioka; state: Exp; lines: +5 -6 +(1) 空白を `_' に encode するように関数 + q-encoding-encode-string-for-phrase を修正した。 +(2) default の場合、関数 q-encoding-encode-string-for-phrase を呼ぶよ + うに、関数 q-encoding-encode-string を修正した。 +---------------------------- + + +* tm + +** tm/tiny-mime.el +---------------------------- +revision 6.2 +date: 1995/08/27 19:05:07; author: morioka; state: Exp; lines: +3 -2 +定数 mime/tspecials を定義し、これを用いて定数 mime/token-regexp を定 +義するようにした。 +---------------------------- +revision 6.1 +date: 1995/08/27 17:42:42; author: morioka; state: Exp; lines: +1 -2 +(require 'tl-num) を除去した。 +---------------------------- +revision 6.0 +date: 1995/08/27 17:22:36; author: morioka; state: Exp; lines: +10 -10 +関数 mime/encode-string において不要な条件を除去した。 +---------------------------- +revision 5.22 +date: 1995/08/27 17:17:38; author: morioka; state: Exp; lines: +15 -175 +encode にも mel を使うようにした。 +---------------------------- +revision 5.21 +date: 1995/08/27 14:22:54; author: morioka; state: Exp; lines: +4 -3 +定数 mime/charset-regexp の不具合を修正した。 +---------------------------- +revision 5.20 +date: 1995/08/27 13:35:27; author: morioka; state: Exp; lines: +25 -8 +(1) 関数 mime/decode-encoded-text を tm-{nemacs,orig,mule}.el から移し + た。 +(2) 関数 mime/decode-encoded-text で mel を使うようにした。 +---------------------------- +revision 5.19 +date: 1995/08/26 23:11:06; author: morioka; state: Exp; lines: +2 -2 +関数 mime/decode-encoded-word において、encoding を大文字に正規化する +ようにした。 +---------------------------- + +** tm/tm-comp.el +---------------------------- +revision 6.8 +date: 1995/08/30 00:40:26; author: morioka; state: Exp; lines: +8 -80 +(1) GNUS 4.* 用の設定を tm-gnus4.el に移した。 +(2) 変数 mime/message-after-send-hook-alist の値部を quote しないよう + にした。 +---------------------------- + +** tm/tm-mule.el +---------------------------- +revision 6.4 +date: 1995/08/27 13:33:13; author: morioka; state: Exp; lines: +6 -13 +関数 mime/decode-encoded-text を tiny-mime.el に移した。 +---------------------------- + +** tm/tm-nemacs.el +---------------------------- +revision 6.3 +date: 1995/08/27 14:24:22; author: morioka; state: Exp; lines: +12 -18 +(1) できるだけ string= を使うようにした。 +(2) できるだけ定数を用いるようにした。 +---------------------------- +revision 6.2 +date: 1995/08/27 13:31:02; author: morioka; state: Exp; lines: +11 -20 +関数 mime/decode-encoded-text を tiny-mime.el に移した。 +---------------------------- + +** tm/tm-orig.el +---------------------------- +revision 6.3 +date: 1995/08/27 14:26:18; author: morioka; state: Exp; lines: +13 -17 +できるだけ string= を使うようにした。 +---------------------------- +revision 6.2 +date: 1995/08/27 13:32:02; author: morioka; state: Exp; lines: +1 -14 +関数 mime/decode-encoded-text を tiny-mime.el に移した。 +---------------------------- + +** tm/tm-view.el +---------------------------- +revision 6.74 +date: 1995/08/27 19:05:58; author: morioka; state: Exp; lines: +1 -4 +定数 mime/token-regexp は tiny-mime.el の定義を用いるようにした。 +---------------------------- + + +* tm/gnus + + Version 6.16 を添付した。 + +** tm/gnus/tm-gnus4.el +---------------------------- +revision 6.1 +date: 1995/08/30 00:41:17; author: morioka; state: Exp; lines: +98 -1 +tm-comp 用の設定を追加した。 +---------------------------- + +** tm/gnus/tm-dgnus.el +---------------------------- +revision 6.16 +date: 1995/08/30 02:44:11; author: morioka; state: Exp; lines: +14 -1 +tm-comp 用の設定を追加した。 +---------------------------- diff --git a/Makefile b/Makefile index 617f8bd..b84867a 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ TL_FILES = tl/README.eng \ FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(TL_FILES) -TARFILE = tm6.73.tar +TARFILE = tm6.74.tar nemacs: diff --git a/gnus/Makefile b/gnus/Makefile index de668d7..1c142a2 100644 --- a/gnus/Makefile +++ b/gnus/Makefile @@ -17,7 +17,7 @@ TMDIR19 = $(HOME)/lib/emacs19/lisp FILES = tm/gnus/*.el -TARFILE = tm-gnus6.3.tar +TARFILE = tm-gnus6.16.tar gnus3: diff --git a/gnus/tm-dgnus.el b/gnus/tm-dgnus.el index c8da5be..bedfe88 100644 --- a/gnus/tm-dgnus.el +++ b/gnus/tm-dgnus.el @@ -10,7 +10,7 @@ ;;; @ version ;;; (defconst tm-gnus/RCS-ID - "$Id: tm-dgnus.el,v 6.15 1995/08/25 14:08:02 morioka Exp $") + "$Id: tm-dgnus.el,v 6.16 1995/08/30 02:44:11 morioka Exp $") (defconst tm-gnus/version (concat (get-version-string tm-gnus/RCS-ID) " (ding)")) @@ -184,6 +184,19 @@ With arg, turn MIME processing on if arg is positive." ) +;;; @ for tm-comp +;;; + +(call-after-loaded + 'tm-comp + (function + (lambda () + (set-alist 'mime/message-sender-alist + 'news-reply-mode + (function gnus-inews-news)) + ))) + + ;;; @ end ;;; diff --git a/gnus/tm-gnus4.el b/gnus/tm-gnus4.el index 6ae4b5f..026a450 100644 --- a/gnus/tm-gnus4.el +++ b/gnus/tm-gnus4.el @@ -1,5 +1,5 @@ ;;; -;;; $Id: tm-gnus4.el,v 6.0 1995/06/19 21:33:39 morioka Exp $ +;;; $Id: tm-gnus4.el,v 6.1 1995/08/30 00:41:17 morioka Exp $ ;;; (require 'tm-ognus) @@ -37,4 +37,101 @@ (add-hook 'gnus-article-prepare-hook (function mime/decode-message-header-if-you-need) t) + +;;; @ for tm-comp +;;; + +(defun tm-gnus4/message-before-send () + (let ((case-fold-search nil)) + (or (boundp 'mime/news-reply-mode-server-running) + (make-variable-buffer-local 'mime/news-reply-mode-server-running)) + (setq mime/news-reply-mode-server-running (gnus-server-opened)) + (save-excursion + (gnus-start-news-server) + (widen) + (goto-char (point-min)) + (run-hooks 'news-inews-hook) + (save-restriction + (narrow-to-region + (point-min) + (progn + (goto-char (point-min)) + (search-forward (concat "\n" mail-header-separator "\n")) + (point))) + + (goto-char (point-min)) + (if (search-forward-regexp "^Newsgroups: +" nil t) + (save-restriction + (narrow-to-region + (point) + (if (re-search-forward "^[^ \t]" nil 'end) + (match-beginning 0) + (point-max))) + (goto-char (point-min)) + (replace-regexp "\n[ \t]+" " ") + (goto-char (point-min)) + (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",") + )) + )))) + +(defun tm-gnus4/message-sender () + (interactive) + (widen) + (goto-char (point-min)) + (save-restriction + (narrow-to-region + (point-min) + (progn + (goto-char (point-min)) + (search-forward (concat "\n" mail-header-separator "\n")) + (point))) + ;; Mail the message too if To: or Cc: exists. + (if (or (mail-fetch-field "to" nil t) + (mail-fetch-field "cc" nil t)) + (if gnus-mail-send-method + (progn + (message + (format "Sending (%d/%d) via mail..." (+ i 1) total)) + (widen) + (funcall gnus-mail-send-method) + (message + (format "Sending (%d/%d) via mail... done" (+ i 1) total)) + (ding) + (message + "No mailer defined. To: and/or Cc: fields ignored.") + (sit-for 1))))) + (message + (format "Posting %d/%d to USENET..." (+ i 1) total)) + (if (gnus-inews-article) + (message + (format "Posting %d/%d to USENET... done" (+ i 1) total)) + ;; We cannot signal an error. + (ding) + (message + (format "Article %d/%d rejected: %s" + (+ i 1) total (gnus-status-message))) + (sit-for 3)) + ) + +(defun tm-gnus4/message-after-send () + (or mime/news-reply-mode-server-running + (gnus-close-server)) + (and (fboundp 'bury-buffer) (bury-buffer)) + ) + +(call-after-loaded + 'tm-comp + (function + (lambda () + (set-alist 'mime/message-before-send-hook-alist + 'news-reply-mode + (function tm-gnus4/message-before-send)) + (set-alist 'mime/message-sender-alist + 'news-reply-mode + (function tm-gnus4/message-sender)) + (set-alist 'mime/message-after-send-hook-alist + 'news-reply-mode + (function tm-gnus4/message-after-send)) + ))) + (provide 'tm-gnus4) diff --git a/tiny-mime.el b/tiny-mime.el index 85b6e48..434b2c3 100644 --- a/tiny-mime.el +++ b/tiny-mime.el @@ -6,18 +6,21 @@ ;;; mime.el,v 1.5 1992/07/18 07:52:08 by Enami Tsugutomo ;;; + ;;; @ require modules ;;; + (require 'emu) +(require 'mel) (require 'tl-header) (require 'tl-str) -(require 'tl-num) ;;; @ version ;;; + (defconst mime/RCS-ID - "$Id: tiny-mime.el,v 5.18 1995/08/26 18:38:37 morioka Exp $") + "$Id: tiny-mime.el,v 6.2 1995/08/27 19:05:07 morioka Exp $") (defconst mime/tiny-mime-version (get-version-string mime/RCS-ID)) @@ -25,7 +28,9 @@ ;;; @ MIME encoded-word definition ;;; -(defconst mime/charset-regexp "[A-Za-z0-9!#$%&'*+---^_`{}|~]") +(defconst mime/tspecials "][\000-\040()<>@,\;:\\\"/?.=") +(defconst mime/token-regexp (concat "[^" mime/tspecials "]+")) +(defconst mime/charset-regexp mime/token-regexp) (defconst mime/encoded-text-regexp "[!->@-~]+") (defconst mime/Base64-token-regexp "[A-Za-z0-9+/=]") @@ -52,7 +57,7 @@ (defconst mime/encoded-word-regexp (concat (regexp-quote "=?") "\\(" mime/charset-regexp - "+\\)" + "\\)" (regexp-quote "?") "\\(B\\|Q\\)" (regexp-quote "?") @@ -92,6 +97,7 @@ ;;; @ compatible module among Mule, NEmacs and NEpoch ;;; + (cond ((boundp 'MULE) (require 'tm-mule)) ((boundp 'NEMACS)(require 'tm-nemacs)) (t (require 'tm-orig)) @@ -104,14 +110,26 @@ ;;; @@ MIME header decoders ;;; -;; by mol. 1993/10/4 +(defun mime/decode-encoded-text (charset encoding str) + (let ((dest + (cond ((string= "B" encoding) + (base64-decode-string str)) + ((string= "Q" encoding) + (q-encoding-decode-string str)) + (t (message "unknown encoding %s" encoding) + nil)))) + (if dest + (mime/convert-string-to-emacs charset dest) + ))) + (defun mime/decode-encoded-word (word) - (if (string-match mime/encoded-word-regexp word) - (let ((charset (upcase (mime/encoded-word-charset word))) - (encoding (mime/encoded-word-encoding word)) - (text (mime/encoded-word-encoded-text word))) - (mime/decode-encoded-text charset encoding text)) - word)) + (or (if (string-match mime/encoded-word-regexp word) + (let ((charset (upcase (mime/encoded-word-charset word))) + (encoding (upcase (mime/encoded-word-encoding word))) + (text (mime/encoded-word-encoded-text word))) + (mime/decode-encoded-text charset encoding text) + )) + word)) (defun mime/decode-region (beg end) (interactive "*r") @@ -151,7 +169,8 @@ ) ) (setq end (match-end 0)) - (setq dest (concat dest (mime/decode-encoded-word (substring str beg end)) + (setq dest (concat dest + (mime/decode-encoded-word (substring str beg end)) )) (setq str (substring str end)) (setq ew t) @@ -163,9 +182,8 @@ ;;; (defun mime/encode-string (string encoding &optional mode) - (cond ((equal encoding "B") (mime/base64-encode-string string)) - ((equal encoding "Q") (mime/Quoted-Printable-encode-string string mode)) - (t nil) + (cond ((string= encoding "B") (base64-encode-string string)) + ((string= encoding "Q") (q-encoding-encode-string string mode)) )) (defun mime/encode-field (str) @@ -215,7 +233,8 @@ (narrow-to-region (goto-char (point-min)) (progn (re-search-forward - (concat "^" (regexp-quote mail-header-separator) "$") + (concat + "^" (regexp-quote mail-header-separator) "$") nil t) (match-beginning 0) )) @@ -235,7 +254,8 @@ (progn (goto-char (point-min)) (if (re-search-forward "^Subject:.*\\(\n\\s +.*\\)*" nil t) - (let ((str (buffer-substring (match-beginning 0)(match-end 0)))) + (let ((str (buffer-substring (match-beginning 0) + (match-end 0)))) (if (string-match mime/encoded-word-regexp str) (insert (concat "\nX-Nsubject: " @@ -247,173 +267,6 @@ ))) ))) -;;; @ Base64 (B-encode) decoder/encoder -;;; by Enami Tsugutomo -;;; modified by mol. - -(defun mime/base64-decode-string (string) - (mime/base64-mapconcat (function mime/base64-decode-chars) 4 string)) - -;; (mime/base64-encode-string (mime/base64-decode-string "GyRAOjRGI0stGyhK")) -(defun mime/base64-encode-string (string &optional mode) - (let ((es (mime/base64-mapconcat (function mime/base64-encode-chars) 3 string)) - m) - (setq m (mod (length es) 4)) - (concat es - (cond ((= m 3) "=") - ((= m 2) "==") - )) - )) - -;; (char-to-string (mime/base64-bit-to-char 26)) -(defun mime/base64-bit-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 mime/base64-char-to-bit (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)))) - -(defun mime/mask (i n) (logand i (1- (ash 1 n)))) - -(defun mime/base64-encode-1 (a &optional b &optional c) - (cons (ash a -2) - (cons (logior (ash (mime/mask a 2) (- 6 2)) - (if b (ash b -4) 0)) - (if b - (cons (logior (ash (mime/mask b 4) (- 6 4)) - (if c (ash c -6) 0)) - (if c - (cons (mime/mask c (- 6 0)) - nil))))))) - -(defun mime/base64-decode-1 (a b &optional c &optional d) - (cons (logior (ash a 2) (ash b (- 2 6))) - (if c (cons (logior (ash (mime/mask b 4) 4) - (mime/mask (ash c (- 4 6)) 4)) - (if d (cons (logior (ash (mime/mask c 2) 6) d) - nil)))))) - -;; (mime/base64-decode-chars ?G ?y ?R ?A) -(defun mime/base64-decode-chars (a b c d) - (apply (function mime/base64-decode-1) - (mapcar (function mime/base64-char-to-bit) - (list a b c d)))) - -;; (mapcar (function char-to-string) (mime/base64-encode-chars 27 36 64)) -(defun mime/base64-encode-chars (a b c) - (mapcar (function mime/base64-bit-to-char) (mime/base64-encode-1 a b c))) - -(defun mime/base64-fecth-from (func from pos len) - (let (ret) - (while (< 0 len) - (setq len (1- len) - ret (cons (funcall func from (+ pos len)) ret))) - ret)) - -(defun mime/base64-fecth-from-buffer (from pos len) - (mime/base64-fecth-from (function (lambda (f p) (char-after p))) - from pos len)) - -(defun mime/base64-fecth-from-string (from pos len) - (mime/base64-fecth-from (function (lambda (f p) - (if (< p (length f)) (aref f p)))) - from pos len)) - -(defun mime/base64-fecth (source pos len) - (cond ((stringp source) (mime/base64-fecth-from-string source pos len)) - (t (mime/base64-fecth-from-buffer source pos len)))) - -(defun mime/base64-mapconcat (func unit string) - (let ((i 0) ret) - (while (< i (length string)) - (setq ret - (apply (function concat) - ret - (mapcar (function char-to-string) - (apply func (mime/base64-fecth string i unit))))) - (setq i (+ i unit))) - ret)) - -;;; @ Quoted-Printable (Q-encode) encoder/decoder -;;; - -(defun mime/Quoted-Printable-decode-string (str) - (let ((dest "") - (len (length str)) - (i 0) chr num h l) - (while (< i len) - (setq chr (elt str i)) - (cond ((eq chr ?=) - (if (< (+ i 2) len) - (progn - (setq h (hex-char-to-number (elt str (+ i 1)))) - (setq l (hex-char-to-number (elt str (+ i 2)))) - (setq num (+ (* h 16) l)) - (setq dest (concat dest (char-to-string num))) - (setq i (+ i 3)) - ) - (progn - (setq dest (concat dest (char-to-string chr))) - (setq i (+ i 1)) - ))) - ((eq chr ?_) - (setq dest (concat dest (char-to-string 32))) - (setq i (+ i 1)) - ) - (t - (setq dest (concat dest (char-to-string chr))) - (setq i (+ i 1)) - )) - ) - dest)) - -(defun mime/Quoted-Printable-encode-string (str &optional mode) - (if (null mode) - (setq mode 'phrase)) - (let ((dest "") - (len (length str)) - (i 0) chr) - (while (< i len) - (setq chr (elt str i)) - (cond ((eq chr 32) - (setq dest (concat dest "_")) - ) - ((or (eq chr ?=) - (eq chr ??) - (eq chr ?_) - (and (eq mode 'comment) - (or (eq chr ?\() - (eq chr ?\)) - (eq chr ?\\) - )) - (and (eq mode 'phrase) - (not (string-match "[A-Za-z0-9!*+/=_---]" - (char-to-string chr))) - ) - (< chr 32) - (> chr 126)) - (setq dest (concat dest - "=" - (char-to-string (number-to-hex-char (/ chr 16))) - (char-to-string (number-to-hex-char (% chr 16))) - )) - ) - (t (setq dest (concat dest (char-to-string chr))) - )) - (setq i (+ i 1)) - ) - dest)) ;;; @ functions for message header encoding ;;; @@ -433,7 +286,9 @@ (while (and (< i len) (setq js (mime/convert-string-from-emacs (substring string 0 i) charset)) - (setq m (+ n (mime/encoded-word-length js encoding) cesl)) + (setq m (+ n + (mime/encoded-word-length js encoding) + cesl)) (< m 76)) (setq j i) (setq i (+ i (char-bytes (elt string i)))) @@ -454,14 +309,17 @@ (defun mime/encode-header-word (n string charset encoding) (let (dest str ret m) - (if (null (setq ret (mime/encode-and-split-string n string charset encoding))) + (if (null (setq ret + (mime/encode-and-split-string n string charset encoding))) nil (progn (setq dest (nth 1 ret)) (setq m (car ret)) (setq str (nth 2 ret)) (while (and (stringp str) - (setq ret (mime/encode-and-split-string 1 str charset encoding)) + (setq ret + (mime/encode-and-split-string + 1 str charset encoding)) ) (setq dest (concat dest "\n " (nth 1 ret))) (setq m (car ret)) diff --git a/tm-comp.el b/tm-comp.el index a1157cb..1ae12f0 100644 --- a/tm-comp.el +++ b/tm-comp.el @@ -22,7 +22,7 @@ ;;; (defconst mime/composer-RCS-ID - "$Id: tm-comp.el,v 6.7 1995/06/12 05:33:22 morioka Exp $") + "$Id: tm-comp.el,v 6.8 1995/08/30 00:40:26 morioka Exp $") (defconst mime/composer-version (get-version-string mime/composer-RCS-ID)) @@ -71,44 +71,8 @@ (message (format "Sending %d/%d... done" (+ i 1) total)) )) - (news-reply-mode . (lambda () - (interactive) - (widen) - (goto-char (point-min)) - (save-restriction - (narrow-to-region - (point-min) - (progn - (goto-char (point-min)) - (search-forward (concat "\n" mail-header-separator "\n")) - (point))) - ;; Mail the message too if To: or Cc: exists. - (if (or (mail-fetch-field "to" nil t) - (mail-fetch-field "cc" nil t)) - (if gnus-mail-send-method - (progn - (message - (format "Sending (%d/%d) via mail..." (+ i 1) total)) - (widen) - (funcall gnus-mail-send-method) - (message - (format "Sending (%d/%d) via mail... done" (+ i 1) total)) - (ding) - (message "No mailer defined. To: and/or Cc: fields ignored.") - (sit-for 1))))) - (message - (format "Posting %d/%d to USENET..." (+ i 1) total)) - (if (gnus-inews-article) - (message - (format "Posting %d/%d to USENET... done" (+ i 1) total)) - ;; We cannot signal an error. - (ding) - (message - (format "Article %d/%d rejected: %s" (+ i 1) total (gnus-status-message))) - (sit-for 3)) - )) )) - + (defvar mime/window-config-alist '((mail-mode . nil) @@ -128,46 +92,12 @@ (defvar mime/news-reply-mode-server-running nil) -(defun tm-gnus4/message-before-send () - (let ((case-fold-search nil)) - (or (boundp 'mime/news-reply-mode-server-running) - (make-variable-buffer-local 'mime/news-reply-mode-server-running)) - (setq mime/news-reply-mode-server-running (gnus-server-opened)) - (save-excursion - (gnus-start-news-server) - (widen) - (goto-char (point-min)) - (run-hooks 'news-inews-hook) - (save-restriction - (narrow-to-region - (point-min) - (progn - (goto-char (point-min)) - (search-forward (concat "\n" mail-header-separator "\n")) - (point))) - - (goto-char (point-min)) - (if (search-forward-regexp "^Newsgroups: +" nil t) - (save-restriction - (narrow-to-region - (point) - (if (re-search-forward "^[^ \t]" nil 'end) - (match-beginning 0) - (point-max))) - (goto-char (point-min)) - (replace-regexp "\n[ \t]+" " ") - (goto-char (point-min)) - (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",") - )) - )))) (defvar mime/message-before-send-hook-alist - '((mh-letter-mode . mh-before-send-letter-hook) - (news-reply-mode . tm-gnus4/message-before-send) - )) + '((mh-letter-mode . mh-before-send-letter-hook))) (defvar mime/message-after-send-hook-alist - '((mh-letter-mode . '(lambda () + '((mh-letter-mode . (lambda () (if mh-annotate-char (mh-annotate-msg mh-sent-from-msg mh-sent-from-folder @@ -177,10 +107,6 @@ (format "\"%s %s\"" (mh-get-field "To:") (mh-get-field "Cc:")))))) - (news-reply-mode . '(lambda () - (or mime/news-reply-mode-server-running - (gnus-close-server)) - (and (fboundp 'bury-buffer) (bury-buffer)))) )) (defvar tm-comp/message-inserter-alist nil) @@ -337,7 +263,8 @@ Optional argument ENCODING specifies an encoding method such as base64." (insert (format "Subject: %s (%d/%d)\n" subject (+ i 1) total)) (insert - (format "Mime-Version: 1.0\n")) + (format "Mime-Version: 1.0 (split by tm-comp %s)\n" + mime/composer-version)) (insert (format "Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" @@ -353,7 +280,8 @@ Optional argument ENCODING specifies an encoding method such as base64." (setq i (+ i 1)) ) ) - (let ((hook (eval (cdr (assq major-mode mime/message-after-send-hook-alist))))) + (let ((hook + (cdr (assq major-mode mime/message-after-send-hook-alist)))) (run-hooks 'hook)) (set-buffer-modified-p nil) (cond ((y-or-n-p "Kill draft buffer? ") diff --git a/tm-mule.el b/tm-mule.el index b29efb7..420d7e6 100644 --- a/tm-mule.el +++ b/tm-mule.el @@ -1,5 +1,5 @@ ;;; -;;; $Id: tm-mule.el,v 6.3 1995/08/26 18:42:32 morioka Exp $ +;;; $Id: tm-mule.el,v 6.4 1995/08/27 13:33:13 morioka Exp $ ;;; (require 'emu) @@ -65,6 +65,7 @@ ;;; @ define charset and encoding ;;; + (defun mime/set-charset-and-encoding (lc cs charset encoding) (setq mime/lc-charset-and-encoding-alist (put-alist lc (cons charset encoding) @@ -136,17 +137,6 @@ (mime/remove-leading-character str) str))))) -;; by mol. 1993/10/4 -(defun mime/decode-encoded-text (charset encoding str) - (mime/convert-string-to-emacs - charset - (cond ((string-match "^B$" encoding) - (mime/base64-decode-string str)) - ((string-match "^Q$" encoding) - (mime/Quoted-Printable-decode-string str)) - (t (message "unknown encoding %s" encoding) str) - ))) - (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding) (if (stringp charset) @@ -161,6 +151,9 @@ ))) -(run-hooks 'tm-mule-load-hook) +;;; @ end +;;; (provide 'tm-mule) + +(run-hooks 'tm-mule-load-hook) diff --git a/tm-nemacs.el b/tm-nemacs.el index a873fad..865cc6a 100644 --- a/tm-nemacs.el +++ b/tm-nemacs.el @@ -1,5 +1,5 @@ ;;; -;;; $Id: tm-nemacs.el,v 6.1 1995/08/26 18:44:31 morioka Exp $ +;;; $Id: tm-nemacs.el,v 6.3 1995/08/27 14:24:22 morioka Exp $ ;;; (require 'emu) @@ -8,60 +8,45 @@ ;;; @ variables ;;; -(defvar mime/default-coding-system 2) +(defvar mime/default-coding-system *junet*) (defvar mime/lc-charset-and-encoding-alist - (list - (cons lc-ascii nil) - (cons lc-jp '("ISO-2022-JP" . "B")) - )) + (list (cons lc-ascii nil) + (cons lc-jp '("ISO-2022-JP" . "B")) + )) + +(defvar mime/latin-lc-list (list lc-ascii)) + + +;;; @ functions +;;; -(defvar mime/latin-lc-list - (list lc-ascii)) - -;; by mol. 1993/10/4 (defun mime/convert-string-to-emacs (charset str) - (cond ((string-match "^ISO-2022-JP$" charset) - (convert-string-kanji-code str 2 3)) - ((string-match "^US-ASCII$" charset) str) + (cond ((string= "ISO-2022-JP" charset) + (convert-string-kanji-code str *junet* *internal*)) + ((string= "US-ASCII" charset) str) ((string-match "^ISO-8859-[1-9]$" charset) (check-ASCII-string str)) - (t nil) )) -;; by mol. 1993/11/2 (defun mime/convert-string-from-emacs (string charset) - (cond ((equal charset "ISO-2022-JP") + (cond ((string= charset "ISO-2022-JP") (code-convert-string string *internal* *junet*)) - ((equal charset "US-ASCII") string) - (t nil) + ((string= charset "US-ASCII") string) )) -;; by mol. 1993/10/4 -(defun mime/decode-encoded-text (charset encoding str) - (let ((ds (mime/convert-string-to-emacs - charset - (cond ((string-match "^B$" encoding) - (mime/base64-decode-string str)) - ((string-match "^Q$" encoding) - (mime/Quoted-Printable-decode-string str)) - (t - (message "unknown encoding %s" encoding) - (concat "=?" charset "?" encoding "?" str "?=") - ))))) - (if ds - ds - (concat "=?" charset "?" encoding "?" str "?=")) - )) - (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding) (if (stringp charset) (progn (setq charset (upcase charset)) (if (string= charset "ISO-2022-JP") - (convert-region-kanji-code beg end 2 3) + (convert-region-kanji-code beg end *junet* *internal*) )))) -(run-hooks 'tm-nemacs-load-hook) + +;;; @ end +;;; (provide 'tm-nemacs) + +(run-hooks 'tm-nemacs-load-hook) diff --git a/tm-orig.el b/tm-orig.el index d5aa4d9..762e462 100644 --- a/tm-orig.el +++ b/tm-orig.el @@ -1,5 +1,5 @@ ;;; -;;; $Id: tm-orig.el,v 6.1 1995/08/26 18:46:27 morioka Exp $ +;;; $Id: tm-orig.el,v 6.3 1995/08/27 14:26:18 morioka Exp $ ;;; (require 'emu) @@ -11,13 +11,11 @@ (defvar mime/default-coding-system nil) (defvar mime/lc-charset-and-encoding-alist - (list - (cons lc-ascii nil) - (cons lc-ltn1 '("ISO-8859-1" . "Q")) - )) + (list (cons lc-ascii nil) + (cons lc-ltn1 '("ISO-8859-1" . "Q")) + )) -(defvar mime/latin-lc-list - (list lc-ascii lc-ltn1)) +(defvar mime/latin-lc-list (list lc-ascii lc-ltn1)) (defvar mime/decoding-charset-list '("US-ASCII" "ISO-8859-1")) @@ -25,30 +23,15 @@ ;;; @ functions ;;; -;; by mol. 1993/10/4 (defun mime/convert-string-to-emacs (charset str) - (cond ((string-match "^US-ASCII$" charset) str) - ((string-match "^ISO-8859-1$" charset) str) - )) - -;; by mol. 1993/11/2 -(defun mime/convert-string-from-emacs (string charset) - (cond ((equal charset "US-ASCII") string) - ((equal charset "ISO-8859-1") string) - )) - -(defun mime/decode-encoded-text (charset encoding str) - (if (member charset mime/decoding-charset-list) - (cond ((string-match "^B$" encoding) - (mime/base64-decode-string str)) - ((string-match "^Q$" encoding) - (mime/Quoted-Printable-decode-string str)) - (t (message "unknown encoding %s" encoding) - (concat "=?" charset "?" encoding "?" str "?=") - )) - (concat "=?" charset "?" encoding "?" str "?=") - )) - + (if (or (string= "US-ASCII" charset) + (string= "ISO-8859-1" charset)) + str)) + +(defun mime/convert-string-from-emacs (str charset) + (if (or (string= charset "US-ASCII") + (string= charset "ISO-8859-1")) + str)) (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding) ) diff --git a/tm-view.el b/tm-view.el index 86a11cd..517856f 100644 --- a/tm-view.el +++ b/tm-view.el @@ -21,7 +21,7 @@ ;;; (defconst mime-viewer/RCS-ID - "$Id: tm-view.el,v 6.73 1995/08/26 19:53:34 morioka Exp $") + "$Id: tm-view.el,v 6.74 1995/08/27 19:05:58 morioka Exp $") (defconst mime-viewer/version (get-version-string mime-viewer/RCS-ID)) (defconst mime/viewer-version mime-viewer/version) @@ -30,9 +30,6 @@ ;;; @ constants ;;; -(defconst mime/tspecials "\000-\040()<>@,;:\\\"/[\093?.=") -(defconst mime/token-regexp - (concat "[^" mime/tspecials "]*")) (defconst mime/content-type-subtype-regexp (concat mime/token-regexp "/" mime/token-regexp)) (defconst mime/content-parameter-value-regexp