From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/61788 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.gnus.general Subject: mailcap - caching "nil" failed test Date: Sat, 28 Jan 2006 09:15:25 +1100 Message-ID: <87mzhhjp1e.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1138400441 18921 80.91.229.2 (27 Jan 2006 22:20:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Jan 2006 22:20:41 +0000 (UTC) Original-X-From: ding-owner+m10318@lists.math.uh.edu Fri Jan 27 23:20:38 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F2bxL-0006Zp-7A for ding-account@gmane.org; Fri, 27 Jan 2006 23:20:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1F2bxH-0001aU-00; Fri, 27 Jan 2006 16:20:31 -0600 Original-Received: from nas02.math.uh.edu ([129.7.128.40]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1F2bsj-0001aP-00 for ding@lists.math.uh.edu; Fri, 27 Jan 2006 16:15:49 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas02.math.uh.edu with esmtp (Exim 4.52) id 1F2bsh-0003iv-EN for ding@lists.math.uh.edu; Fri, 27 Jan 2006 16:15:49 -0600 Original-Received: from mailout1.pacific.net.au ([61.8.0.84]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1F2bsc-0005Fy-00 for ; Fri, 27 Jan 2006 23:15:42 +0100 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k0RMFawm016649 for ; Sat, 28 Jan 2006 09:15:36 +1100 Original-Received: from localhost (ppp22AB.dyn.pacific.net.au [61.8.34.171]) by mailproxy2.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k0RMFYUu013801 for ; Sat, 28 Jan 2006 09:15:35 +1100 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1F2bsL-0001wD-00; Sat, 28 Jan 2006 09:15:25 +1100 Original-To: ding@gnus.org User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:61788 Archived-At: --=-=-= 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 * 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. --=-=-= Content-Disposition: attachment; filename=mailcap.el.no-cache.diff --- 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))) --=-=-=--