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

From: Juri Linkov <[email-masked]>
Date: Sun, 03 Oct 2021 20:54:47 +0300

> So maybe we should add an `with-demoted-errors` and just mention
> context-menu as an example of the kind of errors we want to disregard.

Another case that I posted earlier was where-is-internal failing
in help-fns--list-local-commands because of context-menu errors.
So maybe with-demoted-errors could be added to both?

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 6be5cd4a50..ef4eb447a5 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1950,7 +1950,9 @@ help-fns--list-local-commands
                   ;; Ignore aliases.
                   (not (symbolp (symbol-function sym)))
                   ;; Ignore everything bound.
-                  (not (where-is-internal sym nil t))
+                  (not (with-demoted-errors
+                           ;; Ignore errors in context-menu.
+                           (where-is-internal sym nil t)))
                   (apply #'derived-mode-p (command-modes sym)))
          (push sym functions))))
     (with-temp-buffer
diff --git a/lisp/simple.el b/lisp/simple.el
index 3695415163..d90fd7efdf 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2120,7 +2120,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 (with-demoted-errors
+                           ;; 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)