Gnus development mailing list
 help / color / mirror / Atom feed
From: Colin Walters <walters@cis.ohio-state.edu>
Subject: Re: first MIME part not displayed
Date: Mon, 09 Jul 2001 16:56:48 -0400	[thread overview]
Message-ID: <87hewl3jov.church.of.emacs@cis.ohio-state.edu> (raw)
In-Reply-To: <87y9pxx37u.church.of.emacs@cis.ohio-state.edu> (Colin Walters's message of "Mon, 09 Jul 2001 16:22:13 -0400")

Colin Walters <walters@cis.ohio-state.edu> writes:

> Yeah, this is my fault, I think.  Patch in the works.

Ok, this should fix the problems, I hope.  I think it's better anyways
than the previous patch, because now we leave the choice of
"defaulting" to text/plain up to the user, by putting it in
`mm-inline-media-tests'.

2001-07-09  Colin Walters  <walters@cis.ohio-state.edu>

	* mm-decode.el (mm-inline-media-tests): Default to displaying as
	text/plain if the type doesn't match any other media types.
	(mm-inlined-types): Doc fix.
	(mm-display-inline): Revert previous change (now handled by a
	default type in `mm-inline-media-tests'.
	(mm-inlinable-p): Revive.
	(mm-display-part): Call `mm-inlinable-p'.
	(mm-attachment-override-p): Ditto.
	(mm-inlined-p): Doc fix.
	
	* gnus-art.el (gnus-mime-display-single): Call `mm-inlinable-p' as
	well as `mm-inlined-p'.

--- gnus-art.el.~6.86.~	Mon Jul  9 14:57:41 2001
+++ gnus-art.el	Mon Jul  9 16:51:04 2001
@@ -3869,7 +3869,9 @@
 				       "inline")
 				(mm-attachment-override-p handle))))
 		 (mm-automatic-display-p handle)
-		 (or (mm-inlined-p handle)
+		 (or (and
+		      (mm-inlinable-p handle)
+		      (mm-inlined-p handle))
 		     (mm-automatic-external-display-p type)))
 	    (setq display t)
 	  (when (equal (mm-handle-media-supertype handle) "text")

--- mm-decode.el.~6.38.~	Thu Jul  5 15:07:49 2001
+++ mm-decode.el	Mon Jul  9 16:42:12 2001
@@ -178,7 +178,9 @@
     ("application/pkcs7-signature" ignore identity)
     ("multipart/alternative" ignore identity)
     ("multipart/mixed" ignore identity)
-    ("multipart/related" ignore identity))
+    ("multipart/related" ignore identity)
+    ;; Default to displaying as text
+    (".*" mm-inline-text identity))
   "Alist of media types/tests saying whether types can be displayed inline."
   :type '(repeat (list (string :tag "MIME type")
 		       (function :tag "Display function")
@@ -192,8 +194,7 @@
     "application/pkcs7-signature")
   "List of media types that are to be displayed inline.
 See also `mm-inline-media-tests', which says how to display a media
-type inline.  If no media test is defined, the default is to treat the
-type as plain text."
+type inline."
   :type '(repeat string)
   :group 'mime-display)
 
@@ -541,7 +542,8 @@
 	(mm-remove-part handle)
       (let* ((type (mm-handle-media-type handle))
 	     (method (mailcap-mime-info type)))
-	(if (mm-inlined-p handle)
+	(if (and (mm-inlinable-p handle)
+		 (mm-inlined-p handle))
 	    (progn
 	      (forward-line 1)
 	      (mm-display-inline handle)
@@ -744,7 +746,7 @@
 (defun mm-display-inline (handle)
   (let* ((type (mm-handle-media-type handle))
 	 (function (cadr (mm-assoc-string-match mm-inline-media-tests type))))
-    (funcall (or function #'mm-inline-text) handle)
+    (funcall function handle)
     (goto-char (point-min))))
 
 (defun mm-assoc-string-match (alist type)
@@ -764,8 +766,21 @@
 	      methods nil)))
     result))
 
+(defun mm-inlinable-p (handle)
+  "Say whether HANDLE can be displayed inline."
+  (let ((alist mm-inline-media-tests)
+	(type (mm-handle-media-type handle))
+	test)
+    (while alist
+      (when (string-match (caar alist) type)
+	(setq test (caddar alist)
+	      alist nil)
+	(setq test (funcall test handle)))
+      (pop alist))
+    test))
+
 (defun mm-inlined-p (handle)
-  "Say whether the user wants HANDLE to be displayed automatically."
+  "Say whether the user wants HANDLE to be displayed inline."
   (let ((methods mm-inlined-types)
 	(type (mm-handle-media-type handle))
 	method result)
@@ -783,7 +798,8 @@
 	ty)
     (catch 'found
       (while (setq ty (pop types))
-	(when (string-match ty type)
+	(when (and (string-match ty type)
+		   (mm-inlinable-p ty))
 	  (throw 'found t))))))
 
 (defun mm-inline-override-p (handle)


  reply	other threads:[~2001-07-09 20:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-07  4:06 Paul Jarc
2001-07-07 18:35 ` Raymond Scholz
2001-07-09 20:22   ` Colin Walters
2001-07-09 20:56     ` Colin Walters [this message]
2001-07-10  0:06       ` ShengHuo ZHU
2001-07-11 16:05       ` Paul Jarc
2001-07-11 18:58         ` Raymond Scholz
2001-07-11 19:33 ` Colin Walters
2001-07-11 19:51   ` Paul Jarc
2001-07-12 17:13 ` ShengHuo ZHU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hewl3jov.church.of.emacs@cis.ohio-state.edu \
    --to=walters@cis.ohio-state.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).