* gnus-art.el (gnus-article-edit-part): Don't jump to nonexistent part.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 24 Aug 2007 10:22:10 +0000 (10:22 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 24 Aug 2007 10:22:10 +0000 (10:22 +0000)
(gnus-mime-view-part-as-type-internal): Default to text/plain for text parts,
 or application/octet-stream as a last resort.
(gnus-mime-view-part-as-type): Don't toggle display.
(gnus-mime-view-part-as-charset): Don't turn off display before querying
 charset.

* mm-view.el (mm-inline-text-html-render-with-w3): Don't add XEmacs stuff to
 undisplayer function in Emacs.
(mm-inline-text-html-render-with-w3m): Remove Emacs/W3 stuff.

* mml.el (mml-generate-mime-1): Prefer utf-8 when encoding text/calendar parts.

lisp/ChangeLog
lisp/gnus-art.el
lisp/mm-view.el
lisp/mml.el

index 0c31aed..69865bd 100644 (file)
@@ -1,3 +1,19 @@
+2007-08-24  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-article-edit-part): Don't jump to nonexistent part.
+       (gnus-mime-view-part-as-type-internal): Default to text/plain for text
+       parts, or application/octet-stream as a last resort.
+       (gnus-mime-view-part-as-type): Don't toggle display.
+       (gnus-mime-view-part-as-charset): Don't turn off display before
+       querying charset.
+
+       * mm-view.el (mm-inline-text-html-render-with-w3): Don't add XEmacs
+       stuff to undisplayer function in Emacs.
+       (mm-inline-text-html-render-with-w3m): Remove Emacs/W3 stuff.
+
+       * mml.el (mml-generate-mime-1): Prefer utf-8 when encoding
+       text/calendar parts.
+
 2007-08-23  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-art.el (gnus-mime-display-single): Use utf-8 by default for
index aed35eb..871983b 100644 (file)
@@ -4605,7 +4605,11 @@ and `gnus-mime-delete-part', and not provided at run-time normally."
     (gnus-summary-show-article)
     (when (and current-id (integerp gnus-auto-select-part))
       (gnus-article-jump-to-part
-       (+ current-id gnus-auto-select-part)))))
+       (if (text-property-any (point-min) (point-max)
+                             'gnus-part (+ current-id gnus-auto-select-part))
+          (+ current-id gnus-auto-select-part)
+        (with-current-buffer gnus-article-buffer
+          (length gnus-article-mime-handle-alist)))))))
 
 (defun gnus-mime-replace-part (file)
   "Replace MIME part under point with an external body."
@@ -4742,7 +4746,11 @@ Deleting parts may malfunction or destroy the article; continue? "))
                ;; Content-Disposition: attachment; filename=...
                (cdr (assq 'filename (cdr (mm-handle-disposition handle))))))
         (def-type (and name (mm-default-file-encoding name))))
-    (and def-type (cons def-type 0))))
+    (or (and def-type (cons def-type 0))
+       (and handle
+            (equal (mm-handle-media-supertype handle) "text")
+            '("text/plain" . 0))
+       '("application/octet-stream" . 0))))
 
 (defun gnus-mime-view-part-as-type (&optional mime-type pred)
   "Choose a MIME media type, and view the part as such.
@@ -4776,6 +4784,8 @@ available media-types."
                            (mm-handle-id handle)))
       (setq gnus-article-mime-handles
            (mm-merge-handles gnus-article-mime-handles handle))
+      (when (mm-handle-displayed-p handle)
+       (mm-remove-part handle))
       (gnus-mm-display-part handle))))
 
 (defun gnus-mime-copy-part (&optional handle arg)
@@ -4943,12 +4953,15 @@ specified charset."
        (gnus-newsgroup-ignored-charsets 'gnus-all)
        gnus-newsgroup-charset form preferred parts)
     (when handle
-      (if (mm-handle-undisplayer handle)
-         (mm-remove-part handle))
-      (when fun
-       (setq gnus-newsgroup-charset
-             (or (cdr (assq arg gnus-summary-show-article-charset-alist))
-                 (mm-read-coding-system "Charset: ")))
+      (when (prog1
+               (and fun
+                    (setq gnus-newsgroup-charset
+                          (or (cdr (assq
+                                    arg
+                                    gnus-summary-show-article-charset-alist))
+                              (mm-read-coding-system "Charset: "))))
+             (if (mm-handle-undisplayer handle)
+                 (mm-remove-part handle)))
        (gnus-mime-strip-charset-parameters handle)
        (when (and (consp (setq form (cdr-safe fun)))
                   (setq form (ignore-errors
index 6bfadab..a0c1545 100644 (file)
         handle
         `(lambda ()
            (let (buffer-read-only)
-             (if (functionp 'remove-specifier)
-                 (mapcar (lambda (prop)
-                           (remove-specifier
-                            (face-property 'default prop)
-                            (current-buffer)))
-                         '(background background-pixmap foreground)))
+             ,@(if (functionp 'remove-specifier)
+                   '((mapcar (lambda (prop)
+                               (remove-specifier
+                                (face-property 'default prop)
+                                (current-buffer)))
+                             '(background background-pixmap foreground))))
              (delete-region ,(point-min-marker)
                             ,(point-max-marker)))))))))
 
        (mm-handle-set-undisplayer
         handle
         `(lambda ()
-           (let (buffer-read-only)
-             (if (functionp 'remove-specifier)
-                 (mapcar (lambda (prop)
-                           (remove-specifier
-                            (face-property 'default prop)
-                            (current-buffer)))
-                         '(background background-pixmap foreground)))
+           (let ((inhibit-read-only t))
              (delete-region ,(point-min-marker)
                             ,(point-max-marker)))))))))
 
index 2e56b76..a9a506b 100644 (file)
@@ -535,7 +535,13 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
                        ;; insert a "; format=flowed" string unless the
                        ;; user has already specified it.
                        (setq flowed (null (assq 'format cont)))))
-                   (setq charset (mm-encode-body charset))
+                   ;; Prefer `utf-8' for text/calendar parts.
+                   (if (or charset
+                           (not (string= type "text/calendar")))
+                       (setq charset (mm-encode-body charset))
+                     (let ((mm-coding-system-priorities
+                            (cons 'utf-8 mm-coding-system-priorities)))
+                       (setq charset (mm-encode-body))))
                    (setq encoding (mm-body-encoding
                                    charset (cdr (assq 'encoding cont))))))
                  (setq coded (buffer-string)))