Subject: Re: bug#76341: 31.0.50; Confusing prompt after C-q

From: Stefan Monnier <[email-masked]>
Date: Sat, 22 Feb 2025 09:41:25 -0500

> Stefan, do you see a cleaner fix?  I didn't want to test the key
> itself for being [nil], since perhaps it could be [foo bar nil] or
> somesuch?  IOW, what possible forms of key could cause key-description
> produce "<nil>" for its argument?

We call `vector` ourselves with a single arg, so it has to be
a one-element vector, no?

I don't really understand all this code, but looking at the immediate
problem, I'd go with a patch like the one below.

        Stefan

diff --git a/lisp/help.el b/lisp/help.el
index eed52dadf24..48401b8f6dd 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -2198,9 +2198,8 @@
                                    (current-active-maps t)))))
     (catch 'res
       (dolist (val help-event-list)
-        (let ((key (vector (if (eql val 'help)
-                               help-char
-                             val))))
+        (when (setq val (if (eql val 'help) help-char val))
+          (let ((key (vector val)))
           (unless (seq-find (lambda (map) (and (keymapp map) (lookup-key map key)))
                             bindings)
             (throw 'res
@@ -2209,7 +2208,7 @@
                     (substitute-command-keys
                      (format
                       " (\\`%s' for help)"
-                      (key-description key))))))))
+                        (key-description key)))))))))
       str)))