From c414f07eca8d93a262aa3aaa194837a9c3e57c36 Mon Sep 17 00:00:00 2001 From: morioka Date: Sat, 21 Jun 1997 04:14:36 +0000 Subject: [PATCH] (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)) ...)'. --- mime-view.el | 108 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 56 deletions(-) diff --git a/mime-view.el b/mime-view.el index dea4d05..815e2b2 100644 --- a/mime-view.el +++ b/mime-view.el @@ -6,7 +6,7 @@ ;; Created: 1994/7/13 ;; Renamed: 1994/8/31 from tm-body.el ;; Renamed: 1997/02/19 from tm-view.el -;; Version: $Revision: 0.92 $ +;; Version: $Revision: 0.93 $ ;; Keywords: MIME, multimedia, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -40,7 +40,7 @@ ;;; (defconst mime-view-RCS-ID - "$Id: mime-view.el,v 0.92 1997-06-19 03:27:23 morioka Exp $") + "$Id: mime-view.el,v 0.93 1997-06-21 04:14:36 morioka Exp $") (defconst mime-view-version (get-version-string mime-view-RCS-ID)) @@ -230,50 +230,47 @@ Each elements are regexp of field-name.") (defun mime-view-insert-entity-button (rcnum cinfo ctype params subj encoding) "Insert entity-button." - (save-restriction - (narrow-to-region (point)(point)) - (let ((access-type (assoc "access-type" params)) - (num (or (cdr (assoc "x-part-number" params)) - (if (consp rcnum) - (mapconcat (function - (lambda (num) - (format "%s" (1+ num)) - )) - (reverse rcnum) ".") - "0")) - )) - (cond (access-type - (let ((server (assoc "server" params))) - (setq access-type (cdr access-type)) - (if server - (insert (format "[%s %s ([%s] %s)]\n" num subj - access-type (cdr server))) - (let ((site (cdr (assoc "site" params))) - (dir (cdr (assoc "directory" params))) - ) - (insert (format "[%s %s ([%s] %s:%s)]\n" num subj - access-type site dir)) - ))) - ) - (t - (let ((charset (cdr (assoc "charset" params)))) - (insert (concat "[" num " " subj)) + (mime-insert-button + (let ((access-type (assoc "access-type" params)) + (num (or (cdr (assoc "x-part-number" params)) + (if (consp rcnum) + (mapconcat (function + (lambda (num) + (format "%s" (1+ num)) + )) + (reverse rcnum) ".") + "0")) + )) + (cond (access-type + (let ((server (assoc "server" params))) + (setq access-type (cdr access-type)) + (if server + (format "%s %s ([%s] %s)" + num subj access-type (cdr server)) + (let ((site (cdr (assoc "site" params))) + (dir (cdr (assoc "directory" params))) + ) + (format "%s %s ([%s] %s:%s)" + num subj access-type site dir) + ))) + ) + (t + (let ((charset (cdr (assoc "charset" params)))) + (concat + num " " subj (let ((rest (concat " <" ctype (if charset (concat "; " charset) (if encoding (concat " (" encoding ")")) ) - ">]\n"))) + ">"))) (if (>= (+ (current-column)(length rest))(window-width)) - (insert "\n\t") - ) - (insert rest) - )))) - ) - (mime-add-button (point-min)(1- (point-max)) - (function mime-view-play-current-entity)) - )) + "\n\t") + rest))) + ))) + (function mime-view-play-current-entity)) + ) (defun mime-view-entity-button-function (rcnum cinfo ctype params subj encoding) @@ -474,18 +471,20 @@ The compressed face will be piped to this command.") (or obuf (setq obuf (concat "*Preview-" (buffer-name the-buf) "*"))) (set-buffer (get-buffer-create obuf)) - (setq buffer-read-only nil) - (widen) - (erase-buffer) - (setq mime-raw-buffer the-buf) - (setq mime-view-original-major-mode mode) - (setq major-mode 'mime-view-mode) - (setq mode-name "MIME-View") - (while pcl - (mime-view-display-entity (car pcl) cinfo the-buf obuf) - (setq pcl (cdr pcl)) + (let ((inhibit-read-only t)) + ;;(setq buffer-read-only nil) + (widen) + (erase-buffer) + (setq mime-raw-buffer the-buf) + (setq mime-view-original-major-mode mode) + (setq major-mode 'mime-view-mode) + (setq mode-name "MIME-View") + (while pcl + (mime-view-display-entity (car pcl) cinfo the-buf obuf) + (setq pcl (cdr pcl)) + ) + (set-buffer-modified-p nil) ) - (set-buffer-modified-p nil) (setq buffer-read-only t) (set-buffer the-buf) ) @@ -583,12 +582,9 @@ The compressed face will be piped to this command.") (if (not (search-backward "\n\n" nil t)) (insert "\n") ) - (let ((be (point-max))) - (narrow-to-region be be) - (insert mime-view-announcement-for-message/partial) - (mime-add-button (point-min)(point-max) - (function mime-view-play-current-entity)) - ))) + (mime-insert-button mime-view-announcement-for-message/partial + (function mime-view-play-current-entity)) + )) (defun mime-article/get-uu-filename (param &optional encoding) (if (member (or encoding -- 1.7.10.4