;;; Copyright (C) 1995 Free Software Foundation, Inc.
;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
;;;
-;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; modified by Steven L. Baur <steve@miranova.com>
+;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Created: 1994/7/13 (1994/8/31 obsolete tm-body.el)
+;;; Version: $Revision: 7.32.1.2 $
;;; Keywords: mail, news, MIME, multimedia
;;;
;;; This file is part of tm (Tools for MIME).
;;;
-
-;;; @ require modules
+;;; This program is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU General Public License as
+;;; published by the Free Software Foundation; either version 2, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with This program. If not, write to the Free Software
+;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;;
+;;; Code:
(require 'tl-str)
(require 'tl-list)
(require 'tl-atype)
(require 'tl-misc)
-(require 'tl-header)
+(require 'tl-822)
(require 'mel)
-(require 'tiny-mime)
+(require 'tm-ew-d)
(require 'tm-def)
(require 'tm-parse)
;;;
(defconst mime-viewer/RCS-ID
- "$Id: tm-view.el,v 7.6 1995/09/26 11:53:46 morioka Exp $")
+ "$Id: tm-view.el,v 7.32.1.2 1995/12/10 20:29:06 morioka Exp $")
(defconst mime-viewer/version (get-version-string mime-viewer/RCS-ID))
(defconst mime/viewer-version mime-viewer/version)
(defvar mime/content-decoding-condition
'(((type . "text/plain")
(method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
- ;;((type . "text/x-latex")
- ;; (method "tm-latex" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "text/html")
+ (method "tm-html" nil 'file 'type 'encoding 'mode 'name)
+ (mode . "play"))
+ ((type . "text/x-rot13-47")
+ (method . mime-article/decode-caesar))
+
((type . "audio/basic")
(method "tm-au" nil 'file 'type 'encoding 'mode 'name))
+
((type . "image/gif")
(method "tm-image" nil 'file 'type 'encoding 'mode 'name))
((type . "image/jpeg")
(method "tm-image" nil 'file 'type 'encoding 'mode 'name))
((type . "image/x-pic")
(method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+
((type . "video/mpeg")
(method "tm-mpeg" nil 'file 'type 'encoding 'mode 'name))
+
((type . "application/octet-stream")
(method "tm-file" nil 'file 'type 'encoding 'mode 'name))
+
;;((type . "message/external-body")
;; (method "xterm" nil
;; "-e" "showexternal"
;; 'file '"access-type" '"name" '"site" '"directory"))
+ ((type . "message/rfc822")
+ (method . mime-article/view-message/rfc822))
((type . "message/partial")
- (method . mime/decode-message/partial-region))
+ (method . mime-article/decode-message/partial))
+
((method "metamail" t
"-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
((method "tm-file" nil 'file 'type 'encoding 'mode 'name)
(defvar mime-viewer/content-subject-omitting-Content-Type-list
'("application/x-selection"))
+(defvar mime-viewer/content-subject-showing-Content-Type-list
+ '("application/pgp"))
+
(defvar mime-viewer/uuencode-encoding-name-list '("x-uue" "x-uuencode"))
(defvar mime-viewer/ignored-field-list
- '("Received" "Return-Path" "Replied" "Errors-To"
+ '(".*Received" "Return-Path" "Replied" "Errors-To"
"Lines" "Sender" "Path" "Nntp-Posting-Host"
- "Content-Type" "Precedence" "X-Face"))
+ "Content-Type" "Precedence" "X-Face"
+ "Status" "X-VM-.*")
+ "All fields that match this list will be hidden in MIME preview buffer.
+Each elements are regexp of field-name. [tm-view.el]")
-(defvar mime-viewer/ignored-field-regexp)
+(defvar mime-viewer/ignored-field-regexp
+ (concat "^"
+ (apply (function regexp-or) mime-viewer/ignored-field-list)
+ ":"))
(defvar mime-viewer/announcement-for-message/partial
(if (and (>= emacs-major-version 19) window-system)
;;; @@ predicate functions
;;;
-(defun mime-viewer/header-visible-p (cnum cinfo &optional ctype)
- (or (eq cnum t)
+(defun mime-viewer/header-visible-p (rcnum cinfo &optional ctype)
+ (or (null rcnum)
(progn
(setq ctype
(mime::content-info/type
- (mime-article/cnum-to-cinfo (butlast cnum) cinfo)
+ (mime-article/rcnum-to-cinfo (cdr rcnum) cinfo)
))
(member ctype mime-viewer/childrens-header-showing-Content-Type-list)
)))
-(defun mime-viewer/body-visible-p (cnum cinfo &optional ctype)
+(defun mime-viewer/body-visible-p (rcnum cinfo &optional ctype)
(let (ccinfo)
(or ctype
(setq ctype
(mime::content-info/type
- (setq ccinfo (mime-article/cnum-to-cinfo cnum cinfo))
+ (setq ccinfo (mime-article/rcnum-to-cinfo rcnum cinfo))
))
)
(and (member ctype mime-viewer/default-showing-Content-Type-list)
(if (string-equal ctype "application/octet-stream")
(progn
(or ccinfo
- (setq ccinfo (mime-article/cnum-to-cinfo cnum cinfo))
+ (setq ccinfo (mime-article/rcnum-to-cinfo rcnum cinfo))
)
(member (mime::content-info/encoding ccinfo)
'(nil "7bit" "8bit"))
;;;
(defun mime-viewer/insert-content-subject
- (cnum cinfo ctype params subj)
+ (rcnum cinfo ctype params subj)
(save-restriction
(narrow-to-region (point)(point))
(insert
(let ((access-type (assoc "access-type" params))
(num (or (assoc-value "x-part-number" params)
- (if (listp cnum)
+ (if (consp rcnum)
(mapconcat (function
(lambda (num)
(format "%s" (1+ num))
))
- cnum ".")
+ (reverse rcnum) ".")
"0"))
))
(if access-type
))
(defun mime-viewer/default-content-subject-function
- (cnum cinfo ctype params subj)
- (if (and (listp cnum)
+ (rcnum cinfo ctype params subj)
+ (if (and (consp rcnum)
(not (member
ctype
- mime-viewer/content-subject-omitting-Content-Type-list))
- )
+ mime-viewer/content-subject-omitting-Content-Type-list)))
(mime-viewer/insert-content-subject
- cnum cinfo ctype params subj)
+ rcnum cinfo ctype params subj)
))
(defvar mime-viewer/content-subject-function
("application/pgp" . mime-viewer/filter-text/plain)
(nil . mime-viewer/filter-text/plain)))
-(defun mime-viewer/default-content-filter (cnum cinfo ctype params subj)
+(defun mime-viewer/default-content-filter (rcnum cinfo ctype params subj)
)
;;; @@ content separator
;;;
-(defun mime-viewer/default-content-separator (cnum cinfo ctype params subj)
- (if (and (not (mime-viewer/header-visible-p cnum cinfo ctype))
- (not (mime-viewer/body-visible-p cnum cinfo ctype))
+(defun mime-viewer/default-content-separator (rcnum cinfo ctype params subj)
+ (if (and (not (mime-viewer/header-visible-p rcnum cinfo ctype))
+ (not (mime-viewer/body-visible-p rcnum cinfo ctype))
)
(progn
(goto-char (point-max))
;;; @@ buffer local variables
;;;
-(defvar mime::article/content-info nil)
+;; for XEmacs
(defvar mime::article/preview-buffer nil)
+(defvar mime::article/code-converter nil)
-(defvar mime::preview/article-buffer nil)
-(defvar mime::preview/content-list nil)
-(defvar mime::preview/original-major-mode nil)
+(make-variable-buffer-local 'mime::article/content-info)
+(make-variable-buffer-local 'mime::article/preview-buffer)
+(make-variable-buffer-local 'mime::article/code-converter)
+
+(make-variable-buffer-local 'mime::preview/mother-buffer)
+(make-variable-buffer-local 'mime::preview/content-list)
+(make-variable-buffer-local 'mime::preview/article-buffer)
+(make-variable-buffer-local 'mime::preview/original-major-mode)
+(make-variable-buffer-local 'mime::preview/original-window-configuration)
;;; @@ quitting method
(defvar mime-viewer/quitting-method-alist
'((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)
- )))
- ))
+ . mime-viewer/quitting-method-for-mime/show-message-mode)))
+
+(defvar mime-viewer/over-to-previous-method-alist nil)
+(defvar mime-viewer/over-to-next-method-alist nil)
;;; @@ X-Face
(defun mime-viewer/x-face-function ()
"Function to display X-Face field. You can redefine to customize."
- (goto-char (point-min))
- (if (re-search-forward "^X-Face:[ \t]*" nil t)
- (let ((beg (match-end 0))
- (end (message/field-end))
- )
- (call-process-region beg end "sh" nil 0 nil
- "-c" mime-viewer/x-face-command)
- )))
+ ;; 1995/10/12 (c.f. tm-eng:130)
+ ;; fixed by Eric Ding <ericding@San-Jose.ate.slb.com>
+ (save-restriction
+ (narrow-to-region (point-min) (re-search-forward "^$" nil t))
+ ;; end
+ (goto-char (point-min))
+ (if (re-search-forward "^X-Face:[ \t]*" nil t)
+ (let ((beg (match-end 0))
+ (end (rfc822/field-end))
+ )
+ (call-process-region beg end "sh" nil 0 nil
+ "-c" mime-viewer/x-face-command)
+ ))))
;;; @ data structures
(get-buffer ibuf)
(set-buffer ibuf)
))
- (make-variable-buffer-local 'mime::article/content-info)
(setq mime::article/content-info (mime/parse-message ctl encoding))
(let ((ret (mime-viewer/make-preview-buffer obuf)))
- (make-variable-buffer-local 'mime::article/preview-buffer)
(setq mime::article/preview-buffer (car ret))
ret))
(setq bf (get-buffer-create obuf))
(set-buffer obuf)
))
- (make-variable-buffer-local 'mime::preview/article-buffer)
(setq mime::preview/article-buffer the-buf)
- (make-variable-buffer-local 'mime::preview/original-major-mode)
(setq mime::preview/original-major-mode mode)
(setq major-mode 'mime/viewer-mode)
(setq mode-name "MIME-View")
(ctype (mime::content-info/type content))
(params (mime::content-info/parameters content))
(encoding (mime::content-info/encoding content))
- (cnum (mime::get-point-content-number beg cinfo))
+ (rcnum (mime::content-info/rcnum content))
he e nb ne subj)
(set-buffer ibuf)
(goto-char beg)
(if (> he end)
(setq he end)
)
- (setq subj (mime-viewer/get-subject params encoding))
+ (save-restriction
+ (narrow-to-region beg end)
+ (setq subj
+ (mime-eword/decode-string
+ (mime-viewer/get-subject params encoding)))
+ )
(set-buffer obuf)
(setq nb (point))
(narrow-to-region nb nb)
(funcall mime-viewer/content-subject-function
- cnum cinfo ctype params subj)
+ rcnum cinfo ctype params subj)
(set-buffer ibuf)
- (if (mime-viewer/header-visible-p cnum cinfo ctype)
+ (if (mime-viewer/header-visible-p rcnum cinfo ctype)
(mime-viewer/display-header beg he obuf)
)
- (cond ((mime-viewer/body-visible-p cnum cinfo ctype)
+ (if (and (null rcnum)
+ (member
+ ctype mime-viewer/content-subject-showing-Content-Type-list))
+ (save-excursion
+ (set-buffer obuf)
+ (goto-char (point-max))
+ (mime-viewer/insert-content-subject rcnum cinfo ctype params subj)
+ ))
+ (cond ((mime-viewer/body-visible-p rcnum cinfo ctype)
(mime-viewer/display-body he end obuf
- cnum cinfo ctype params subj encoding)
+ rcnum cinfo ctype params subj encoding)
)
((equal ctype "message/partial")
(mime-viewer/display-message/partial obuf)
)
- ((and (eq cnum t)
+ ((and (null rcnum)
(null (mime::content-info/children cinfo))
)
(set-buffer obuf)
- (mime-viewer/insert-content-subject cnum cinfo ctype params subj)
+ (goto-char (point-max))
+ (mime-viewer/insert-content-subject rcnum cinfo ctype params subj)
)
(t (set-buffer obuf))
)
- (mime-viewer/default-content-separator cnum cinfo ctype params subj)
+ (mime-viewer/default-content-separator rcnum cinfo ctype params subj)
(prog1
(progn
(setq ne (point-max))
))))
(defun mime-viewer/display-body (beg end obuf
- cnum cinfo ctype params subj encoding)
+ rcnum cinfo ctype params subj encoding)
(let ((str (buffer-substring beg end))
be)
(set-buffer obuf)
(let ((f (assoc-value ctype mime-viewer/content-filter-alist)))
(if (and f (fboundp f))
(funcall f ctype params encoding)
- (mime-viewer/default-content-filter cnum cinfo ctype params subj)
+ (mime-viewer/default-content-filter rcnum cinfo ctype params subj)
))
)))
""))
(let (ret)
(or (and (setq ret (assoc "name" param))
- (message/strip-quoted-string (cdr ret))
+ (rfc822/strip-quoted-string (cdr ret))
)
(and (setq ret (assoc "x-name" param))
- (message/strip-quoted-string (cdr ret))
+ (rfc822/strip-quoted-string (cdr ret))
)
(save-excursion
)
(point-max)))
(or
- (message/get-field-body "Content-Description")
- (message/get-field-body "Subject")
+ (rfc822/get-field-body "Content-Description")
+ (rfc822/get-field-body "Subject")
)))
""))
))
;;; @ content information
;;;
-(defun mime::get-point-content-number (p &optional cinfo)
+(defun mime-article/point-content-number (p &optional cinfo)
(or cinfo
(setq cinfo mime::article/content-info)
)
(catch 'tag
(while c
(setq co (car c))
- (setq ret (mime::get-point-content-number p co))
+ (setq ret (mime-article/point-content-number p co))
(cond ((eq ret t) (throw 'tag (list sn)))
(ret (throw 'tag (cons sn ret)))
)
)))
t))))
+(defun mime-article/rcnum-to-cinfo (rcnum &optional cinfo)
+ (or cinfo
+ (setq cinfo mime::article/content-info)
+ )
+ (some-element
+ (function
+ (lambda (ci)
+ (equal (mime::content-info/rcnum ci) rcnum)
+ ))
+ (mime/flatten-content-info cinfo)
+ ))
+
(defun mime-article/cnum-to-cinfo (cn &optional cinfo)
(or cinfo
(setq cinfo mime::article/content-info)
)
dest))
-(defun mime::point-preview-content (p &optional pcl)
+(defun mime-preview/point-pcinfo (p &optional pcl)
(or pcl
(setq pcl mime::preview/content-list)
)
;;; @ content filter
;;;
-(defvar mime-viewer/code-converter-alist nil)
+(defvar mime-viewer/code-converter-alist
+ '((mime/show-message-mode . mime/code-convert-region-to-emacs))
+ )
(defun mime-viewer/default-code-convert-region
(beg end charset &optional encoding)
(mime/code-convert-region-to-emacs beg (point-max) charset)
))
+(defun mime-preview/decode-text-region (beg end charset encoding)
+ (mime/decode-region encoding beg end)
+ (let* ((mode mime::preview/original-major-mode)
+ (m (or (save-excursion
+ (set-buffer mime::preview/article-buffer)
+ mime::article/code-converter)
+ (cdr (assq mode mime-viewer/code-converter-alist))
+ ))
+ )
+ (if (and m (fboundp m))
+ (funcall m beg (point-max) charset encoding)
+ (mime-viewer/default-code-convert-region
+ beg (point-max) charset encoding)
+ )))
+
(defun mime-viewer/filter-text/plain (ctype params encoding)
(let ((charset (cdr (assoc "charset" params)))
(beg (point-min)) (end (point-max))
)
- (goto-char (point-min))
- (cond ((string= encoding "quoted-printable")
- (quoted-printable-decode-region beg end)
- )
- ((string= encoding "base64")
- (base64-decode-region beg end)
- ))
- (let* ((mode mime::preview/original-major-mode)
- (m (assq mode mime-viewer/code-converter-alist))
- )
- (if (and m (fboundp (setq m (cdr m))))
- (funcall m beg (point-max) charset encoding)
- (mime-viewer/default-code-convert-region beg (point-max)
- charset encoding)
- )))
+ (mime-preview/decode-text-region beg end charset encoding)
+ )
(goto-char (point-max))
(if (not (eq (char-after (1- (point))) ?\n))
(insert "\n")
)
(if browse-url-browser-function
- (save-excursion
+ (progn
(goto-char (point-min))
(while (re-search-forward tm:URL-regexp nil t)
(tm:add-button (match-beginning 0)(match-end 0)
"q" (function mime-viewer/quit))
(define-key mime/viewer-mode-map
"\C-c\C-x" (function mime-viewer/kill-buffer))
+ (define-key mime/viewer-mode-map
+ "<" (function beginning-of-buffer))
+ (define-key mime/viewer-mode-map
+ ">" (function end-of-buffer))
(if mouse-button-2
(define-key mime/viewer-mode-map
mouse-button-2 (function tm:button-dispatcher))
)
+ (if mouse-button-3
+ (define-key mime/viewer-mode-map
+ mouse-button-3 (function mime-viewer/popup-menu))
+ )
))
+(defvar mime-viewer/popup-menu-title "MIME Viewer Commands")
+(defvar mime-viewer/popup-menu-items
+ '(("Move to upper content" . mime-viewer/up-content)
+ ("Move to previous content" . mime-viewer/previous-content)
+ ("Move to next content" . mime-viewer/next-content)
+ ("Scroll to previous content" . mime-viewer/scroll-down-content)
+ ("Scroll to next content" . mime-viewer/scroll-up-content)
+ ("Play Content" . mime-viewer/play-content)
+ ("Extract Content" . mime-viewer/extract-content)
+ ("Print" . mime-viewer/print-content)
+ ("Show X Face" . mime-viewer/display-x-face)
+ )
+ "Popup Menu for MIME Viewer")
+
+(cond ((string-match "XEmacs\\|Lucid" emacs-version)
+ (defvar mime-viewer/popup-menu
+ (cons mime-viewer/popup-menu-title
+ (mapcar (function
+ (lambda (item)
+ (vector (car item)(cdr item) t)
+ ))
+ mime-viewer/popup-menu-items)))
+ (defun mime-viewer/popup-menu (event)
+ "Popup the menu in the MIME Viewer buffer"
+ (interactive "e")
+ (select-window (event-window event))
+ (set-buffer (event-buffer event))
+ (popup-menu 'mime-viewer/popup-menu))
+ )
+ ((>= emacs-major-version 19)
+ (defun mime-viewer/popup-menu (event)
+ (interactive "e")
+ (mouse-set-point event)
+ (let ((menu
+ (cons mime-viewer/popup-menu-title
+ (list (cons "Menu Items" mime-viewer/popup-menu-items))
+ )))
+ (let ((func (x-popup-menu event menu)))
+ (if func
+ (funcall func)
+ ))
+ ))
+ ))
+
+
(defun mime/viewer-mode (&optional mother ctl encoding ibuf obuf)
"Major mode for viewing MIME message.
\\{mime/viewer-mode-map}
"
(interactive)
- (setq mime-viewer/ignored-field-regexp
- (concat "^\\("
- (mapconcat (function regexp-quote)
- mime-viewer/ignored-field-list "\\|")
- "\\):"))
(let ((buf (get-buffer mime/output-buffer-name)))
(if buf
(save-excursion
(set-buffer buf)
(erase-buffer)
)))
- (let ((ret (mime-viewer/setup-buffer ctl encoding ibuf obuf)))
+ (let ((ret (mime-viewer/setup-buffer ctl encoding ibuf obuf))
+ (win-conf (current-window-configuration))
+ )
(prog1
(switch-to-buffer (car ret))
+ (setq mime::preview/original-window-configuration win-conf)
(if mother
(progn
- (make-variable-buffer-local
- 'mime/show-mode-old-window-configuration)
- (setq mime/show-mode-old-window-configuration
- (current-window-configuration))
- (make-variable-buffer-local 'mime/mother-buffer)
- (setq mime/mother-buffer mother)
+ (setq mime::preview/mother-buffer mother)
))
(use-local-map mime/viewer-mode-map)
- (make-variable-buffer-local 'mime::preview/content-list)
(setq mime::preview/content-list (nth 1 ret))
(goto-char
(let ((ce (mime::preview-content-info/point-max
(defun mime-preview/point-content-number (point)
(save-window-excursion
- (let ((pc (mime::point-preview-content (point)))
+ (let ((pc (mime-preview/point-pcinfo (point)))
cinfo)
(switch-to-buffer (mime::preview-content-info/buffer pc))
(setq cinfo (mime::preview-content-info/content-info pc))
- (mime::get-point-content-number (mime::content-info/point-min cinfo))
+ (mime-article/point-content-number (mime::content-info/point-min cinfo))
)))
(defun mime-preview/cinfo-to-pcinfo (cinfo)
(mime-preview/decode-content)
))
-(defun mime-viewer/play-content-mouse (e)
- (interactive "e")
- (mouse-set-point e)
- (mime-viewer/play-content)
- )
-
(defun mime-viewer/extract-content ()
(interactive)
(let ((mime-viewer/decoding-mode "extract"))
(defun mime-viewer/up-content ()
(interactive)
- (let ((pc (mime::point-preview-content (point))) cinfo
+ (let ((pc (mime-preview/point-pcinfo (point))) cinfo
(the-buf (current-buffer))
- cn r)
+ rcnum r)
(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)
+ (setq rcnum (mime::content-info/rcnum cinfo))
+ (if (null rcnum)
(mime-viewer/quit the-buf
(mime::preview-content-info/buffer pc)
)
- (setq r (mime-article/cnum-to-cinfo (butlast cn)))
+ (setq r (mime-article/rcnum-to-cinfo (cdr rcnum)))
(switch-to-buffer the-buf)
(catch 'tag
(let ((rpcl mime::preview/content-list) cell)
(throw 'tag (goto-char beg))
)
(setq i (- i 1))
- ))
+ )
+ (let ((f (assq mime::preview/original-major-mode
+ mime-viewer/over-to-previous-method-alist)))
+ (if f
+ (funcall (cdr f))
+ ))
+ )
))
(defun mime-viewer/next-content ()
(throw 'tag (goto-char beg))
)
(setq pcl (cdr pcl))
- ))
+ )
+ (let ((f (assq mime::preview/original-major-mode
+ mime-viewer/over-to-next-method-alist)))
+ (if f
+ (funcall (cdr f))
+ ))
+ )
))
(defun mime-viewer/scroll-up-content (&optional h)
(or h
(setq h (- (window-height) 1))
)
- (let ((pcl mime::preview/content-list)
- (p (point))
- 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)
- )
- ;;(show-subtree)
- ))
+ (if (= (point) (point-max))
+ (let ((f (assq mime::preview/original-major-mode
+ mime-viewer/over-to-next-method-alist)))
+ (if f
+ (funcall (cdr f))
+ ))
+ (let ((pcl mime::preview/content-list)
+ (p (point))
+ 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)
+ )
+ ;;(show-subtree)
+ ))
+ )
(defun mime-viewer/scroll-down-content (&optional h)
(interactive)
(or h
(setq h (- (window-height) 1))
)
- (let ((pcl mime::preview/content-list)
- (p (point))
- 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)
- )))
+ (if (= (point) (point-min))
+ (let ((f (assq mime::preview/original-major-mode
+ mime-viewer/over-to-previous-method-alist)))
+ (if f
+ (funcall (cdr f))
+ ))
+ (let ((pcl mime::preview/content-list)
+ (p (point))
+ 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-viewer/next-line-content ()
(interactive)
)
(or buf
(setq buf (mime::preview-content-info/buffer
- (mime::point-preview-content (point))))
+ (mime-preview/point-pcinfo (point))))
)
(let ((r (progn
(switch-to-buffer buf)
- (assoc major-mode mime-viewer/quitting-method-alist)
+ (assq major-mode mime-viewer/quitting-method-alist)
)))
(if r
(progn