Subject: bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil

From: Brennan Vincent <[email-masked]>
Date: Thu, 7 Jul 2022 10:26:37 -0400

I actually observed item itself being nil, not just (car item).

It happens in imenu-update-menubar, because imenu--make-index-alist
always produces (list nil) instead of just nil. The code is uncommented,
so I don't know the original reason for that logic, which you can see here:

https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/imenu.el#n434

This was working fine until imenu--create-keymap was updated to call
intern, by your change on June 24th.

The practical consequence I observed was that lsp-mode stopped working
for Go.

On 7/7/22 04:59, Lars Ingebrigtsen wrote:
>   Content preview:  Brennan Vincent <[email-masked]> writes: > - `(,(intern
>      (car item)) ,(car item) > + `(,(and (car item) (intern (car item))) ,(car
>      item) > ,@(cond > ((imenu--subalist-p item) > (imenu--create-keymap (car
>     item) (cdr item) cmd))
>
>   Content analysis details:   (-2.9 points, 5.0 required)
>
>    pts rule name              description
>   ---- ---------------------- --------------------------------------------------
>   -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
>   -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
>                               [score: 0.0000]
> X-Fes-Encrypted: true
> X-Fes-Ehlo-Domain: quimby.gnus.org
>
> Brennan Vincent <[email-masked]> writes:
>
>> -                `(,(intern (car item)) ,(car item)
>> +                `(,(and (car item) (intern (car item))) ,(car item)
>>                     ,@(cond
>>                        ((imenu--subalist-p item)
>>                         (imenu--create-keymap (car item) (cdr item) cmd))
>
> In what cases is (car item) nil here?  Isn't that a bug in the caller?
>
> --