Gnus development mailing list
 help / color / mirror / Atom feed
From: Michael Sperber <sperber@deinprogramm.de>
To: ding@gnus.org
Subject: PATCH: Unbreak `mailcap-mailcap-entry-passes-test'
Date: Tue, 20 Oct 2015 11:10:55 +0200	[thread overview]
Message-ID: <y9leggpgb1c.fsf@deinprogramm.de> (raw)

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


I had to apply to attached patch to make mailcap work on XEmacs.  I'm
puzzled by this, as I think it should break mailcap for just about
everyone.  On the other hand, I don't see how the code (without) the
patch could work as advertised.

So if somebody could review (and maybe apply) it, that - again - would
be much appreciated.

-- 
Regards,
Mike

[-- Attachment #2: Type: text/plain, Size: 2655 bytes --]

commit 44ac8cc38c99a6f88fc1ea9d065c8971ac39e36b
Author: Mike Sperber <sperber@deinprogramm.de>
Date:   Tue Oct 20 11:06:49 2015 +0200

    	* mailcap.el (mailcap-mailcap-entry-passes-test): Actually return
    	non-nil if no test clause is present, as documented.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e2f0e1..56618b6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2015-10-20  Michael Sperber  <mike@xemacs.org>
 
+	* mailcap.el (mailcap-mailcap-entry-passes-test): Actually return
+	non-nil if no test clause is present, as documented.
+					   
+2015-10-20  Michael Sperber  <mike@xemacs.org>
+
 	* mailcap.el (mailcap-mime-data): Conditonalize `doc-view-mode', which
 	does not exist on XEmacs.
 
diff --git a/lisp/mailcap.el b/lisp/mailcap.el
index a3348c6..cdd20d1 100644
--- a/lisp/mailcap.el
+++ b/lisp/mailcap.el
@@ -560,26 +560,28 @@ MAILCAPS if set; otherwise (on Unix) use the path from RFC 1524, plus
 Also return non-nil if no test clause is present."
   (let ((test (assq 'test info))	; The test clause
 	status)
-    (setq status (and test (split-string (cdr test) " ")))
-    (if (and (or (assoc "needsterm" info)
-		 (assoc "needsterminal" info)
-		 (assoc "needsx11" info))
-	     (not (getenv "DISPLAY")))
-	(setq status nil)
-      (cond
-       ((and (equal (nth 0 status) "test")
-	     (equal (nth 1 status) "-n")
-	     (or (equal (nth 2 status) "$DISPLAY")
-		 (equal (nth 2 status) "\"$DISPLAY\"")))
-	(setq status (if (getenv "DISPLAY") t nil)))
-       ((and (equal (nth 0 status) "test")
-	     (equal (nth 1 status) "-z")
-	     (or (equal (nth 2 status) "$DISPLAY")
-		 (equal (nth 2 status) "\"$DISPLAY\"")))
-	(setq status (if (getenv "DISPLAY") nil t)))
-       (test nil)
-       (t nil)))
-    (and test (listp test) (setcdr test status))))
+    (or (not test)
+	(progn
+	  (setq status (and test (split-string (cdr test) " ")))
+	  (if (and (or (assoc "needsterm" info)
+		       (assoc "needsterminal" info)
+		       (assoc "needsx11" info))
+		   (not (getenv "DISPLAY")))
+	      (setq status nil)
+	    (cond
+	     ((and (equal (nth 0 status) "test")
+		   (equal (nth 1 status) "-n")
+		   (or (equal (nth 2 status) "$DISPLAY")
+		       (equal (nth 2 status) "\"$DISPLAY\"")))
+	      (setq status (if (getenv "DISPLAY") t nil)))
+	     ((and (equal (nth 0 status) "test")
+		   (equal (nth 1 status) "-z")
+		   (or (equal (nth 2 status) "$DISPLAY")
+		       (equal (nth 2 status) "\"$DISPLAY\"")))
+	      (setq status (if (getenv "DISPLAY") nil t)))
+	     (test nil)
+	     (t nil)))
+	  (and test (listp test) (setcdr test status))))))
 
 ;;;
 ;;; The action routines.

             reply	other threads:[~2015-10-20  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  9:10 Michael Sperber [this message]
2015-10-20 11:11 ` Katsumi Yamaoka
2015-10-20 11:51   ` Michael Sperber
2015-10-20 14:25     ` Katsumi Yamaoka
2015-10-20 15:55       ` Michael Sperber

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=y9leggpgb1c.fsf@deinprogramm.de \
    --to=sperber@deinprogramm.de \
    --cc=ding@gnus.org \
    /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).