Importing Pterodactyl Gnus v0.68.
[elisp/gnus.git-] / lisp / gnus-art.el
index 4e60965..9a90823 100644 (file)
@@ -1127,6 +1127,7 @@ If PROMPT (the prefix), prompt for a coding system to use."
   "Remove encoded-word encoding from headers."
   (let ((inhibit-point-motion-hooks t)
        (rfc2047-default-charset gnus-newsgroup-default-charset)
+       (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced)
        buffer-read-only)
     (save-restriction
       (message-narrow-to-head)
@@ -2275,6 +2276,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
            (set-window-point (get-buffer-window (current-buffer)) (point))
            t))))))
 
+;;;###autoload
 (defun gnus-article-prepare-display ()
   "Make the current buffer look like a nice article."
   ;; Hooks for getting information from the article.
@@ -2287,9 +2289,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
     (gnus-run-hooks 'gnus-tmp-internal-hook)
     (gnus-run-hooks 'gnus-article-prepare-hook)
     (when gnus-display-mime-function
-      (mm-setup-w3)
-      (let ((url-standalone-mode (not gnus-plugged)))
-       (funcall gnus-display-mime-function)))
+      (funcall gnus-display-mime-function))
     ;; Perform the article display hooks.
     (gnus-run-hooks 'gnus-article-display-hook)))
 
@@ -2386,9 +2386,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   "Interactively choose a view method for the MIME part under point."
   (interactive)
   (gnus-article-check-buffer)
-  (mm-setup-w3)
-  (let ((data (get-text-property (point) 'gnus-data))
-       (url-standalone-mode (not gnus-plugged)))
+  (let ((data (get-text-property (point) 'gnus-data)))
     (mm-interactively-view-part data)))
 
 (defun gnus-mime-copy-part (&optional handle)
@@ -2418,10 +2416,8 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   "Insert the MIME part under point into the current buffer."
   (interactive "P") ; For compatibility reasons we are not using "z".
   (gnus-article-check-buffer)
-  (mm-setup-w3)
   (let* ((data (get-text-property (point) 'gnus-data))
         contents
-        (url-standalone-mode (not gnus-plugged))
         (b (point))
         buffer-read-only)
     (if (mm-handle-undisplayer data)
@@ -2439,9 +2435,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   "View the MIME part under point with an external viewer."
   (interactive)
   (gnus-article-check-buffer)
-  (mm-setup-w3)
   (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
-        (url-standalone-mode (not gnus-plugged))
         (mm-user-display-methods nil)
         (mm-all-images-fit t)
         (rfc2047-default-charset gnus-newsgroup-default-charset)
@@ -2454,9 +2448,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   "View the MIME part under point with an internal viewer."
   (interactive)
   (gnus-article-check-buffer)
-  (mm-setup-w3)
   (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
-        (url-standalone-mode (not gnus-plugged))
         (mm-user-display-methods '((".*" . inline)))
         (mm-all-images-fit t)
         (rfc2047-default-charset gnus-newsgroup-default-charset)
@@ -2549,8 +2541,9 @@ If ALL-HEADERS is non-nil, no headers are hidden."
                                    'filename)
             ""))
        (gnus-tmp-type (car (mm-handle-type handle)))
-       (gnus-tmp-description (or (mm-handle-description handle)
-                                 ""))
+       (gnus-tmp-description
+        (mail-decode-encoded-word-string (or (mm-handle-description handle)
+                                             "")))
        (gnus-tmp-dots
         (if (if displayed (car displayed)
               (mm-handle-displayed-p handle))
@@ -2595,9 +2588,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
 
 (defun gnus-widget-press-button (elems el)
   (goto-char (widget-get elems :from))
-  (mm-setup-w3)
-  (let ((url-standalone-mode (not gnus-plugged)))
-    (gnus-article-press-button)))
+  (gnus-article-press-button))
 
 (defun gnus-display-mime (&optional ihandles)
   "Insert MIME buttons in the buffer."
@@ -2629,18 +2620,22 @@ If ALL-HEADERS is non-nil, no headers are hidden."
            (delete-region (point) (point-max)))
          (gnus-mime-display-part handles))))))
 
+(defvar gnus-mime-display-multipart-as-mixed nil)
+
 (defun gnus-mime-display-part (handle)
   (cond
    ;; Single part.
    ((not (stringp (car handle)))
     (gnus-mime-display-single handle))
    ;; multipart/alternative
-   ((equal (car handle) "multipart/alternative")
+   ((and (equal (car handle) "multipart/alternative")
+        (not gnus-mime-display-multipart-as-mixed))
     (let ((id (1+ (length gnus-article-mime-handle-alist))))
       (push (cons id handle) gnus-article-mime-handle-alist)
       (gnus-mime-display-alternative (cdr handle) nil nil id)))
    ;; multipart/related
-   ((equal (car handle) "multipart/related")
+   ((and (equal (car handle) "multipart/related")
+        (not gnus-mime-display-multipart-as-mixed))
     ;;;!!!We should find the start part, but we just default
     ;;;!!!to the first part.
     (gnus-mime-display-part (cadr handle)))
@@ -3922,7 +3917,7 @@ forbidden in URL encoding."
     (select-window win)))
 
 (defvar gnus-decode-header-methods
-  '(gnus-decode-with-mail-decode-encoded-word-region)
+  '(mail-decode-encoded-word-region)
   "List of methods used to decode headers.
 
 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
@@ -3938,11 +3933,6 @@ For example:
 
 (defvar gnus-decode-header-methods-cache nil)
 
-(defun gnus-decode-with-mail-decode-encoded-word-region (start end)
-  (let ((rfc2047-default-charset gnus-newsgroup-default-charset)
-       (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
-    (mail-decode-encoded-word-region start end)))
-
 (defun gnus-multi-decode-header (start end)
   "Apply the functions from `gnus-encoded-word-methods' that match."
   (unless (and gnus-decode-header-methods-cache