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

From: Brennan Vincent <[email-masked]>
Date: Thu, 7 Jul 2022 14:18:16 -0400

Yes. That fixes the issue I was observing, too. My original motivation
was that the lsp-mode was failing to launch for Golang files on master.

Both my diff and yours fix that problem.

I have no strong opinion on which diff is better.

On 2022-07-07 14:02, Lars Ingebrigtsen wrote:
>  Content preview:  Brennan Vincent <[email-masked]> writes: > I actually
>     observed item itself being nil, not just (car item). Does the following simple
>     change fix the problem, then?
>
>  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:
>
>> I actually observed item itself being nil, not just (car item).
>
> Does the following simple change fix the problem, then?
>
> diff --git a/lisp/imenu.el b/lisp/imenu.el
> index 040e373fb4..dcd816cb7a 100644
> --- a/lisp/imenu.el
> +++ b/lisp/imenu.el
> @@ -471,7 +471,7 @@ imenu--create-keymap
>                       (t
>                        (lambda () (interactive)
>                          (if cmd (funcall cmd item) item))))))
> -              alist)))
> +              (seq-filter #'identity alist))))
>
>  (defun imenu--in-alist (str alist)
>    "Check whether the string STR is contained in multi-level ALIST."
>
>
> --