From 32413f24e69a11359aef4e1a28c893a406255070 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 30 Jun 1998 08:45:35 +0000 Subject: [PATCH] Sync up with SEMI 1.8.1. --- ChangeLog | 148 +++++++++++++++++++++++++++++++++++++++++++++++++--------- Makefile | 2 +- README.en | 2 +- TODO | 2 + VERSION | 111 ++++++++++++++++++++++--------------------- mime-pgp.el | 22 ++++----- mime-play.el | 70 ++++++++++----------------- mime-text.el | 37 +-------------- mime-view.el | 94 +++++++++++++++++++++++-------------- semi-def.el | 31 ++++++++++-- 10 files changed, 311 insertions(+), 208 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa7d2e3..a3debbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,107 @@ +1998-06-30 Katsumi Yamaoka + + * WEMI: Version 1.8.1 (Numazu) released. + +1998-06-29 MORIOKA Tomohiko + + * mime-play.el (mime-save-content): Use + `mime-write-entity-content'. + +1998-06-29 MORIOKA Tomohiko + + * mime-view.el: + - Abolish local variable `mime-raw-representation-type'. + - Abolish function `mime-entity-representation-type'. + + * mime-pgp.el (mime-view-application/pgp): Use + `mime-entity-cooked-p'. + + * mime-play.el (mime-view-message/rfc822): Use + `mime-entity-cooked-p'. + +1998-06-28 MORIOKA Tomohiko + + * mime-play.el: Abolish function `mime-raw-write-region'. + + * mime-play.el (mime-store-message/partial-piece): Use + `mime-write-entity-body'. + + * mime-pgp.el (mime-verify-application/pgp-signature): Use + `mime-write-entity'. + +1998-06-28 MORIOKA Tomohiko + + * mime-pgp.el (mime-view-application/pgp): Specify + representation-type by argument of `mime-view-buffer'. + +1998-06-28 MORIOKA Tomohiko + + * mime-play.el (mime-view-message/rfc822): New implementation. + + * mime-view.el (mime-display-message): Try use window of mother + buffer to display mime-preview-buffer. + +1998-06-28 MORIOKA Tomohiko + + * mime-view.el: Abolish `mime-entity-cooked-p'; use + `mime-entity-cooked-p' of FLIM. + (mime-view-buffer): New optional argument `representation-type'; + use `mime-open-entity'. + (mime-view-mode): New implementation. + + +1998-06-28 MORIOKA Tomohiko + + * REMI: Version 1.8.0 (Ecch~-Kokubu) released. + +1998-06-26 MORIOKA Tomohiko + + * README.en (Required environment): Modify for FLIM 1.7.0. + + * mime-view.el (mime-view-mode): New implementation. + +1998-06-25 MORIOKA Tomohiko + + * mime-text.el (mime-display-text/plain): Must rename + `mime-browse-add-url-button' to `mime-add-url-buttons'. + +1998-06-25 Shuhei KOBAYASHI + + * semi-def.el: Don't require 'browse-url. + Abolish `mime-browse-add-url-buttons-maybe' and `mime-browse-url'. + (mime-browse-url-function): New function. + (mime-add-url-buttons): Renamed from `mime-browse-add-url-button'. + Use `mime-browse-url-function'. + +1998-06-24 Shuhei KOBAYASHI + + * mime-view.el: (mime-preview-condition): Renamed method for + "anon-ftp" access-type to `mime-view-message/external-anon-ftp' + and added new method `mime-view-message/external-url' for "url" + access-type. + +1998-06-24 Shuhei KOBAYASHI + + * mime-play.el (mime-preview-play-current-entity): Use + optional arg of `interactive'. + (mime-view-message/external-anon-ftp): Renamed from + `mime-view-message/external-ftp'. + (mime-raw-browse-url-function): New variable. + (mime-view-message/external-url): New function. + +1998-06-24 Shuhei KOBAYASHI + + * semi-def.el (mime-browse-url-regexp): Renamed from + `mime-text-url-regexp'. + (mime-browse-url): Renamed from `mime-text-browse-url'. + (mime-browse-add-url-buttons): Renamed from + `mime-text-add-url-buttons'. + (mime-browse-add-url-buttons-maybe): Renamed from + `mime-text-add-url-buttons-maybe'. + + * mime-text.el: Moved URL stuff to semi-def.el. + + 1998-06-24 Katsumi Yamaoka * WEMI: Version 1.8.0 (Mishima) released. @@ -743,7 +847,7 @@ `bbdb-buffer-name' to avoid compiler warning. (mime-method-to-display-caesar): Abolish unused local variable. - + Use `eval-buffer' to eval contents of `mime-acting-situation-examples-file'. @@ -930,7 +1034,7 @@ * mime-parse.el: Move 'regexp-* and 'regexp-or to mime-def.el of FLIM (Chao); move 'std11-quoted-pair-regexp, 'std11-qtext-regexp - and 'std11-quoted-string-regexp to mime-def.el of FLIM (Chao). + and 'std11-quoted-string-regexp to mime-def.el of FLIM (Chao). 1998-05-28 MORIOKA Tomohiko @@ -956,7 +1060,7 @@ * mime-play.el (mime-raw-play-entity): Abolish point correcting procedures for VM. - + * mime-play.el (mime-preview-play-current-entity): Do widen befor playing the entity. @@ -1112,7 +1216,7 @@ * mime-view.el (mime-raw-get-subject): Use 'mime-content-disposition-parameters. - + * mime-play.el (mime-raw-get-original-filename): Use 'mime-content-disposition-parameters. @@ -1773,7 +1877,7 @@ * mime-view.el (mime-view-body-visible-condition): New variable. (mime-view-body-visible-p): Use `mime-view-body-visible-condition' - instead of `mime-view-visible-media-type-list'. + instead of `mime-view-visible-media-type-list'. Abolish `mime-view-visible-media-type-list'. * mime-parse.el (mime-type/subtype-string): New function. @@ -2475,12 +2579,12 @@ 1997-09-05 MORIOKA Tomohiko * mime-parse.el: Abolish macro `define-structure'. - + (make-mime-entity-info, mime-entity-info-rnum, mime-entity-info-point-min, mime-entity-info-point-max, mime-entity-info-parameters, mime-entity-info-encoding, mime-entity-info-children): New implementation. - + (mime-entity-info-media-type, mime-entity-info-media-subtype): New inline function. @@ -2749,7 +2853,7 @@ * mime-view.el (mime-view-insert-entity-button, mime-preview/display-message/partial): Use `mime-insert-button'. - + (mime-view-setup-buffers): Enclose codes to display preview-buffer by `(let ((inhibit-read-only t)) ...)'. @@ -2901,7 +3005,7 @@ Wed May 7 10:04:36 1997 MORIOKA Tomohiko Wed May 7 09:37:54 1997 MORIOKA Tomohiko * mime-play.el: Don't require `view'. - + Constant `mime-view-text/plain-mode-map' was abolished. Function `mime-view-text/plain-mode' and @@ -3513,7 +3617,7 @@ Mon Mar 10 15:16:26 1997 MORIOKA Tomohiko * mime-edit.el: `mime-edit-mode' -> `turn-on-mime-edit'; `mime-edit-toggle-mode' -> `mime-edit-mode'. - + Alias `mime-mode' was abolished. 1997-03-06 MORIOKA Tomohiko @@ -3656,14 +3760,14 @@ Sat Mar 1 03:39:01 1997 Tomohiko Morioka (invisible-region, invisible-p, next-visible-point): New function; copied from emu-19.el and emu-xemacs.el. (visible-region): New function; copied from emu-19.el. - + * mime-edit.el (mime-edit-make-boundary): New function. (mime-edit-translate-body, mime-edit-translate-region): Use `mime-edit-make-boundary'. - + * mime-edit.el (replace-space-with-underline): New inline function; copied from tl-str.el. - + Sat Mar 1 02:07:00 1997 Tomohiko Morioka * eword-encode.el (find-non-ascii-charset-region): New @@ -3812,11 +3916,11 @@ Thu Feb 27 06:38:44 1997 Tomohiko Morioka * mime-text.el: `tm:mother-button-dispatcher' -> `mime-button-mother-dispatcher'. - + * mime-def.el, mime-text.el (mime-preview/filter-for-text/plain), mime-view.el, mime-tar.el (mime-tar-set-properties): `tm:add-button' -> `mime-add-button'. - + * mime-file.el: Renamed from tm-file.el. Wed Feb 26 13:01:25 1997 Tomohiko Morioka @@ -3981,20 +4085,20 @@ Mon Feb 24 09:04:48 1997 Tomohiko Morioka quoted-printable-octet-regexp, eword-Q-encoded-text-regexp, eword-Q-encoding-and-encoded-text-regexp): New constant; moved from mime-def.el. - + * mime-def.el (quoted-printable-hex-chars, quoted-printable-octet-regexp, eword-Q-encoded-text-regexp, eword-Q-encoding-and-encoded-text-regexp): Moved to eword-decode.el. - + * eword-decode.el (base64-token-regexp, base64-token-padding-regexp, eword-B-encoded-text-regexp): New constant; moved from mime-def.el. - + * mime-def.el: Constant `base64-token-regexp', `base64-token-padding-regexp' and `eword-B-encoded-text-regexp' were moved to eword-decode.el. - + * mime-def.el: Constant `eword-B-encoding-and-encoded-text-regexp' was abolished. @@ -4085,7 +4189,7 @@ Sat Feb 22 17:30:15 1997 MORIOKA Tomohiko from `mime/field-encoding-method-alist'. * eword-encode.el: Renamed from tm-ew-e.el. - + * eword-decode.el: Renamed from tm-ew-d.el. * mime-view.el: Don't require tm-def. @@ -4118,7 +4222,7 @@ Sat Feb 22 17:30:15 1997 MORIOKA Tomohiko from `mime/field-encoding-method-alist'. * eword-encode.el: Renamed from tm-ew-e.el. - + * eword-decode.el: Renamed from tm-ew-d.el. * mime-view.el: Don't require tm-def. @@ -4336,7 +4440,7 @@ Sat May 25 16:04:28 1996 MORIOKA Tomohiko * mime-edit.el (mime-editor/enquote-region): New command; bound to `C-c C-x q'. - + (mime-editor/menu-list): New item for function `mime-editor/enquote-region'. diff --git a/Makefile b/Makefile index 2e354a9..f308da2 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Makefile for WEMI. # -VERSION = 1.8.0 +VERSION = 1.8.1 PACKAGE = wemi SHELL = /bin/sh diff --git a/README.en b/README.en index 7d82bcf..f110d15 100644 --- a/README.en +++ b/README.en @@ -44,7 +44,7 @@ Required environment 19.14. WEMI also does not support Emacs 19.29 to 19.34, XEmacs 19.15 or XEmacs 20.2 without mule, but WEMI may work with them. - SEMI requires APEL (8.7 or later) and FLIM (1.6.0 or later) package. + SEMI requires APEL (8.7 or later) and FLIM (1.7.0 or later) package. Please install them before installing it. APEL package is available at: diff --git a/TODO b/TODO index aaaac05..4a051ff 100644 --- a/TODO +++ b/TODO @@ -101,3 +101,5 @@ Because they have problem with Semi-gnus. ============ * MIME-Edit + +** Content-ID is mandatory for message/external-body diff --git a/VERSION b/VERSION index 772dc00..34095ce 100644 --- a/VERSION +++ b/VERSION @@ -59,8 +59,10 @@ 1.7.0 Mizuhashi $(B?e66(B 1.7.1 Higashi-Toyama $(BElIY;3(B 1.8.0 Toyama $(BIY;3(B ; = JR $(B9b;3K\@~!"IY;39A@~(B -: : : -------- Takaoka $(B9b2,(B ; = JR $(BI98+@~!">kC<@~(B +1.8.1 Kureha $(B8b1)(B +----- Kosugi $(B>.?y(B +----- Ecch-Dþ-Daimon-A $(B1[CfBgLg(B +----- Takaoka $(B9b2,(B ; = JR $(BI98+@~!">kC<@~(B : : : ------- Higashi-Kanazawa $(BEl6bBt(B ------- Kanazawa $(B6bBt(B ; <=> $(BKLN&E4F;(B $(BKLE46bBt(B @@ -87,61 +89,62 @@ ;; East Japan Railway $(BElF|K\N95RE4F;(B http://www.jreast.co.jp/ ;; T-Dòkaidò-A Line $(BEl3$F;K\@~(B ;;------------------------------------------------------------------------- -1.2.0 T-Dòkyò-A $(BEl5~(B -1.2.1 Shinbashi $(B?766(B ; = JR $(B;3 $(B>.ED5^EEE4(B $(B9>%NEg@~!"9>%NEgEEE4(B -1.4.1 Tsujid-Dò-A $(@DT$(BF2(B ; $(B!J!V$(@DT$(B!W(B= J90@B-4454:128b$(B!K(B -1.4.2 Chigasaki $(B3}%v:j(B ; = JR $(BAjLO@~(B -1.4.3 Hiratsuka $(BJ?DM(B -1.4.4 -DÒiso-A $(BBg0k(B -1.4.5 Ninomiya $BFs5\(B -1.4.6 K-Dòzu-A $(B9qI\DE(B ; = JR $(B8fEB>l@~(B -1.5.0 Kamonomiya $B3{5\(B -1.5.1 Odawara $(B>.ED86(B ; <=> $(B>.ED5^!"H":,EP;3E4F;!"0KF&H":,E4F;(B -1.5.2 Hayakawa $BAa@n(B -1.5.3 Nebukawa $B:,I\@n(B -1.5.4 Manazuru $B??Da(B -1.6.0 Yugawara $BEr2O86(B -1.7.0 Atami $(BG.3$(B ; = JR $(B0KEl@~(B +1.2.0 T-Dòkyò-A $(BEl5~(B +1.2.1 Shinbashi $(B?766(B ; = JR $(B;3 $(B>.ED5^EEE4(B $(B9>%NEg@~!"9>%NEgEEE4(B +1.4.1 Tsujid-Dò-A $(@DT$(BF2(B ; $(B!J!V$(@DT$(B!W(B= J90@B-4454:128b$(B!K(B +1.4.2 Chigasaki $(B3}%v:j(B ; = JR $(BAjLO@~(B +1.4.3 Hiratsuka $(BJ?DM(B +1.4.4 -DÒiso-A $(BBg0k(B +1.4.5 Ninomiya $BFs5\(B +1.4.6 K-Dòzu-A $(B9qI\DE(B ; = JR $(B8fEB>l@~(B +1.5.0 Kamonomiya $B3{5\(B +1.5.1 Odawara $B>.ED86(B ; <=> $B>.ED5^!"H":,EP;3E4F;!"(B + ; $B0KF&H":,E4F;(B +1.5.2 Hayakawa $BAa@n(B +1.5.3 Nebukawa $B:,I\@n(B +1.5.4 Manazuru $B??Da(B +1.6.0 Yugawara $BEr2O86(B +1.7.0 Atami $(BG.3$(B ; = JR $(B0KEl@~(B ;;------------------------------------------------------------------------- ;; Central Japan Railway $(BEl3$N95RE4F;(B ;;------------------------------------------------------------------------- -1.7.1 Kan'nami $(BH!Fn(B -1.8.0 Mishima $B;0Eg(B ; = $B0KF&H":,E4F;(B ------ Numazu $B>BDE(B ; = JR $(B8fEB>l@~(B ------ Katahama $BJRIM(B ------ Hara $B86(B +1.7.1 Kan'nami $(BH!Fn(B +1.8.0 Mishima $B;0Eg(B ; = $B0KF&H":,E4F;(B +1.8.1 Numazu $B>BDE(B ; = JR $(B8fEB>l@~(B +----- Katahama $BJRIM(B +----- Hara $B86(B ----- Higashi-Tagonoura $BElED;R%N1:(B ------ Yoshiwara $B5H86(B ; = $B3YFnE4F;(B ------ Fuji $BIY;N(B ; = JR $B?H1d@~(B -: : : ------ Kanayama $(B6b;3(B ; =$(B!J(BJR $(BCf1{K\@~!K(B ------ Ot-Dòbashi $(BHxF,66(B-A ------ Nagoya $(BL>8E20(B ; = JR $(B4X@>K\@~!J!&Cf1{K\@~!K(B -: : : ------ Gifu $(B4tIl(B ; = JR $(B9b;3K\@~(B -: : : ------ Samegai $(B@C%v0f(B +----- Yoshiwara $B5H86(B ; = $B3YFnE4F;(B +----- Fuji $BIY;N(B ; = JR $B?H1d@~(B +: : : +----- Kanayama $(B6b;3(B ; =$(B!J(BJR $(BCf1{K\@~!K(B +----- Ot-Dòbashi $(BHxF,66(B-A +----- Nagoya $(BL>8E20(B ; = JR $(B4X@>K\@~!J!&Cf1{K\@~!K(B +: : : +----- Gifu $(B4tIl(B ; = JR $(B9b;3K\@~(B +: : : +----- Samegai $(B@C%v0f(B ;;------------------------------------------------------------------------- ;; West Japan Railway $(B@>F|K\N95RE4F;(B http://www.westjr.co.jp/ ;;------------------------------------------------------------------------- ------ Maibara $(BJF86(B ; = JR $(BKLN&K\@~(B -: : : ------ Kusatsu $(BApDE(B ; = JR $(BApDE@~(B -: : : ------ Yamashina $(B;32J(B ; = JR $(B8P@>@~(B ------ Ky-Dòto $(B5~ET(B ; = JR $(BF`NI@~!&;31"K\@~(B-A - ; <=> $(B6aE4(B $(B5~ET@~!"5~ET;T8rDL6I(B $(B1(4]@~(B -: : : ------ -DÒsaka $(BBg:e(B ; = JR $(BBg:e4D>u@~(B <=> JR $(BEl@>@~(B $(BKL?7CO(B-A - ; <=> $(BBg:e;T8rDL6I!":e?@!":e5^(B $(BG_ED(B -: : : ------ K-Dòbe $(B?@8M(B ; = JR $(B;3M[K\@~(B-A +----- Maibara $(BJF86(B ; = JR $(BKLN&K\@~(B +: : : +----- Kusatsu $(BApDE(B ; = JR $(BApDE@~(B +: : : +----- Yamashina $(B;32J(B ; = JR $(B8P@>@~(B +----- Ky-Dòto $(B5~ET(B ; = JR $(BF`NI@~!&;31"K\@~(B-A + ; <=> $(B6aE4(B $(B5~ET@~!"5~ET;T8rDL6I(B $(B1(4]@~(B +: : : +----- -DÒsaka $(BBg:e(B ; = JR $(BBg:e4D>u@~(B <=> JR $(BEl@>@~(B $(BKL?7CO(B-A + ; <=> $(BBg:e;T8rDL6I!":e?@!":e5^(B $(BG_ED(B +: : : +----- K-Dòbe $(B?@8M(B ; = JR $(B;3M[K\@~(B-A [REMI version names] @@ -153,11 +156,11 @@ 1.4.0 Himi $(BI98+(B 1.5.0 Shimao $(BEgHx(B 1.6.0 Amaharashi $(B1+@2(B -1.7.0 Ecch-Dþ-Kokubu $(B1[Cf9qJ,(B-A -------- Fushiki $(BIzLZ(B +1.8.0 Ecch-Dþ-Kokubu $(B1[Cf9qJ,(B-A +1.8.1 Fushiki $(BIzLZ(B ; <=> $B%&%i%8%*%9%C%H%C%/9RO)(B ------- Noumachi $(BG=D.(B ------- Ecch-Dþ-Nakagawa $(B1[CfCf@n(B-A - (Takaoka) ($(B9b2,(B) ; = JR $(BKLN&K\@~!">kC<@~(B + (Takaoka) ($(B9b2,(B) ; = JR $(BKLN&K\@~!">kC<@~(B [etc.] @@ -169,4 +172,4 @@ ------- (-DÒmi-Shiotsu) ($(B6a9>1vDE(B) ; = JR $(BKLN&K\@~(B-A : : : ------- Nishi--DÒtsu $(B@>BgDE(B-A - (Yamashina) ($(B;32J(B) ; = JR $(BEl3$F;K\@~(B + (Yamashina) ($(B;32J(B) ; = JR $(BEl3$F;K\@~(B diff --git a/mime-pgp.el b/mime-pgp.el index fe2e1f2..67fbb6e 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -63,18 +63,17 @@ ;;; It is based on draft-kazu-pgp-mime-00.txt (PGP-kazu). (defun mime-view-application/pgp (entity situation) - (let* ((start (mime-entity-point-min entity)) - (end (mime-entity-point-max entity)) - (entity-number (mime-raw-point-to-entity-number start)) - (p-win (or (get-buffer-window mime-preview-buffer) + (let* ((p-win (or (get-buffer-window mime-preview-buffer) (get-largest-window))) - (new-name (format "%s-%s" (buffer-name) entity-number)) + (new-name + (format "%s-%s" (buffer-name) (mime-entity-number entity))) (the-buf (current-buffer)) (mother mime-preview-buffer) representation-type) (set-buffer (get-buffer-create new-name)) (erase-buffer) - (insert-buffer-substring the-buf start end) + (insert-buffer-substring + the-buf (mime-entity-point-min entity) (mime-entity-point-max entity)) (cond ((progn (goto-char (point-min)) (re-search-forward "^-+BEGIN PGP SIGNED MESSAGE-+$" nil t)) @@ -93,7 +92,8 @@ (while (re-search-forward "^- -" nil t) (replace-match "-") ) - (setq representation-type (mime-entity-representation-type entity)) + (setq representation-type (if (mime-entity-cooked-p entity) + 'cooked)) ) ((progn (goto-char (point-min)) @@ -107,8 +107,8 @@ (setq representation-type 'binary) )) (setq major-mode 'mime-show-message-mode) - (setq mime-raw-representation-type representation-type) - (save-window-excursion (mime-view-mode mother)) + (save-window-excursion (mime-view-buffer nil nil mother + nil representation-type)) (set-window-buffer p-win mime-preview-buffer) )) @@ -170,9 +170,7 @@ It should be ISO 639 2 letter language code such as en, ja, ...") (orig-file (make-temp-name basename)) (sig-file (concat orig-file ".sig")) ) - (mime-raw-write-region (mime-entity-point-min orig-entity) - (mime-entity-point-max orig-entity) - orig-file) + (mime-write-entity orig-entity orig-file) (save-excursion (mime-show-echo-buffer)) (mime-write-decoded-region (save-excursion (goto-char start) diff --git a/mime-play.el b/mime-play.el index d2e2f61..344b9da 100644 --- a/mime-play.el +++ b/mime-play.el @@ -34,8 +34,8 @@ (require 'mime-text) (condition-case nil (require 'bbdb) - (error (defvar bbdb-buffer-name nil)) - )) + (error (defvar bbdb-buffer-name nil))) + ) (defvar mime-acting-situation-examples nil) @@ -73,9 +73,7 @@ It decodes current entity to call internal or external method. The method is selected from variable `mime-acting-condition'. If MODE is specified, play as it. Default MODE is \"play\"." - (interactive) - (or mode - (setq mode "play")) + (interactive (list "play")) (let ((entity (get-text-property (point) 'mime-view-entity))) (if entity (let ((the-buf (current-buffer)) @@ -315,7 +313,6 @@ window.") (defun mime-save-content (entity situation) (let* ((name (mime-entity-safe-filename entity)) - (encoding (or (mime-entity-encoding entity) "7bit")) (filename (if (and name (not (string-equal name ""))) (expand-file-name name (save-window-excursion @@ -334,9 +331,7 @@ window.") (if (file-exists-p filename) (or (yes-or-no-p (format "File %s exists. Save anyway? " filename)) (error ""))) - (mime-write-decoded-region (mime-entity-body-start entity) - (mime-entity-body-end entity) - filename encoding) + (mime-write-entity-content entity filename) )) @@ -405,47 +400,26 @@ It is registered to variable `mime-preview-quitting-method-alist'." (pop-to-buffer mother) )) -(defun mime-view-message/rfc822 (entity cal) - (let* ((beg (mime-entity-point-min entity)) - (end (mime-entity-point-max entity)) - (cnum (mime-raw-point-to-entity-number beg)) - (new-name (format "%s-%s" (buffer-name) cnum)) +(defun mime-view-message/rfc822 (entity situation) + (let* ((new-name + (format "%s-%s" (buffer-name) (mime-entity-number entity))) (mother mime-preview-buffer) - (representation-type (mime-entity-representation-type entity)) - str) - (setq str (buffer-substring beg end)) - (switch-to-buffer new-name) + (children (car (mime-entity-children entity)))) + (set-buffer (get-buffer-create new-name)) (erase-buffer) - (insert str) - (goto-char (point-min)) - (if (re-search-forward "^\n" nil t) - (delete-region (point-min) (match-end 0)) - ) + (insert-buffer-substring (mime-entity-buffer children) + (mime-entity-point-min children) + (mime-entity-point-max children)) + (setq mime-message-structure children) (setq major-mode 'mime-show-message-mode) - (setq mime-raw-representation-type representation-type) - (mime-view-mode mother) + (mime-view-buffer (current-buffer) nil mother + nil (if (mime-entity-cooked-p entity) 'cooked)) )) ;;; @ message/partial ;;; -(defun mime-raw-write-region (start end filename) - "Write current region into specified file. -When called from a program, takes three arguments: -START, END and FILENAME. START and END are buffer positions. -It refer `mime-raw-representation-type' or `major-mode -mime-raw-representation-type-alist'. If it is `binary', region is -saved as binary. Otherwise the region is saved by `write-region'." - (let ((presentation-type - (or mime-raw-representation-type - (cdr (or (assq major-mode mime-raw-representation-type-alist) - (assq t mime-raw-representation-type-alist)))))) - (if (eq presentation-type 'binary) - (write-region-as-binary start end filename) - (write-region start end filename) - ))) - (defun mime-store-message/partial-piece (entity cal) (goto-char (mime-entity-point-min entity)) (let* ((root-dir @@ -485,8 +459,7 @@ saved as binary. Otherwise the region is saved by `write-region'." (select-window pwin) ) (setq file (concat root-dir "/" number)) - (mime-raw-write-region (mime-entity-body-start entity) - (mime-entity-body-end entity) file) + (mime-write-entity-body entity file) (let ((total-file (concat root-dir "/CT"))) (setq total (if total @@ -577,17 +550,24 @@ saved as binary. Otherwise the region is saved by `write-region'." (dired dir) )) -(defun mime-view-message/external-ftp (entity cal) +(defun mime-view-message/external-anon-ftp (entity cal) (let* ((site (cdr (assoc "site" cal))) (directory (cdr (assoc "directory" cal))) (name (cdr (assoc "name" cal))) (pathname (concat "/anonymous@" site ":" directory))) - (message (concat "Accessing " (expand-file-name name pathname) "...")) + (message (concat "Accessing " (expand-file-name name pathname) " ...")) (funcall mime-raw-dired-function pathname) (goto-char (point-min)) (search-forward name) )) +(defvar mime-raw-browse-url-function (function mime-browse-url)) + +(defun mime-view-message/external-url (entity cal) + (let ((url (cdr (assoc "url" cal)))) + (message (concat "Accessing " url " ...")) + (funcall mime-raw-browse-url-function url))) + ;;; @ rot13-47 ;;; diff --git a/mime-text.el b/mime-text.el index db8c155..db93142 100644 --- a/mime-text.el +++ b/mime-text.el @@ -53,41 +53,6 @@ SITUATION. It must be symbol." ) -;;; @ for URL -;;; - -(require 'browse-url) - -(defvar mime-text-url-regexp - "\\(http\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]" - "*Regexp to match URL in text/plain body.") - -(defun mime-text-browse-url (&optional url) - (if (fboundp browse-url-browser-function) - (if url - (funcall browse-url-browser-function url) - (call-interactively browse-url-browser-function)) - (if (fboundp mime-button-mother-dispatcher) - (call-interactively mime-button-mother-dispatcher) - ) - )) - -(defsubst mime-text-add-url-buttons () - "Add URL-buttons for text body." - (goto-char (point-min)) - (while (re-search-forward mime-text-url-regexp nil t) - (let ((beg (match-beginning 0)) - (end (match-end 0))) - (widget-convert-text 'url-link beg end) - ))) - -(defun mime-text-add-url-buttons-maybe () - "Add URL-buttons if 'browse-url-browser-function is not 'nil." - (if browse-url-browser-function - (mime-text-add-url-buttons) - )) - - ;;; @ content filters for mime-text ;;; @@ -99,7 +64,7 @@ SITUATION. It must be symbol." (if (not (eq (char-after (1- (point))) ?\n)) (insert "\n") ) - (mime-text-add-url-buttons) + (mime-add-url-buttons) (run-hooks 'mime-display-text/plain-hook) )) diff --git a/mime-view.el b/mime-view.el index 196da22..bd1056d 100644 --- a/mime-view.el +++ b/mime-view.el @@ -70,16 +70,6 @@ (make-variable-buffer-local 'mime-preview-buffer) -(defvar mime-raw-representation-type nil - "Representation-type of mime-raw-buffer. -It must be nil, `binary' or `cooked'. -If it is nil, `mime-raw-representation-type-alist' is used as default -value. -Notice that this variable is usually used as buffer local variable in -raw-buffer.") - -(make-variable-buffer-local 'mime-raw-representation-type) - (defvar mime-raw-representation-type-alist '((mime-show-message-mode . binary) (mime-temp-message-mode . binary) @@ -88,9 +78,7 @@ raw-buffer.") "Alist of major-mode vs. representation-type of mime-raw-buffer. Each element looks like (SYMBOL . REPRESENTATION-TYPE). SYMBOL is major-mode or t. t means default. REPRESENTATION-TYPE must be -`binary' or `cooked'. -This value is overridden by buffer local variable -`mime-raw-representation-type' if it is not nil.") +`binary' or `cooked'.") (defun mime-raw-find-entity-from-point (point &optional message-info) @@ -150,15 +138,6 @@ mother-buffer." ;;; @ entity information ;;; -(defsubst mime-entity-representation-type (entity) - (with-current-buffer (mime-entity-buffer entity) - (or mime-raw-representation-type - (cdr (or (assq major-mode mime-raw-representation-type-alist) - (assq t mime-raw-representation-type-alist)))))) - -(defsubst mime-entity-cooked-p (entity) - (eq (mime-entity-representation-type entity) 'cooked)) - (defun mime-entity-situation (entity) "Return situation of ENTITY." (append (or (mime-entity-content-type entity) @@ -621,7 +600,14 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." 'mime-acting-condition '((type . message)(subtype . external-body) ("access-type" . "anon-ftp") - (method . mime-view-message/external-ftp) + (method . mime-view-message/external-anon-ftp) + )) + +(ctree-set-calist-strictly + 'mime-acting-condition + '((type . message)(subtype . external-body) + ("access-type" . "url") + (method . mime-view-message/external-url) )) (ctree-set-calist-strictly @@ -907,15 +893,41 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." (let ((r-win (get-buffer-window raw-buffer))) (if r-win (set-window-buffer r-win preview-buffer) - (switch-to-buffer preview-buffer) - ))) + (let ((m-win (and mother (get-buffer-window mother)))) + (if m-win + (set-window-buffer m-win preview-buffer) + (switch-to-buffer preview-buffer) + ))))) ))) (defun mime-view-buffer (&optional raw-buffer preview-buffer mother - default-keymap-or-function) + default-keymap-or-function + representation-type) + "View RAW-BUFFER in MIME-View mode. +Optional argument PREVIEW-BUFFER is either nil or a name of preview +buffer. +Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or +function. If it is a keymap, keymap of MIME-View mode will be added +to it. If it is a function, it will be bound as default binding of +keymap of MIME-View mode. +Optional argument REPRESENTATION-TYPE is representation-type of +message. It must be nil, `binary' or `cooked'. If it is nil, +`binary' is used as default." (interactive) + (or raw-buffer + (setq raw-buffer (current-buffer))) + (or representation-type + (setq representation-type + (save-excursion + (set-buffer raw-buffer) + (cdr (or (assq major-mode mime-raw-representation-type-alist) + (assq t mime-raw-representation-type-alist))) + ))) + (if (eq representation-type 'binary) + (setq representation-type 'buffer) + ) (mime-display-message - (mime-parse-buffer raw-buffer) + (mime-open-entity representation-type raw-buffer) preview-buffer mother default-keymap-or-function)) (defun mime-view-mode (&optional mother ctl encoding @@ -944,13 +956,27 @@ button-2 Move to point under the mouse cursor and decode current content as `play mode' " (interactive) - (mime-display-message - (save-excursion - (if raw-buffer (set-buffer raw-buffer)) - (or mime-view-redisplay - (setq mime-message-structure (mime-parse-message ctl encoding))) - ) - preview-buffer mother default-keymap-or-function)) + (unless mime-view-redisplay + (save-excursion + (if raw-buffer (set-buffer raw-buffer)) + (let ((type + (cdr + (or (assq major-mode mime-raw-representation-type-alist) + (assq t mime-raw-representation-type-alist))))) + (if (eq type 'binary) + (setq type 'buffer) + ) + (setq mime-message-structure (mime-open-entity type raw-buffer)) + (or (mime-entity-content-type mime-message-structure) + (mime-entity-set-content-type-internal + mime-message-structure ctl)) + ) + (or (mime-entity-encoding mime-message-structure) + (mime-entity-set-encoding-internal mime-message-structure encoding)) + )) + (mime-display-message mime-message-structure preview-buffer + mother default-keymap-or-function) + ) ;;; @@ playing diff --git a/semi-def.el b/semi-def.el index df00cf0..bfe6914 100644 --- a/semi-def.el +++ b/semi-def.el @@ -29,7 +29,7 @@ (eval-when-compile (require 'cl)) -(defconst mime-user-interface-version '("WEMI" "Mishima" 1 8 0) +(defconst mime-user-interface-version '("WEMI" "Numazu" 1 8 1) "Implementation name, version name and numbers of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar" @@ -106,8 +106,33 @@ (apply func data) (if (fboundp mime-button-mother-dispatcher) (funcall mime-button-mother-dispatcher event) - ) - )))) + ))))) + + +;;; @ for URL +;;; + +(defcustom mime-browse-url-regexp + (concat "\\(http\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):" + "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?" + "[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]") + "*Regexp to match URL in text body." + :group 'mime + :type 'regexp) + +(defcustom mime-browse-url-function (function browse-url) + "*Function to browse URL." + :group 'mime + :type 'function) + +(defsubst mime-add-url-buttons () + "Add URL-buttons for text body." + (goto-char (point-min)) + (while (re-search-forward mime-browse-url-regexp nil t) + (let ((beg (match-beginning 0)) + (end (match-end 0))) + (widget-convert-text 'url-link beg end) + ))) ;;; @ menu -- 1.7.10.4