(mime-entity-safe-filename): Use `mime-read-field' instead of
[elisp/semi.git] / mime-view.el
index 88d9297..32ff988 100644 (file)
@@ -27,7 +27,6 @@
 
 ;;; Code:
 
-(require 'std11)
 (require 'mime)
 (require 'semi-def)
 (require 'calist)
@@ -252,8 +251,8 @@ If optional argument MESSAGE-INFO is not specified,
             ))))
 
 (defun mime-view-entity-title (entity)
-  (or (mime-entity-read-field entity 'Content-Description)
-      (mime-entity-read-field entity 'Subject)
+  (or (mime-read-field 'Content-Description entity)
+      (mime-read-field 'Subject entity)
       (mime-entity-filename entity)
       ""))
 
@@ -715,38 +714,6 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t.  t means default."
   '("From"))
 
 
-;;; @ X-Face
-;;;
-
-;; hack from Gnus 5.0.4.
-
-(defvar mime-view-x-face-to-pbm-command
-  "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm")
-
-(defvar mime-view-x-face-command
-  (concat mime-view-x-face-to-pbm-command
-         " | xv -quit -")
-  "String to be executed to display an X-Face field.
-The command will be executed in a sub-shell asynchronously.
-The compressed face will be piped to this command.")
-
-(defun mime-view-x-face-function ()
-  "Function to display X-Face field. You can redefine to customize."
-  ;; 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 (std11-field-end))
-             )
-         (call-process-region beg end "sh" nil 0 nil
-                              "-c" mime-view-x-face-command)
-         ))))
-
-
 ;;; @ buffer setup
 ;;;
 
@@ -836,7 +803,6 @@ The compressed face will be piped to this command.")
     (play       "Play current entity"     mime-preview-play-current-entity)
     (extract    "Extract current entity"  mime-preview-extract-current-entity)
     (print      "Print current entity"    mime-preview-print-current-entity)
-    (x-face     "Show X Face"             mime-preview-display-x-face)
     )
   "Menu for MIME Viewer")
 
@@ -968,10 +934,9 @@ The compressed face will be piped to this command.")
        (setq preview-buffer
              (concat "*Preview-" (buffer-name raw-buffer) "*")))
     (set-buffer raw-buffer)
-    (mime-parse-buffer)
     (setq mime-preview-buffer preview-buffer)
     (let ((inhibit-read-only t))
-      (switch-to-buffer preview-buffer)
+      (set-buffer (get-buffer-create preview-buffer))
       (widen)
       (erase-buffer)
       (setq mime-raw-buffer raw-buffer)
@@ -994,19 +959,21 @@ The compressed face will be piped to this command.")
          (search-forward "\n\n" nil t)
          ))
       (run-hooks 'mime-view-mode-hook)
-      ))
-  (set-buffer-modified-p nil)
-  (setq buffer-read-only t)
-  )
+      (set-buffer-modified-p nil)
+      (setq buffer-read-only t)
+      (or (get-buffer-window preview-buffer)
+         (let ((r-win (get-buffer-window raw-buffer)))
+           (if r-win
+               (set-window-buffer r-win preview-buffer)
+             (switch-to-buffer preview-buffer)
+             )))
+      )))
 
 (defun mime-view-buffer (&optional raw-buffer preview-buffer mother
                                   default-keymap-or-function)
   (interactive)
   (mime-display-message
-   (save-excursion
-     (if raw-buffer (set-buffer raw-buffer))
-     (mime-parse-message)
-     )
+   (mime-parse-buffer raw-buffer)
    preview-buffer mother default-keymap-or-function))
 
 (defun mime-view-mode (&optional mother ctl encoding
@@ -1039,7 +1006,7 @@ button-2  Move to point under the mouse cursor
    (save-excursion
      (if raw-buffer (set-buffer raw-buffer))
      (or mime-view-redisplay
-        (mime-parse-message ctl encoding))
+        (setq mime-message-structure (mime-parse-message ctl encoding)))
      )
    preview-buffer mother default-keymap-or-function))
 
@@ -1201,17 +1168,6 @@ It calls following-method selected from variable
        ))))
 
 
-;;; @@ X-Face
-;;;
-
-(defun mime-preview-display-x-face ()
-  (interactive)
-  (save-window-excursion
-    (set-buffer mime-raw-buffer)
-    (mime-view-x-face-function)
-    ))
-
-
 ;;; @@ moving
 ;;;