Subject: Error opening HTML mail when mm-text-html-renderer is nil

From: "Basil L. Contovounesios" <[email-masked]>
Date: Tue, 20 Mar 2018 01:46:22 +0000

(Hopefully someone else can reproduce this issue without my having to
 start an uncustomised Gnus.)

1. M-x toggle-debug-on-error RET
2. M-x set-variable RET mm-text-html-renderer RET nil RET
3. Open a HTML article in Gnus, e.g. by typing RET in a summary buffer

This results in the attached backtrace.

I'm quite unfamiliar with the relevant code, but the patch I am
currently using as a workaround follows my signature, as do listings of
my Gnus and Emacs versions.

Thanks,

-- 
Basil

Gnus v5.13
GNU Emacs 27.0.50 (build 16, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2018-03-19

diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index c11af7060b..6cd93c91a4 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -311,17 +311,18 @@ mm-inline-render-with-function
 
 (defun mm-inline-text-html (handle)
   (if (stringp (car handle))
-      (mapcar 'mm-inline-text-html (cdr handle))
-    (let* ((func mm-text-html-renderer)
-	   (entry (assq func mm-text-html-renderer-alist))
-	   (inhibit-read-only t))
-      (if entry
-	  (setq func (cdr entry)))
+      (mapcar #'mm-inline-text-html (cdr handle))
+    (let ((func (alist-get mm-text-html-renderer
+                           mm-text-html-renderer-alist
+                           mm-text-html-renderer))
+          (inhibit-read-only t))
       (cond
        ((functionp func)
 	(funcall func handle))
+       ((functionp (car func))
+        (apply (car func) handle (cdr func)))
        (t
-	(apply (car func) handle (cdr func)))))))
+        (mm-interactively-view-part handle))))))
 
 (defun mm-inline-text-vcard (handle)
   (let ((inhibit-read-only t))
diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el
index 3d202890b6..f1256bdef5 100644
--- a/lisp/mh-e/mh-gnus.el
+++ b/lisp/mh-e/mh-gnus.el
@@ -165,8 +165,8 @@ mh-mm-save-part
 
 (defun mh-mm-text-html-renderer ()
   "Find the renderer Gnus is using to display text/html MIME parts."
-  (or (and (boundp 'mm-inline-text-html-renderer) mm-inline-text-html-renderer)
-      (and (boundp 'mm-text-html-renderer) mm-text-html-renderer)))
+  (or (bound-and-true-p mm-inline-text-html-renderer)
+      (bound-and-true-p mm-text-html-renderer)))
 
 (provide 'mh-gnus)
 
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index e2c682a399..8ad1877327 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -140,9 +140,7 @@ mh-mm-inline-media-tests
     ("text/html"
      ,(if (fboundp 'mm-inline-text-html) 'mm-inline-text-html 'mm-inline-text)
      (lambda (handle)
-       (or (and (boundp 'mm-inline-text-html-renderer)
-                mm-inline-text-html-renderer)
-           (and (boundp 'mm-text-html-renderer) mm-text-html-renderer))))
+       (mh-mm-text-html-renderer)))
     ("text/x-vcard"
      mh-mm-inline-text-vcard
      (lambda (handle)
@@ -781,9 +779,9 @@ mh-small-image-p
         (mm-inline-large-images t))
     (and media-test
          (equal (mm-handle-media-supertype handle) "image")
-         (funcall media-test handle) ; Since mm-inline-large-images is T,
-                                        ; this only tells us if the image is
-                                        ; something that emacs can display
+         (funcall media-test handle) ; Since `mm-inline-large-images' is t,
+                                     ; this only tells us if the image is
+                                     ; something that Emacs can display
          (let* ((image (mm-get-image handle)))
            (or (mh-do-in-xemacs
                  (and (mh-funcall-if-exists glyphp image)