Subject: bug#9923: 24.0.91; `where-is' does not find recentf menu items (cmds, not files)

From: Juri Linkov <[email-masked]>
Date: Thu, 30 Sep 2021 09:55:21 +0300

>>> @@ -1898,6 +1898,8 @@ help-fns--list-local-commands
>>>      (mapatoms
>>>       (lambda (sym)
>>>         (when (and (commandp sym)
>>> +                  ;; Ignore errors in context-menu.
>>> +                  (not (eq sym 'ignore))
>>>                    ;; Ignore aliases.
>>>                    (not (symbolp (symbol-function sym)))
>>>                    ;; Ignore everything bound.
>>>
>>> does it make sense to ignore 'ignore' like in this patch?
>>
>> I think so.  Perhaps Stefan has some comments here?
>
> Not comments here, no,

Recently clicking the context menu at the end of the buffer raises an error,
and during the short time period before the problem was noticed and fixed,
the error in one context menu item broke completion of M-x.
It might surprise the users why an error in context menus
affects such unrelated things.  So maybe such patch makes sense
to prevent M-x completion from breaking?

diff --git a/lisp/simple.el b/lisp/simple.el
index b0ff4236e1..5581d41356 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2117,7 +2117,9 @@ read-extended-command--affixation
     (mapcar
      (lambda (command-name)
        (let* ((fun (and (stringp command-name) (intern-soft command-name)))
-              (binding (where-is-internal fun overriding-local-map t))
+              (binding (unless (eq fun 'ignore)
+                         ;; Ignore errors in context-menu.
+                         (where-is-internal fun overriding-local-map t)))
               (obsolete (get fun 'byte-obsolete-info))
               (alias (symbol-function fun))
               (suffix (cond ((symbolp alias)
--