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

From: Juri Linkov <[email-masked]>
Date: Mon, 06 Dec 2021 11:28:30 +0200

> I think it would be more "obviously correct" if we switched to
> (window-buffer (posn-window (event-end click))) instead.
>
>>    ;; Include text-mode select menu only in strings and comments.
>> -  (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click)))))
>> +  (when (nth 8 (save-excursion
>> +                 (with-current-buffer (window-buffer)
>> +                   (syntax-ppss (posn-point (event-end click))))))
>
> Same here.

Will do this if a simpler solution below is not suitable.

>> +++ b/lisp/help-fns.el
>> @@ -1898,6 +1898,8 @@ help-fns--list-local-commands
>>      (mapatoms
>>       (lambda (sym)
>>         (when (and (commandp sym)
>> +                  ;; Ignore 'ignore'.
>> +                  (not (eq sym 'ignore))
>>                    ;; Ignore aliases.
>>                    (not (symbolp (symbol-function sym)))
>>                    ;; Ignore everything bound.
>
> I'm not sure what to think of this because I don't understand
> its motivation.  IOW at the very least it should come with a comment
> explaining why we need to ignore `ignore`.

The problem is that `describe-mode` calls `context-menu-map`
that it should not do:

  context-menu-map()
  (lambda (_) (context-menu-map))(ignore)
  where-is-internal(ignore nil t)
  help-fns--list-local-commands()
  describe-mode()
  funcall-interactively(describe-mode)
  call-interactively(describe-mode nil nil)
  command-execute(describe-mode)

`context-menu-map' is bound to `ignore', so ignoring `ignore'
will prevent calling it from help-fns--list-local-commands.