GNU bug report logs -
#56430
[PATCH] fix broken `imenu--create-keymap` when an item is nil
Previous Next
Reported by: Brennan Vincent <brennan <at> umanwizard.com>
Date: Wed, 6 Jul 2022 20:15:02 UTC
Severity: normal
Tags: moreinfo, patch
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56430 in the body.
You can then email your comments to 56430 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56430
; Package
emacs
.
(Wed, 06 Jul 2022 20:15:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Brennan Vincent <brennan <at> umanwizard.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 06 Jul 2022 20:15:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
---
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56430
; Package
emacs
.
(Thu, 07 Jul 2022 09:01:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 56430 <at> debbugs.gnu.org (full text, mbox):
Brennan Vincent <brennan <at> 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
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 07 Jul 2022 09:01:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56430
; Package
emacs
.
(Thu, 07 Jul 2022 15:02:03 GMT)
Full text and
rfc822 format available.
Message #13 received at 56430 <at> debbugs.gnu.org (full text, mbox):
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 <at> 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 <at> 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?
>
> --
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56430
; Package
emacs
.
(Thu, 07 Jul 2022 18:03:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 56430 <at> debbugs.gnu.org (full text, mbox):
Brennan Vincent <brennan <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56430
; Package
emacs
.
(Thu, 07 Jul 2022 18:23:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 56430 <at> debbugs.gnu.org (full text, mbox):
Brennan Vincent <brennan <at> 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
bug marked as fixed in version 29.1, send any further explanations to
56430 <at> debbugs.gnu.org and Brennan Vincent <brennan <at> umanwizard.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 07 Jul 2022 18:23:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56430
; Package
emacs
.
(Thu, 07 Jul 2022 18:59:01 GMT)
Full text and
rfc822 format available.
Message #24 received at 56430 <at> debbugs.gnu.org (full text, mbox):
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 <at> 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 <at> 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."
>
>
> --
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 05 Aug 2022 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.