Gnus development mailing list
 help / color / mirror / Atom feed
* mailcap - caching "nil" failed test
@ 2006-01-27 22:15 Kevin Ryde
  2006-01-31  1:12 ` Katsumi Yamaoka
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2006-01-27 22:15 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

If there's a mailcap-mime-data entry with no 'test clause, then I
think mailcap-viewer-test-cache is getting an entry "(nil t)" which
means that "nil" for failure comes back as "t" for success.

I struck this with a silly mozilla entry in the debian /etc/mailcap,
"text/html; false; x-mozilla-flags=internal" when viewing some html.
It then makes failed tests like my pdf on a dumb tty example end up
getting run.

2006-01-28  Kevin Ryde  <user42@zip.com.au>

	* mailcap.el (mailcap-viewer-passes-test): Don't put "(nil t)" into
	mailcap-viewer-test-cache when there's no 'test clause, since that
	will invert the meaning of a "nil" test previously determined by
	mailcap-mailcap-entry-passes-test.

In the diff below I didn't reindent the second half of the func, so as
to best show the actual bits changed.


[-- Attachment #2: mailcap.el.no-cache.diff --]
[-- Type: text/plain, Size: 981 bytes --]

--- mailcap.el.~7.8.~	2006-01-26 09:44:03.000000000 +1100
+++ mailcap.el	2006-01-28 09:01:39.000000000 +1100
@@ -644,12 +644,13 @@
 	 (viewer (cdr (assoc 'viewer viewer-info)))
 	 (default-directory (expand-file-name "~/"))
 	 status parsed-test cache result)
-    (if (setq cache (assoc test mailcap-viewer-test-cache))
-	(cadr cache)
+    (cond ((setq cache (assoc test mailcap-viewer-test-cache))
+	   (cadr cache))
+          ((not test-info) t)		; No test clause
+          (t
       (setq
        result
        (cond
-	((not test-info) t)		; No test clause
 	((not test) nil)		; Already failed test
 	((eq test t) t)			; Already passed test
 	((functionp test)		; Lisp function as test
@@ -667,7 +668,7 @@
 	       status (apply 'call-process test))
 	 (eq 0 status))))
       (push (list otest result) mailcap-viewer-test-cache)
-      result)))
+      result))))
 
 (defun mailcap-add-mailcap-entry (major minor info)
   (let ((old-major (assoc major mailcap-mime-data)))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-03 21:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-27 22:15 mailcap - caching "nil" failed test Kevin Ryde
2006-01-31  1:12 ` Katsumi Yamaoka
2006-02-03 14:54   ` Zlatko Calusic
2006-02-03 21:09     ` Kevin Ryde

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).