From: morioka Date: Mon, 2 Mar 1998 14:14:24 +0000 (+0000) Subject: tm 6.8 X-Git-Tag: tm6_8~1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=fc6b2cc1de3a2ee19d3cd62650673e7bf0d82edb;p=elisp%2Ftm.git tm 6.8 --- diff --git a/Makefile b/Makefile index 334d0a3..9c99c6b 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,10 @@ # TMDIR18 = for Emacs 18.* (NEMACS, NEpoch or MULE 1) # TMDIR19 = for Emacs 19.* (FSF original, XEmacs or MULE 2) - TMDIR18 = /usr/local/lib/emacs/local.lisp/tm - TMDIR19 = /usr/local/lib/mule/site-lisp + # TMDIR18 = /usr/local/lib/emacs/local.lisp/tm + # TMDIR19 = /usr/local/lib/mule/site-lisp + TMDIR18 = $(HOME)/lib/emacs18/lisp + TMDIR19 = $(HOME)/lib/emacs19/lisp TLSRCDIR = ../tl @@ -29,14 +31,14 @@ CFLAGS = -O UTILS = ol2 decode-b GOMI = $(UTILS) *.elc -FILES = tm/README.eng tm/Makefile tm/Makefile.bc \ +FILES = tm/README.eng tm/rel-*.ol tm/Makefile tm/Makefile.bc \ tm/*.el tm/*.c tm/methods \ tm/doc/Makefile tm/doc/*.pln tm/doc/*.ol tm/doc/*.tex tm/doc/*.texi \ tm/gnus/Makefile tm/gnus/Makefile.bc tm/gnus/*.el \ tm/mh-e/Makefile tm/mh-e/Makefile.bc tm/mh-e/*.el \ tl/README.eng tl/Makefile tl/Makefile.bc tl/*.el tl/doc/*.texi -TARFILE = tm5.21.8.tar +TARFILE = tm6.08.tar nemacs: diff --git a/Makefile.bc b/Makefile.bc index de6699f..5b9b2c1 100644 --- a/Makefile.bc +++ b/Makefile.bc @@ -1,5 +1,5 @@ # -# $Id: Makefile.bc,v 1.4 1995/01/31 10:44:26 morioka Exp $ +# $Id: Makefile.bc,v 1.4 1995/01/31 10:44:26 morioka Exp morioka $ # TMMEL = tm-view.el tm-rmail.el tm-comp.el @@ -8,7 +8,9 @@ TMMELC = ${TMMEL:el=elc} TM_EL = signature.el \ tiny-mime.el tm-misc.el tm-$(EMACS_TYPE).el $(TMMEL) tm-rich.el TM_ELC = ${TM_EL:el=elc} -ALL_EL = $(TM_EL) tm-setup.el mime-setup.el +ALL_EL = $(TM_EL) tm-ftp.el tm-latex.el tm-partial.el \ + tm-vm.el \ + tm-setup.el mime-setup.el .SUFFIXES: .el .elc diff --git a/README.eng b/README.eng index 9c001b8..f40f3e8 100644 --- a/README.eng +++ b/README.eng @@ -1,6 +1,6 @@ [README for tm (English Version)] by MORIOKA Tomohiko -$Id: README.eng,v 1.1 1995/01/12 17:23:45 morioka Exp $ +$Id: README.eng,v 1.2 1995/02/09 15:47:58 morioka Exp $ 1 What's tm? @@ -8,7 +8,7 @@ Tm is a MIME package for GNU Emacs. Tm has following functions: - MIME style multilingual header - MIME message viewer (mime/viewer-mode) - - MIME extenders for mh-e, GNUS and RMAIL + - MIME extenders for mh-e, GNUS, RMAIL and vm 2 Documents diff --git a/decode-b.c b/decode-b.c index 2bf63ea..8eece33 100644 --- a/decode-b.c +++ b/decode-b.c @@ -1,5 +1,9 @@ /* - * $Id: decode-b.c,v 1.1 1994/07/22 06:22:43 morioka Exp morioka $ + * $Id: decode-b.c,v 1.2 1995/02/04 02:51:53 morioka Exp $ + * + * modified by Kenji Rikitake + * based on Henry Spencer's un64 shell script + * */ #include @@ -32,33 +36,36 @@ main() char str[128]; char* sp; int ret; - unsigned long int value; - unsigned char* buf = (void*)&value; + unsigned int v1, v2, v3, v4, o1, o2, o3; - while(fgets(str, 128, rfp)){ - for(sp = str; *sp; ){ - if( (*sp == '\r') || (*sp == '\n') ) break; - value = get_base64_char_value(*sp++) * 64 * 64 * 64; - ret = get_base64_char_value(*sp++); - value += ret * 64 * 64; - ret = get_base64_char_value(*sp++); - if(ret >= 0){ - value += ret * 64; - ret = get_base64_char_value(*sp++); - if(ret >= 0){ - value += ret; - fwrite(&buf[1], 1, 3, wfp); - } - else{ - fwrite(&buf[1], 1, 2, wfp); + while (fgets(str, 128, rfp)) { + for (sp = str; *sp; ) { + if ((*sp == '\r') || (*sp == '\n')) break; + v1 = get_base64_char_value(*sp++); + v2 = get_base64_char_value(*sp++); + if (0 <= (v3 = get_base64_char_value(*sp++))) { + if (0 <= (v4 = get_base64_char_value(*sp++))) { + o1 = (v1 << 2) + (v2 >> 4); + o2 = ((v2 & 0x0f) << 4) + (v3 >> 2); + o3 = ((v3 & 0x03) << 6) + v4; + putc(o1, wfp); + putc(o2, wfp); + putc(o3, wfp); + } + else { + o1 = (v1 << 2) + (v2 >> 4); + o2 = ((v2 & 0x0f) << 4) + (v3 >> 2); + putc(o1, wfp); + putc(o2, wfp); return 0; + } } - } - else{ - fwrite(&buf[1], 1, 1, wfp); + else { + o1 = (v1 << 2) + (v2 >> 4); + putc(o1, wfp); return 0; + } } - } - } + } return 0; } diff --git a/gnus/Makefile b/gnus/Makefile index c20085b..e847c7e 100644 --- a/gnus/Makefile +++ b/gnus/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.4 1995/01/13 20:50:22 morioka Exp $ +# $Id: Makefile,v 1.4 1995/01/13 20:50:22 morioka Exp morioka $ # # Please specify emacs executables: @@ -18,8 +18,10 @@ # TMDIR18 = for Emacs 18.* (NEMACS, NEpoch or MULE 1) # TMDIR19 = for Emacs 19.* (FSF original, XEmacs or MULE 2) - TMDIR18 = /usr/local/lib/emacs/local.lisp/tm - TMDIR19 = /usr/local/lib/mule/site-lisp +# TMDIR18 = /usr/local/lib/emacs/local.lisp/tm +# TMDIR19 = /usr/local/lib/mule/site-lisp + TMDIR18 = $(HOME)/lib/emacs18/lisp + TMDIR19 = $(HOME)/lib/emacs19/lisp TMSRCDIR = .. TLSRCDIR = ../../tl diff --git a/gnus/tm-gnus3.el b/gnus/tm-gnus3.el index cc3db7c..d820b41 100644 --- a/gnus/tm-gnus3.el +++ b/gnus/tm-gnus3.el @@ -1,5 +1,5 @@ ;;; -;;; $Id: tm-gnus3.el,v 5.5 1995/01/13 20:46:48 morioka Exp $ +;;; $Id: tm-gnus3.el,v 6.0 1995/03/11 22:51:37 morioka Exp $ ;;; (provide 'tm-gnus3) @@ -7,22 +7,21 @@ (require 'tm-view) (require 'tl-list) -(setq mime/go-to-top-node-method-alist - (put-alist 'gnus-Article-mode - (if (string-match (regexp-quote "3.14.4") gnus-version) - (function - (lambda () - (mime/exit-view-mode) - (delete-other-windows) - (gnus-Article-show-summary) - )) - (function - (lambda () - (mime/exit-view-mode) - (delete-other-windows) - (gnus-Article-show-subjects) - ))) - mime/go-to-top-node-method-alist)) +(set-alist 'mime-viewer/quitting-method-alist + 'gnus-Article-mode + (if (string-match (regexp-quote "3.14.4") gnus-version) + (function + (lambda () + (mime-viewer/kill-buffer) + (delete-other-windows) + (gnus-Article-show-summary) + )) + (function + (lambda () + (mime-viewer/kill-buffer) + (delete-other-windows) + (gnus-Article-show-subjects) + )))) (defun tm-gnus/view-message (arg) "MIME decode and play this message." diff --git a/methods/tmdecode b/methods/tmdecode index b09d8ae..b3cf43a 100755 --- a/methods/tmdecode +++ b/methods/tmdecode @@ -7,8 +7,8 @@ case "binary": /bin/cp $2 $3 breaksw case "base64": - #decode-b < $2 > $3 - mmencode -u $2 > $3 + decode-b < $2 > $3 + #mmencode -u $2 > $3 breaksw case "quoted-printable": mmencode -q -u $2 > $3 diff --git a/rel-6eng.ol b/rel-6eng.ol new file mode 100644 index 0000000..448292a --- /dev/null +++ b/rel-6eng.ol @@ -0,0 +1,129 @@ +* changed points of tm-view + + Internal structure of tm-view 6.* is changed from tm-view 5.21, such +as, data structures, symbol names. I write main differences between tm +5.21. + +** internal structure + +*** content-info + + Buffer local variable of article buffer `mime/content-list', which +memorizes content structres of message in article buffer, is renamed +to `mime::article/content-info', and data structure is changed. + + Old data structure ``content-list'' used in buffer local variable +`mime/content-list' was a following list: + + content-list = (Ba Ea children) + + Ba: point-min of this content in article buffer + Ea: point-max of this content in article buffer + children: content-list's list of contents included in + this content. nil when this content is not + multipart + + + New data structure ``content-info'' used in buffer local variable +`mime::article/content-info' is following vector: + + content-info + = [point-min point-max type parameters encoding children] + + point-min: point-min of this content in article buffer + point-max: point-max of this content in article buffer + (This value is not equal Ea. + point-max = Ea + 1) + type: content-type/subtype of this content + parameters: assoc-list which represents parameters of + Content-Type field of this content + encoding: Content-Transfer-Encoding of this content + children: content-info's list of contents included + in this content. nil when this content is + not multipart + + + In tm-view 5.21, this data structure was generated and referenced by +list processing functions (basic lisp functions) dynamically. In +tm-view 6.*, however, it is generated by generator function +`mime::make-content-info', and it is referenced by reference functions +mime::content-info/FOO (FOO = { point-min | point-max | type | +parameters | encoding | children }). + + +*** preview-content-info + + Buffer local variable of preview buffer +`mime/preview-flat-content-list', which memorizes content structres of +message in preview buffer, is renamed to `mime::preview/content-list, +and data structure is changed. + + Old data structure used in buffer local variable +`mime/preview-flat-content-list' was a list which elements are +following list: + + (Bp Ep buf Ba Ea) + + Bp: point-min of this content in preview buffer + Ep: point-max of this content in preview buffer + buf: article buffer for this content + Ba: point-min of this content in article buffer + Ea: point-max of this content in article buffer + + + New data structure ``preview-content-info'' used in buffer local +variable `mime::preview/content-list'' is a list which elements are +following vector: + + [Bp Ep buf cinfo] + + Bp: point-min of this content in preview buffer + Ep: point-max of this content in preview buffer + buf: article buffer for this content + cinfo: content-info which represents this content + + + In tm-view 5.21, this data structure was generated and referenced by +list processing functions (basic lisp functions) dynamically. In +tm-view 6.*, however, it is generated by generator function +`mime::make-preview-content-info', and it is referenced by reference +functions mime::preview-content-info/FOO (FOO = { Bp | Ep | buf | +cinfo }). + + +*** etc + +- parser is changed + +- naming rule is changed + +- buffer local variable in article buffer `mime/preview-buffer' is + renamed to `mime::article/preview-buffer' + +- function `mime/exit-view-mode' is renamed to `mime-viewer/kill-buffer' + +- command functions of mime/viewer-mode are renamed from mime/FOO to + mime-viewer/FOO. (ex. `mime/up-content' --> `mime-viewer/up-content') + +- command function `mime/quit-view-mode' is renamed to `mime-viewer/quit' + +- etc... + + +** variables + +(1) variable `mime/content-filter-alist' is renamed to + `mime-viewer/content-filter-alist' + +(2) variable `mime/make-content-subject-function' is renamed to + `mime-viewer/content-subject-function' and arguments are changed + +(3) variable `mime/make-content-header-filter' is renamed to + `mime-viewer/content-header-filter-function' + +(4) variable `mime/default-showing-Content-Type-list' is renamed to + `mime-viewer/default-showing-Content-Type-list' + +(5) variable `mime/go-to-top-node-method-alist' is renamed to + `mime-viewer/quitting-method-alist' and changed initial value + because of changes between tm-view 5.21 and tm-view 6.*. diff --git a/rel-6jp.ol b/rel-6jp.ol new file mode 100644 index 0000000..1a005de --- /dev/null +++ b/rel-6jp.ol @@ -0,0 +1,124 @@ +* tm-view の変更点について + + tm-view 6.* では内部構造が変更され、データ構造や symbol 名などが変更 +されています。以下では、tm-view 5.21 からの主な変更点を挙げます。 + +** 内部構造の変更 + +*** content-info + + article buffer において、message に含まれる content の構造を記憶する +buffer local 変数 mime/content-list を mime::article/content-info に改 +名し、データ構造を変更した。具体的には、従来、 + + content-list = (Ba Ea Children) + + 但し、 + Ba: article buffer でのこの content の先頭 point + Ea: article buffer でのこの content の末尾 point + Children: この content に含まれる content の情報。 + content-list を要素とする list で表し、 + multipart の content でない場合は nil が入る + +という list で表現していたのを、 + + content-info + = [point-min point-max type parameters encoding children] + + 但し、 + point-min: article buffer でのこの content の先頭 + point + point-max: article buffer でのこの content の末尾 + point(Ea とは異なり、point-min と + point-max で作られる region がその content + になるようになっている。point-max = Ea + 1 + の関係が成り立つ) + type: この content の content-type/subtype + parameters: この content の Content-Type field の + paraeter を表す連想リスト + encoding: この content の Content-Transfer-Encoding. + children: この content に含まれる content の情報。 + content-info を要素とする list で表し、 + multipart の content でない場合は nil が入る + +という vector で表現するようにした。 + + また、従来、list 処理関数を使って直接 list を生成・参照していたのを、 +生成関数 mime::make-content-info, 参照関数 mime::content-info/FOO (FOO += {point-min|point-max|type|parameters|encoding|children}) を使うよう +にした。 + + また、従来、Content-Type, Content-Transfer-Encoding field の情報をい +ちいち buffer を検索して求めていたのを、content-info を参照するように +した。 + +*** preview-content-info + + preview buffer において、message に含まれる content の構造を記憶する +buffer local 変数 mime/preview-flat-content-list を +mime::preview/content-list に改名し、データ構造を変更した。具体的には、 +従来、 + + (Bp Ep buf Ba Ea) + + 但し、 + Bp: preview buffer でのこの content の先頭 point + Ep: preview buffer でのこの content の末尾 point + buf: この content に対応する article buffer + Ba: article buffer でのこの content の先頭 point + Ea: article buffer でのこの content の末尾 point + +という list で表現していたのを、 + + [Bp Ep buf cinfo] + + 但し、 + Bp: preview buffer でのこの content の先頭 point + Ep: preview buffer でのこの content の末尾 point + buf: この content に対応する article buffer + cinfo: この content を表す content-info + +という vector で表現するようにした。 + + また、従来、list 処理関数を使って直接 list を生成・参照していたのを、 +生成関数 mime::make-preview-content-info, 参照関数 +mime::preview-content-info/FOO (FOO = {Bp|Ep|buf|cinfo}) を使うように +した。 + + +*** その他 + +・parser を変更した + +・命名規則を変更した + +・article buffer の buffer local 変数 mime/preview-buffer を + mime::article/preview-buffer に改名した。 + +・関数 mime/exit-view-mode を mime-viewer/kill-buffer に改名した。 + +・mime/viewer-mode の各関数を mime/FOO から mime-viewer/FOO に改名した。 + (例:mime/up-content → mime-viewer/up-content) + +・関数 mime/quit-view-mode を mime-viewer/quit に改名した。 + +・その他 + + +** 主な変数名の変更 + +(1) 変数 mime/content-filter-alist を mime-viewer/content-filter-alist + に改名した。 + +(2) 変数 mime/make-content-subject-function を + mime-viewer/content-subject-function に改名し、引数を変更した。 + +(3) 変数 mime/make-content-header-filter を + mime-viewer/content-header-filter-function に改名した。 + +(4) 変数 mime/default-showing-Content-Type-list を + mime-viewer/default-showing-Content-Type-list に改名した。 + +(5) 変数 mime/go-to-top-node-method-alist を + mime-viewer/quitting-method-alist に改名した。また、symbol 名や仕 + 様の変更にともない、初期設定を変更した。 diff --git a/tm-partial.el b/tm-partial.el index acaa524..9954209 100644 --- a/tm-partial.el +++ b/tm-partial.el @@ -8,7 +8,7 @@ ;; original file is ;; gif.el written by Art Mellor @ Cayman Systems, Inc. 1991 -;;; $Id: tm-partial.el,v 1.5 1994/12/05 05:13:25 morioka Exp $ +;;; $Id: tm-partial.el,v 2.0 1995/03/12 16:14:44 morioka Exp $ (require 'tm-view) @@ -43,7 +43,7 @@ (number (cdr (assoc "number" cal))) (total (cdr (assoc "total" cal))) (buffer (generate-new-buffer id)) - (mother mime/preview-buffer) + (mother mime::article/preview-buffer) target subject-buf (article-buf (buffer-name (current-buffer))) @@ -127,8 +127,11 @@ (mime/gp:display-article) (save-excursion (set-buffer article-buf) - (make-variable-buffer-local 'mime/content-list) - (setq mime/content-list (mime/parse-contents))) + ;; (make-variable-buffer-local 'mime/content-list) + ;; (setq mime/content-list (mime/parse-contents)) + (make-variable-buffer-local 'mime::article/content-info) + (setq mime::article/content-info (mime-viewer/parse)) + ) (delete-other-windows) (switch-to-buffer buffer) (goto-char (point-min)) diff --git a/tm-rich.el b/tm-rich.el index 5ac2d8b..b5ed5b3 100644 --- a/tm-rich.el +++ b/tm-rich.el @@ -1,5 +1,5 @@ ;;; -;;; $Id: tm-rich.el,v 3.0 1994/11/29 17:59:32 morioka Exp $ +;;; $Id: tm-rich.el,v 4.0 1995/03/12 14:31:58 morioka Exp $ ;;; ;;; by MORIOKA Tomohiko ;;; modified by YAMATE Keiichirou @@ -96,7 +96,7 @@ ) )))) -(defun mime/decode-text/richtext (&optional ctl) +(defun mime-viewer/filter-text/richtext (&optional ctype params) (interactive) (save-excursion (save-restriction @@ -166,7 +166,7 @@ ) )))) -(defun mime/decode-text/enriched (&optional ctl) +(defun mime-viewer/filter-text/enriched (&optional ctype params) (interactive) (save-excursion (save-restriction @@ -182,8 +182,8 @@ ;;; @ setting ;;; -(set-alist 'mime/content-filter-alist - "text/richtext" (function mime/decode-text/richtext)) +(set-alist 'mime-viewer/content-filter-alist + "text/richtext" (function mime-viewer/filter-text/richtext)) -(set-alist 'mime/content-filter-alist - "text/enriched" (function mime/decode-text/enriched)) +(set-alist 'mime-viewer/content-filter-alist + "text/enriched" (function mime-viewer/filter-text/enriched)) diff --git a/tm-view.el b/tm-view.el index 24ca642..4e8afd2 100644 --- a/tm-view.el +++ b/tm-view.el @@ -19,10 +19,11 @@ ;;; @ version ;;; -(defconst mime/viewer-RCS-ID - "$Id: tm-view.el,v 5.21 1994/11/21 18:38:48 morioka Exp morioka $") +(defconst mime-viewer/RCS-ID + "$Id: tm-view.el,v 6.8 1995/03/12 15:58:32 morioka Exp $") -(defconst mime/viewer-version (get-version-string mime/viewer-RCS-ID)) +(defconst mime-viewer/version (get-version-string mime-viewer/RCS-ID)) +(defconst mime/viewer-version mime-viewer/version) ;;; @ constants @@ -79,161 +80,254 @@ "-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play")) )) -(defvar mime/content-filter-alist - '(("text/plain" . mime/decode-text/plain))) +(defvar mime-viewer/content-filter-alist + '(("text/plain" . mime-viewer/filter-text/plain))) -(defvar mime/make-content-subject-function +(defvar mime-viewer/content-subject-function (function - (lambda (cid subj ctype) + (lambda (cnum subj ctype params) (insert (format "[%s %s (%s)]\n" - (if (listp cid) + (if (listp cnum) (mapconcat (function (lambda (num) (format "%s" (+ num 1)) )) - cid ".") + cnum ".") "0") - subj (car ctype))) + subj ctype)) ))) -(defvar mime/make-content-header-filter -;;(setq mime/make-content-header-filter - (function - (lambda (cid) - (if (listp cid) - (delete-region (goto-char (point-min)) - (or (and (re-search-forward "^$" nil t) - (match-end 0)) - (point-max)) - ) - ) - ))) +(defvar mime-viewer/content-header-filter-function + (function mime-viewer/default-content-header-filter-function)) -(defvar mime/default-showing-Content-Type-list -;;(setq mime/default-showing-Content-Type-list +(defun mime-viewer/default-content-header-filter-function (cnum) + (if (listp cnum) + (delete-region (goto-char (point-min)) + (or (and (re-search-forward "^$" nil t) + (match-end 0)) + (point-max)) + ) + )) + +(defvar mime-viewer/default-showing-Content-Type-list '("text/plain" "text/richtext" "text/enriched" "text/x-latex" "application/x-latex" "application/octet-stream" nil)) -(defvar mime/go-to-top-node-method-alist -;;(setq mime/go-to-top-node-method-alist - '((gnus-article-mode . (lambda () - (mime/exit-view-mode) - (delete-other-windows) - (gnus-article-show-summary) - )) - (rmail-mode . (lambda () - (mime/exit-view-mode) - (rmail-summary) - (delete-other-windows) - )) - (mh-show-mode . (lambda () - (let ((win (get-buffer-window - mime/output-buffer-name)) - (buf - (nth 2 (car mime/preview-flat-content-list))) - ) - (if win - (delete-window win) - ) - (mime/exit-view-mode) - (pop-to-buffer - (let ((name (buffer-name buf))) - (string-match "show-" name) - (substring name (match-end 0)) - )) - ))) - (mime/show-message-mode . (lambda () - (set-window-configuration - mime/show-mode-old-window-configuration) - (let ((mother mime/mother-buffer)) - (kill-buffer - (nth 2 (car - mime/preview-flat-content-list))) - (mime/exit-view-mode) - (pop-to-buffer mother) - (goto-char (point-min)) - (mime/up-content) - ))) +(defvar mime-viewer/quitting-method-alist + '((gnus-article-mode + . (lambda () + (mime-viewer/kill-buffer) + (delete-other-windows) + (gnus-article-show-summary) + )) + (rmail-mode + . (lambda () + (mime-viewer/kill-buffer) + (rmail-summary) + (delete-other-windows) + )) + (mh-show-mode + . (lambda () + (let ((win (get-buffer-window + mime/output-buffer-name)) + (buf + (mime::preview-content-info/buffer + (car mime::preview/content-list))) + ) + (if win + (delete-window win) + ) + (mime-viewer/kill-buffer) + (pop-to-buffer + (let ((name (buffer-name buf))) + (string-match "show-" name) + (substring name (match-end 0)) + )) + ))) + (mime/show-message-mode + . (lambda () + (set-window-configuration + mime/show-mode-old-window-configuration) + (let ((mother mime/mother-buffer)) + (kill-buffer + (mime::preview-content-info/buffer + (car mime::preview/content-list))) + (mime-viewer/kill-buffer) + (pop-to-buffer mother) + (goto-char (point-min)) + (mime-viewer/up-content) + ))) )) -(defvar mime/use-internal-decoder nil) +(defvar mime-viewer/decoding-mode "play" "MIME body decoding mode") + + +;;; @ data structure +;;; + +;;; @@ content-info +;;; + +(defun mime::make-content-info (beg end ctype params encoding children) + (vector beg end ctype params encoding children) + ) + +(defun mime::content-info/point-min (cinfo) + (elt cinfo 0) + ) + +(defun mime::content-info/point-max (cinfo) + (elt cinfo 1) + ) + +(defun mime::content-info/type (cinfo) + (elt cinfo 2) + ) + +(defun mime::content-info/parameters (cinfo) + (elt cinfo 3) + ) + +(defun mime::content-info/encoding (cinfo) + (elt cinfo 4) + ) + +(defun mime::content-info/children (cinfo) + (elt cinfo 5) + ) + +;;; @@ preview-content-info +;;; + +(defun mime::make-preview-content-info (beg end buf cinfo) + (vector beg end buf cinfo) + ) + +(defun mime::preview-content-info/point-min (pcinfo) + (elt pcinfo 0) + ) + +(defun mime::preview-content-info/point-max (pcinfo) + (elt pcinfo 1) + ) + +(defun mime::preview-content-info/buffer (pcinfo) + (elt pcinfo 2) + ) + +(defun mime::preview-content-info/content-info (pcinfo) + (elt pcinfo 3) + ) + -(defvar mime/body-decoding-mode "play" "MIME body decoding mode") +;;; @ buffer local variables +;;; + +(defvar mime::article/content-info) +(defvar mime::article/preview-buffer) + +(defvar mime::preview/content-list nil) +(defvar mime::preview/original-major-mode nil) ;;; @ parser ;;; -(defun mime/parse-contents () +(defun mime-viewer/parse-message () + (make-variable-buffer-local 'mime::article/content-info) + (setq mime::article/content-info (mime-viewer/parse)) + (let ((ret (mime-viewer/make-preview-buffer))) + (make-variable-buffer-local 'mime::article/preview-buffer) + (setq mime::article/preview-buffer (car ret)) + ret)) + +(defun mime-viewer/parse () (save-excursion (save-restriction - (goto-char (point-min)) - (let* ((ctl (mime/Content-Type)) - (ctype (car ctl)) - (boundary (assoc "boundary" (cdr ctl))) - beg end dest) - (if (stringp ctype) - (setq ctype (downcase ctype)) - ) - (search-forward "\n\n" nil t) - (cond (boundary - (let ((sep (concat "\n--" - (setq boundary - (message/strip-quoted-string - (cdr boundary))) - "\n")) - cb ce ct ret ncb) - (setq beg (match-end 0)) - (search-forward (concat "\n--" boundary "--\n") nil t) - (setq end (match-beginning 0)) - (save-excursion - (save-restriction - (narrow-to-region beg end) - (goto-char (point-min)) - (search-forward (concat "--" boundary "\n") nil t) - (setq cb (match-end 0)) - (while (search-forward sep nil t) - (setq ce (match-beginning 0)) - (setq ncb (match-end 0)) - (save-excursion - (save-restriction - (narrow-to-region cb ce) - (setq ret (mime/parse-contents)) - )) - (setq dest (nconc dest (list ret))) - (goto-char (nth 1 ret)) - (search-forward (concat "--" boundary "\n") nil t) - (goto-char (setq cb (match-end 0))) - ) - (setq ce (point-max)) - (save-excursion - (save-restriction - (narrow-to-region cb ce) - (setq ret (mime/parse-contents)) - )) - (setq dest (append dest (list ret))) - )) - (setq beg (point-min)) - (goto-char beg) - (search-forward (concat "\n--" boundary "--\n") nil t) - (setq end (match-beginning 0)) - )) - ((string= ctype "message/rfc822") - (save-excursion - (save-restriction - (narrow-to-region (match-end 0) (point-max)) - (setq dest (list (mime/parse-contents))) + (let ((ctl (progn + (goto-char (point-min)) + (mime/Content-Type) )) - (setq beg (point-min)) - (setq end (point-max)) - ) - (t (setq beg (point-min)) - (setq end (point-max)) - )) - (list beg end dest) - )))) + (encoding (progn + (goto-char (point-min)) + (mime/Content-Transfer-Encoding) + )) + ) + (let ((ctype (car ctl)) + (params (cdr ctl)) + ) + (if (stringp ctype) + (setq ctype (downcase ctype)) + ) + (if (stringp encoding) + (setq encoding (downcase encoding)) + ) + (let ((boundary (assoc "boundary" params))) + (search-forward "\n\n" nil t) + (cond (boundary + (setq boundary + (message/strip-quoted-string (cdr boundary))) + (mime-viewer/parse-multipart + (match-end 0) + (progn + (search-forward (concat "--" boundary "--\n") nil t) + (match-beginning 0) + ) + boundary ctype params encoding) + ) + ((string= ctype "message/rfc822") + (mime::make-content-info + (point-min) (point-max) + ctype params encoding + (save-excursion + (save-restriction + (narrow-to-region (match-end 0) (point-max)) + (list (mime-viewer/parse)) + )) + ) + ) + (t + (mime::make-content-info (point-min) (point-max) + ctype params encoding nil) + )) + )))))) + +(defun mime-viewer/parse-multipart (beg end boundary ctype params encoding) + (let ((sep (concat "^--" boundary "$")) + cb ce ct ret ncb children) + (save-excursion + (save-restriction + (narrow-to-region beg end) + (goto-char (point-min)) + (search-forward (concat "--" boundary "\n") nil t) + (setq cb (match-end 0)) + (while (re-search-forward sep nil t) + (setq ce (match-beginning 0)) + (setq ncb (match-end 0)) + (save-excursion + (save-restriction + (narrow-to-region cb ce) + (setq ret (mime-viewer/parse)) + )) + (setq children (nconc children (list ret))) + (goto-char (mime::content-info/point-max ret)) + (search-forward (concat "--" boundary "\n") nil t) + (goto-char (setq cb (match-end 0))) + ) + (setq ce (point-max)) + (save-excursion + (save-restriction + (narrow-to-region cb ce) + (setq ret (mime-viewer/parse)) + )) + (setq children (nconc children (list ret))) + )) + (setq beg (point-min)) + (goto-char beg) + (mime::make-content-info beg end ctype params encoding children) + )) (defun mime/Content-Type () (save-excursion @@ -312,105 +406,105 @@ (replace-as-filename (mime/get-subject param)) ) -(defun mime/make-preview-buffer (&optional buf cl obuf) - (let ((the-buf (current-buffer)) fcl) - (if (null buf) - (setq buf (current-buffer)) - (setq buf (get-buffer buf)) - ) - (if (null cl) +(defun mime-viewer/make-preview-buffer (&optional buf cinfo obuf) + (let ((the-buf (current-buffer)) pcl dest) + (setq buf + (if (null buf) + (current-buffer) + (get-buffer buf) + )) + (if (null cinfo) (progn (switch-to-buffer buf) - (setq cl mime/content-list) + (setq cinfo mime::article/content-info) )) (if (null obuf) (setq obuf (concat "*Preview-" (buffer-name buf) "*")) ) - (setq fcl (mime/make-flat-content-list cl)) + (setq pcl (mime::make-flat-content-list cinfo)) (if (get-buffer obuf) (kill-buffer obuf) ) - (let ((r fcl) cell cid ctype beg end e nb ne subj dest str) - (while r - (setq cell (car r)) - (setq beg (car cell)) - (setq end (nth 1 cell)) - (setq cid (mime/get-point-content-number beg cl)) - (switch-to-buffer buf) - (save-excursion - (save-restriction - (narrow-to-region beg end) - (goto-char beg) - (setq ctype (mime/Content-Type)) - (setq e - (if (not (member (car ctype) - mime/default-showing-Content-Type-list)) - (progn - (goto-char beg) - (search-forward "\n\n" nil t) - (match-end 0) - ) - (+ end 1) - )) - )) - (if (> e (point-max)) - (setq e (point-max)) - ) - (setq str (buffer-substring beg e)) - (switch-to-buffer obuf) - (setq nb (point)) - (insert str) - (setq ne (point)) - (save-excursion - (save-restriction - (narrow-to-region nb ne) - (mime/decode-message-header) - (setq subj (mime/get-subject (cdr ctype))) - (let ((f (cdr (assoc (car ctype) mime/content-filter-alist)))) - (if (and f (fboundp f)) - (funcall f ctype) - )) - (funcall mime/make-content-header-filter cid) - (goto-char nb) - (funcall mime/make-content-subject-function cid subj ctype) - (setq ne (point-max)) - (setq dest (nconc dest (list (list nb (- ne 1) buf beg end)))) - )) - (goto-char ne) - (setq r (cdr r)) - ) - (set-buffer-modified-p nil) - (setq buffer-read-only t) - (switch-to-buffer the-buf) - (list obuf dest) - ))) + (setq dest + (mapcar + (function + (lambda (cell) + (let ((beg (mime::content-info/point-min cell)) + (end (mime::content-info/point-max cell)) + (ctype (mime::content-info/type cell)) + (params (mime::content-info/parameters cell)) + cnum e nb ne subj str) + (setq cnum (mime::get-point-content-number beg cinfo)) + (switch-to-buffer buf) + (setq e + (if (not + (member + ctype + mime-viewer/default-showing-Content-Type-list)) + (save-excursion + (save-restriction + (goto-char beg) + (search-forward "\n\n" nil t) + (match-end 0) + )) + end)) + (if (> e (point-max)) + (setq e (point-max)) + ) + (setq str (buffer-substring beg e)) + (switch-to-buffer obuf) + (setq nb (point)) + (insert str) + (setq ne (point)) + (prog1 + (save-excursion + (save-restriction + (narrow-to-region nb ne) + (mime/decode-message-header) + (setq subj (mime/get-subject params)) + (let ((f + (cdr + (assoc ctype + mime-viewer/content-filter-alist)))) + (if (and f (fboundp f)) + (funcall f ctype params) + )) + (funcall mime-viewer/content-header-filter-function + cnum) + (goto-char nb) + (funcall mime-viewer/content-subject-function + cnum subj ctype params) + (setq ne (point-max)) + (mime::make-preview-content-info nb (- ne 1) + buf cell) + )) + (goto-char ne) + ) + ))) pcl)) + (set-buffer-modified-p nil) + (setq buffer-read-only t) + (switch-to-buffer the-buf) + (list obuf dest) + )) -(defun mime/parse-message () - (interactive) - (make-variable-buffer-local 'mime/content-list) - (setq mime/content-list (mime/parse-contents)) - (let ((ret (mime/make-preview-buffer))) - (make-variable-buffer-local 'mime/preview-buffer) - (setq mime/preview-buffer (car ret)) - ret)) ;;; @ content information ;;; -(defun mime/get-point-content-number (p &optional cl) - (if (null cl) - (setq cl mime/content-list) +(defun mime::get-point-content-number (p &optional cinfo) + (if (null cinfo) + (setq cinfo mime::article/content-info) ) - (let ((b (car cl)) - (e (nth 1 cl)) - (c (nth 2 cl)) + (let ((b (mime::content-info/point-min cinfo)) + (e (mime::content-info/point-max cinfo)) + (c (mime::content-info/children cinfo)) ) (if (and (<= b p)(<= p e)) (or (let (co ret (sn 0)) (catch 'tag (while c (setq co (car c)) - (setq ret (mime/get-point-content-number p co)) + (setq ret (mime::get-point-content-number p co)) (cond ((eq ret t) (throw 'tag (list sn))) (ret (throw 'tag (cons sn ret))) ) @@ -419,48 +513,50 @@ ))) t)))) -(defun mime/get-content-region (cn &optional cl) - (if (null cl) - (setq cl mime/content-list) +(defun mime::article/get-content-region (cn &optional cinfo) + (if (null cinfo) + (setq cinfo mime::article/content-info) ) (if (eq cn t) - cl + cinfo (let ((sn (car cn))) (if (null sn) - cl - (let ((rcl (nth sn (nth 2 cl)))) - (if rcl - (mime/get-content-region (cdr cn) rcl) + cinfo + (let ((rc (nth sn (mime::content-info/children cinfo)))) + (if rc + (mime::article/get-content-region (cdr cn) rc) )) )))) -(defun mime/make-flat-content-list (&optional cl) - (if (null cl) - (setq cl mime/content-list) +(defun mime::make-flat-content-list (&optional cinfo) + (if (null cinfo) + (setq cinfo mime::article/content-info) ) - (let ((dest (list cl)) - (rcl (nth 2 cl)) + (let ((dest (list cinfo)) + (rcl (mime::content-info/children cinfo)) ) (while rcl - (setq dest (append dest (mime/make-flat-content-list (car rcl)))) + (setq dest (nconc dest (mime::make-flat-content-list (car rcl)))) (setq rcl (cdr rcl)) ) dest)) -(defun mime/get-point-preview-content (p &optional fcl) - (if (null fcl) - (setq fcl mime/preview-flat-content-list) +(defun mime::point-preview-content (p &optional pcl) + (if (null pcl) + (setq pcl mime::preview/content-list) ) (catch 'tag - (let ((r fcl) cell) + (let ((r pcl) cell) (while r (setq cell (car r)) - (if (and (<= (car cell) p)(<= p (nth 1 cell))) + (if (and (<= (mime::preview-content-info/point-min cell) p) + (<= p (mime::preview-content-info/point-max cell)) + ) (throw 'tag cell) ) (setq r (cdr r)) )) - (car (last fcl)) + (car (last pcl)) )) @@ -560,7 +656,7 @@ (total (cdr (assoc "total" cal))) (the-buf (current-buffer)) file - (mother mime/preview-buffer)) + (mother mime::article/preview-buffer)) (if (not (file-exists-p root-dir)) (shell-command (concat "mkdir " root-dir)) ) @@ -615,28 +711,24 @@ (get-unified-alist mime/content-decoding-condition al) ) -(defun mime/decode-content-region (beg end) +(defun mime::article/decode-content-region (cinfo) (interactive "*r") - (let (ctl encoding) - (save-excursion - (save-restriction - (narrow-to-region beg end) - (and (goto-char beg) - (setq ctl (mime/Content-Type)) - (goto-char beg) - (setq encoding (mime/Content-Transfer-Encoding "7bit")) - ))) - (if ctl - (let ((ctype (downcase (car ctl))) method cal ret) - (setq ctl (cdr ctl)) - (setq cal (nconc (list (cons 'type ctype) - (cons 'encoding encoding) - (cons 'major-mode major-mode) - ) - ctl)) - (if mime/body-decoding-mode + (let ((beg (mime::content-info/point-min cinfo)) + (end (mime::content-info/point-max cinfo)) + (ctype (mime::content-info/type cinfo)) + (params (mime::content-info/parameters cinfo)) + (encoding (mime::content-info/encoding cinfo)) + ) + (if ctype + (let (method cal ret) + (setq cal (append (list (cons 'type ctype) + (cons 'encoding encoding) + (cons 'major-mode major-mode) + ) + params)) + (if mime-viewer/decoding-mode (setq cal (cons - (cons 'mode mime/body-decoding-mode) + (cons 'mode mime-viewer/decoding-mode) cal)) ) (setq ret (mime/get-content-decoding-alist cal)) @@ -671,12 +763,11 @@ ;;; @ content filter ;;; -(defun mime/decode-text/plain (ctl) - (interactive) +(defun mime-viewer/filter-text/plain (ctype params) (save-excursion (save-restriction - (let ((charset (cdr (assoc "charset" (cdr ctl)))) - (encoding + (let ((charset (cdr (assoc "charset" params))) + (encoding (save-excursion (save-restriction (goto-char (point-min)) @@ -712,19 +803,32 @@ (progn (setq mime/viewer-mode-map (make-keymap)) (suppress-keymap mime/viewer-mode-map) - (define-key mime/viewer-mode-map "u" 'mime/up-content) - (define-key mime/viewer-mode-map "p" 'mime/previous-content) - (define-key mime/viewer-mode-map "n" 'mime/next-content) - (define-key mime/viewer-mode-map " " 'mime/scroll-up-content) - (define-key mime/viewer-mode-map "\M- " 'mime/scroll-down-content) - (define-key mime/viewer-mode-map "\177" 'mime/scroll-down-content) - (define-key mime/viewer-mode-map "\C-m" 'mime/next-line-content) - (define-key mime/viewer-mode-map "\C-\M-m" 'mime/previous-line-content) - (define-key mime/viewer-mode-map "v" 'mime/play-content) - (define-key mime/viewer-mode-map "e" 'mime/extract-content) - (define-key mime/viewer-mode-map "\C-c\C-p" 'mime/print-content) - (define-key mime/viewer-mode-map "q" 'mime/quit-view-mode) - (define-key mime/viewer-mode-map "\C-c\C-x" 'mime/exit-view-mode) + (define-key mime/viewer-mode-map + "u" (function mime-viewer/up-content)) + (define-key mime/viewer-mode-map + "p" (function mime-viewer/previous-content)) + (define-key mime/viewer-mode-map + "n" (function mime-viewer/next-content)) + (define-key mime/viewer-mode-map + " " (function mime-viewer/scroll-up-content)) + (define-key mime/viewer-mode-map + "\M- " (function mime-viewer/scroll-down-content)) + (define-key mime/viewer-mode-map + "\177" (function mime-viewer/scroll-down-content)) + (define-key mime/viewer-mode-map + "\C-m" (function mime-viewer/next-line-content)) + (define-key mime/viewer-mode-map + "\C-\M-m" (function mime-viewer/previous-line-content)) + (define-key mime/viewer-mode-map + "v" (function mime-viewer/play-content)) + (define-key mime/viewer-mode-map + "e" (function mime-viewer/extract-content)) + (define-key mime/viewer-mode-map + "\C-c\C-p" (function mime-viewer/print-content)) + (define-key mime/viewer-mode-map + "q" (function mime-viewer/quit)) + (define-key mime/viewer-mode-map + "\C-c\C-x" (function mime-viewer/kill-buffer)) )) (defun mime/viewer-mode (&optional mother) @@ -753,13 +857,13 @@ q Quit (erase-buffer) (switch-to-buffer the-buf) ))) - (let ((ret (mime/parse-message)) + (let ((ret (mime-viewer/parse-message)) (mode major-mode)) (switch-to-buffer (car ret)) (setq major-mode 'mime/viewer-mode) (setq mode-name "MIME-View") - (make-variable-buffer-local 'mime/viewer-original-major-mode) - (setq mime/viewer-original-major-mode + (make-variable-buffer-local 'mime::preview/original-major-mode) + (setq mime::preview/original-major-mode (if mother (progn (make-variable-buffer-local @@ -771,10 +875,12 @@ q Quit 'mime/show-message-mode) mode)) (use-local-map mime/viewer-mode-map) - (make-variable-buffer-local 'mime/preview-flat-content-list) - (setq mime/preview-flat-content-list (nth 1 ret)) + (make-variable-buffer-local 'mime::preview/content-list) + (setq mime::preview/content-list (nth 1 ret)) (goto-char - (let ((ce (nth 1 (car mime/preview-flat-content-list))) + (let ((ce (mime::preview-content-info/point-max + (car mime::preview/content-list) + )) e) (goto-char (point-min)) (search-forward "\n\n" nil t) @@ -785,155 +891,167 @@ q Quit (run-hooks 'mime/viewer-mode-hook) )) -(defun mime/decode-content () +(defun mime::preview/decode-content () (interactive) - (let ((pc (mime/get-point-preview-content (point)))) + (let ((pc (mime::point-preview-content (point)))) (if pc (let ((the-buf (current-buffer))) - (switch-to-buffer (nth 2 pc)) - (mime/decode-content-region (nth 3 pc)(nth 4 pc)) - (if (eq (current-buffer) (nth 2 pc)) + (switch-to-buffer (mime::preview-content-info/buffer pc)) + (mime::article/decode-content-region + (mime::preview-content-info/content-info pc)) + (if (eq (current-buffer) + (mime::preview-content-info/buffer pc)) (switch-to-buffer the-buf) ) )))) -(defun mime/play-content () +(defun mime-viewer/play-content () (interactive) - (let ((mime/body-decoding-mode "play")) - (mime/decode-content) + (let ((mime-viewer/decoding-mode "play")) + (mime::preview/decode-content) )) -(defun mime/extract-content () +(defun mime-viewer/extract-content () (interactive) - (let ((mime/body-decoding-mode "extract")) - (mime/decode-content) + (let ((mime-viewer/decoding-mode "extract")) + (mime::preview/decode-content) )) -(defun mime/print-content () +(defun mime-viewer/print-content () (interactive) - (let ((mime/body-decoding-mode "print")) - (mime/decode-content) + (let ((mime-viewer/decoding-mode "print")) + (mime::preview/decode-content) )) -(defun mime/up-content () +(defun mime-viewer/up-content () (interactive) - (let ((pc (mime/get-point-preview-content (point))) + (let ((pc (mime::point-preview-content (point))) cinfo (the-buf (current-buffer)) cn r) - (switch-to-buffer (nth 2 pc)) - (setq cn (mime/get-point-content-number (nth 3 pc))) + (switch-to-buffer (mime::preview-content-info/buffer pc)) + (setq cinfo (mime::preview-content-info/content-info pc)) + (setq cn (mime::get-point-content-number + (mime::content-info/point-min cinfo))) (if (eq cn t) - (mime/quit-view-mode the-buf (nth 2 pc)) - (setq r (mime/get-content-region (butlast cn))) + (mime-viewer/quit the-buf + (mime::preview-content-info/buffer pc) + ) + (setq r (mime::article/get-content-region (butlast cn))) (switch-to-buffer the-buf) (catch 'tag - (let ((rfcl mime/preview-flat-content-list) cell) - (while rfcl - (setq cell (car rfcl)) - (if (and (= (car r)(nth 3 cell)) - (= (nth 1 r)(nth 4 cell)) - ) + (let ((rpcl mime::preview/content-list) cell) + (while rpcl + (setq cell (car rpcl)) + (if (eq r (mime::preview-content-info/content-info cell)) (progn - (goto-char (nth 0 cell)) + (goto-char (mime::preview-content-info/point-min cell)) (throw 'tag nil) )) - (setq rfcl (cdr rfcl)) + (setq rpcl (cdr rpcl)) ))) ))) -(defun mime/previous-content () +(defun mime-viewer/previous-content () (interactive) - (let* ((fcl mime/preview-flat-content-list) + (let* ((pcl mime::preview/content-list) (p (point)) - (i (- (length fcl) 1)) - ) + (i (- (length pcl) 1)) + beg) (catch 'tag (while (>= i 0) - (if (> p (car (nth i fcl))) - (throw 'tag (goto-char (car (nth i fcl)))) + (setq beg (mime::preview-content-info/point-min (nth i pcl))) + (if (> p beg) + (throw 'tag (goto-char beg)) ) (setq i (- i 1)) )) )) -(defun mime/next-content () +(defun mime-viewer/next-content () (interactive) - (let ((fcl mime/preview-flat-content-list) + (let ((pcl mime::preview/content-list) (p (point)) - ) + beg) (catch 'tag - (while fcl - (if (< p (car (car fcl))) - (throw 'tag (goto-char (car (car fcl)))) + (while pcl + (setq beg (mime::preview-content-info/point-min (car pcl))) + (if (< p beg) + (throw 'tag (goto-char beg)) ) - (setq fcl (cdr fcl)) + (setq pcl (cdr pcl)) )) )) -(defun mime/scroll-up-content (&optional h) +(defun mime-viewer/scroll-up-content (&optional h) (interactive) (if (null h) (setq h (- (window-height) 1)) ) - (let ((fcl mime/preview-flat-content-list) + (let ((pcl mime::preview/content-list) (p (point)) - np) - (setq np (or (catch 'tag - (while fcl - (if (< p (car (car fcl))) - (throw 'tag (car (car fcl))) - ) - (setq fcl (cdr fcl)) - )) - (point-max))) + np beg) + (setq np + (or (catch 'tag + (while pcl + (setq beg (mime::preview-content-info/point-min (car pcl))) + (if (< p beg) + (throw 'tag beg) + ) + (setq pcl (cdr pcl)) + )) + (point-max))) (forward-line h) (if (> (point) np) (goto-char np) ))) -(defun mime/scroll-down-content (&optional h) +(defun mime-viewer/scroll-down-content (&optional h) (interactive) (if (null h) (setq h (- (window-height) 1)) ) - (let ((fcl mime/preview-flat-content-list) + (let ((pcl mime::preview/content-list) (p (point)) - pp) - (setq pp (or (let ((i (- (length fcl) 1))) - (catch 'tag - (while (> i 0) - (if (> p (nth 1 (nth i fcl))) - (throw 'tag (nth 1 (nth i fcl))) - ) - (setq i (- i 1)) - ))) - (point-min))) + pp beg) + (setq pp + (or (let ((i (- (length pcl) 1))) + (catch 'tag + (while (> i 0) + (setq beg (mime::preview-content-info/point-min + (nth i pcl))) + (if (> p beg) + (throw 'tag beg) + ) + (setq i (- i 1)) + ))) + (point-min))) (forward-line (- h)) (if (< (point) pp) (goto-char pp) ))) -(defun mime/next-line-content () +(defun mime-viewer/next-line-content () (interactive) - (mime/scroll-up-content 1) + (mime-viewer/scroll-up-content 1) ) -(defun mime/previous-line-content () +(defun mime-viewer/previous-line-content () (interactive) - (mime/scroll-down-content 1) + (mime-viewer/scroll-down-content 1) ) -(defun mime/quit-view-mode (&optional the-buf buf) +(defun mime-viewer/quit (&optional the-buf buf) (interactive) (if (null the-buf) (setq the-buf (current-buffer)) ) (if (null buf) - (setq buf (nth 2 (mime/get-point-preview-content (point)))) + (setq buf (mime::preview-content-info/buffer + (mime::point-preview-content (point)))) ) (let ((r (progn (switch-to-buffer buf) - (assoc major-mode mime/go-to-top-node-method-alist) + (assoc major-mode mime-viewer/quitting-method-alist) ))) (if r (progn @@ -942,7 +1060,7 @@ q Quit )) )) -(defun mime/exit-view-mode () +(defun mime-viewer/kill-buffer () (interactive) (kill-buffer (current-buffer)) ) diff --git a/tm-vm.el b/tm-vm.el index 3f630ac..f119edd 100644 --- a/tm-vm.el +++ b/tm-vm.el @@ -15,16 +15,16 @@ (require 'vm) (defconst tm-vm/RCS-ID - "$Id: tm-vm.el,v 1.7 1994/12/08 14:48:55 morioka Exp $") + "$Id: tm-vm.el,v 2.0 1995/03/11 22:57:32 morioka Exp $") (defconst tm-vm/version (get-version-string tm-vm/RCS-ID)) (define-key vm-mode-map "Z" 'tm-vm/view-message) -(set-alist 'mime/go-to-top-node-method-alist +(set-alist 'mime-viewer/quitting-method-alist 'vm-mode 'tm-vm/quit-view-message) -(set-alist 'mime/go-to-top-node-method-alist +(set-alist 'mime-viewer/quitting-method-alist 'vm-virtual-mode 'tm-vm/quit-view-message) @@ -43,11 +43,11 @@ ;;; (defun tm-vm/quit-view-message() - (mime/exit-view-mode) + (mime-viewer/kill-buffer) (let ((w (get-buffer-window mime/output-buffer-name))) (if w (delete-window w))) (vm-display vm-summary-buffer t - '(mime/exit-view-mode) + '(mime-viewer/kill-buffer) '(this-command)) (vm-widen-page) (goto-char (point-max)) @@ -58,7 +58,8 @@ (goto-char (point-min)) (if vm-honor-page-delimiters (vm-narrow-to-page)) - (select-window (get-buffer-window vm-summary-buffer))) + (select-window (get-buffer-window vm-summary-buffer)) + ) (defun tm-vm/view-message () "Decode and view MIME message for VM" @@ -75,4 +76,5 @@ (narrow-to-region (point) (vm-start-of (car vm-message-pointer))) (goto-char (point-min)) (select-window (vm-get-buffer-window (current-buffer))) - (mime/viewer-mode)) + (mime/viewer-mode) + )