all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil
@ 2022-07-06 19:45 Brennan Vincent
  2022-07-07  8:59 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Brennan Vincent @ 2022-07-06 19:45 UTC (permalink / raw)
  To: 56430

---
 lisp/imenu.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 040e373fb4..0a0931a647 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -464,7 +464,7 @@ imenu--create-keymap
   `(keymap ,title
            ,@(mapcar
               (lambda (item)
-                `(,(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))
--
2.34.1





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil
  2022-07-06 19:45 bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil Brennan Vincent
@ 2022-07-07  8:59 ` Lars Ingebrigtsen
  2022-07-07 14:26   ` Brennan Vincent
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-07  8:59 UTC (permalink / raw)
  To: Brennan Vincent; +Cc: 56430

Brennan Vincent <brennan@umanwizard.com> 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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil
  2022-07-07  8:59 ` Lars Ingebrigtsen
@ 2022-07-07 14:26   ` Brennan Vincent
  2022-07-07 18:02     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Brennan Vincent @ 2022-07-07 14:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56430

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 <brennan@umanwizard.com> 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 <brennan@umanwizard.com> 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?
>
> --





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil
  2022-07-07 14:26   ` Brennan Vincent
@ 2022-07-07 18:02     ` Lars Ingebrigtsen
  2022-07-07 18:18       ` Brennan Vincent
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-07 18:02 UTC (permalink / raw)
  To: Brennan Vincent; +Cc: 56430

Brennan Vincent <brennan@umanwizard.com> 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."


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil
  2022-07-07 18:02     ` Lars Ingebrigtsen
@ 2022-07-07 18:18       ` Brennan Vincent
  2022-07-07 18:22         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Brennan Vincent @ 2022-07-07 18:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56430

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 <brennan@umanwizard.com> 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 <brennan@umanwizard.com> 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."
>
>
> --





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil
  2022-07-07 18:18       ` Brennan Vincent
@ 2022-07-07 18:22         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-07 18:22 UTC (permalink / raw)
  To: Brennan Vincent; +Cc: 56430

Brennan Vincent <brennan@umanwizard.com> writes:

> 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.

Thanks for testing; I've now pushed that change to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-07 18:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 19:45 bug#56430: [PATCH] fix broken `imenu--create-keymap` when an item is nil Brennan Vincent
2022-07-07  8:59 ` Lars Ingebrigtsen
2022-07-07 14:26   ` Brennan Vincent
2022-07-07 18:02     ` Lars Ingebrigtsen
2022-07-07 18:18       ` Brennan Vincent
2022-07-07 18:22         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.