2001-12-05 ShengHuo ZHU <zsh@cs.rochester.edu>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 5 Dec 2001 19:27:45 +0000 (19:27 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 5 Dec 2001 19:27:45 +0000 (19:27 +0000)
* mm-view.el: Partially sync with the Gnus CVS.
* gnus-sum.el (gnus-summary-save-article): Nix
gnus-display-mime-function and gnus-article-prepare-hook.

lisp/gnus/ChangeLog
lisp/gnus/gnus-sum.el
lisp/gnus/mm-view.el

index 5ce04c5..bd1d3a8 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-05  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * mm-view.el: Partially sync with the Gnus CVS.
+       * gnus-sum.el (gnus-summary-save-article): Nix
+       gnus-display-mime-function and gnus-article-prepare-hook.
+
 2001-12-01  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * message.el (message-mail): Add send-actions.
index 86e7d31..caee55d 100644 (file)
@@ -9148,7 +9148,9 @@ The variable `gnus-default-article-saver' specifies the saver function."
            (gnus-message 1 "Article %d is unsaveable" article))
        ;; This is a real article.
        (save-window-excursion
-         (gnus-summary-select-article t nil nil article))
+         (let ((gnus-display-mime-function nil)
+               (gnus-article-prepare-hook nil))
+           (gnus-summary-select-article t nil nil article)))
        (save-excursion
          (set-buffer save-buffer)
          (erase-buffer)
index 89b0e5e..2fa24a7 100644 (file)
      `(lambda () (remove-images ,b (1+ ,b))))))
 
 (defun mm-inline-image-xemacs (handle)
+  (insert "\n")
+  (forward-char -1)
   (let ((b (point))
        (annot (make-annotation (mm-get-image handle) nil 'text))
        buffer-read-only)
-    (insert "\n")
     (mm-handle-set-undisplayer
      handle
      `(lambda ()
                    (and (boundp 'w3-meta-charset-content-type-regexp)
                         (re-search-forward
                          w3-meta-charset-content-type-regexp nil t)))
-               (setq charset (or (w3-coding-system-for-mime-charset 
-                                  (buffer-substring-no-properties 
-                                   (match-beginning 2) 
-                                   (match-end 2)))
-                                 charset)))
+               (setq charset
+                     (or (let ((bsubstr (buffer-substring-no-properties
+                                         (match-beginning 2)
+                                         (match-end 2))))
+                           (if (fboundp 'w3-coding-system-for-mime-charset)
+                               (w3-coding-system-for-mime-charset bsubstr)
+                             (mm-charset-to-coding-system bsubstr)))
+                         charset)))
            (delete-region (point-min) (point-max))
            (insert (mm-decode-string text charset))
            (save-window-excursion
                      (url-standalone-mode t))
                  (condition-case var
                      (w3-region (point-min) (point-max))
-                   (error)))))
+                   (error
+                    (delete-region (point-min) (point-max))
+                    (let ((b (point))
+                          (charset (mail-content-type-get
+                                    (mm-handle-type handle) 'charset)))
+                      (if (or (eq charset 'gnus-decoded)
+                              (eq mail-parse-charset 'gnus-decoded))
+                          (save-restriction
+                            (narrow-to-region (point) (point))
+                            (mm-insert-part handle)
+                            (goto-char (point-max)))
+                        (insert (mm-decode-string (mm-get-part handle)
+                                                  charset))))
+                    (message
+                     "Error while rendering html; showing as text/plain"))))))
            (mm-handle-set-undisplayer
             handle
             `(lambda ()
                              '(background background-pixmap foreground)))
                  (delete-region ,(point-min-marker)
                                 ,(point-max-marker)))))))))
-     ((or (equal type "enriched")
-         (equal type "richtext"))
-      (save-excursion
-       (mm-with-unibyte-buffer
-         (mm-insert-part handle)
-         (save-window-excursion
-           (enriched-decode (point-min) (point-max))
-           (setq text (buffer-string)))))
-      (mm-insert-inline handle text))
      ((equal type "x-vcard")
       (mm-insert-inline
        handle
        (concat "\n-- \n"
-              (if (fboundp 'vcard-pretty-print)
-                  (vcard-pretty-print (mm-get-part handle))
-                (vcard-format-string
-                 (vcard-parse-string (mm-get-part handle)
-                                     'vcard-standard-filter))))))
+              (ignore-errors
+                (if (fboundp 'vcard-pretty-print)
+                    (vcard-pretty-print (mm-get-part handle))
+                  (vcard-format-string
+                   (vcard-parse-string (mm-get-part handle)
+                                       'vcard-standard-filter)))))))
      (t
       (let ((b (point))
            (charset (mail-content-type-get
                      (mm-handle-type handle) 'charset)))
        (if (or (eq charset 'gnus-decoded)
                ;; This is probably not entirely correct, but
-               ;; makes rfc822 parts with embedded multiparts work. 
+               ;; makes rfc822 parts with embedded multiparts work.
                (eq mail-parse-charset 'gnus-decoded))
-           (mm-insert-part handle)
+           (save-restriction
+             (narrow-to-region (point) (point))
+             (mm-insert-part handle)
+             (goto-char (point-max)))
          (insert (mm-decode-string (mm-get-part handle) charset)))
        (when (and (equal type "plain")
                   (equal (cdr (assoc 'format (mm-handle-type handle)))
        (save-restriction
          (narrow-to-region b (point))
          (set-text-properties (point-min) (point-max) nil)
+         (when (or (equal type "enriched")
+                   (equal type "richtext"))
+           (enriched-decode (point-min) (point-max)))
          (mm-handle-set-undisplayer
           handle
           `(lambda ()
 
 (defun mm-inline-message (handle)
   (let ((b (point))
+       (bolp (bolp))
        (charset (mail-content-type-get
                  (mm-handle-type handle) 'charset))
        gnus-displaying-mime handles)
        (narrow-to-region b b)
        (mm-insert-part handle)
        (let (gnus-article-mime-handles
-             ;; disable prepare hook 
-             gnus-article-prepare-hook  
+             ;; disable prepare hook
+             gnus-article-prepare-hook
              (gnus-newsgroup-charset
               (or charset gnus-newsgroup-charset)))
          (run-hooks 'gnus-article-decode-hook)
          (gnus-article-prepare-display)
          (setq handles gnus-article-mime-handles))
+       (goto-char (point-min))
+       (unless bolp
+         (insert "\n"))
        (goto-char (point-max))
        (unless (bolp)
          (insert "\n"))