From: Randy Taylor <dev@rjt.dev>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Jimmy Yuen Ho Wong <wyuenho@gmail.com>, 63759@debbugs.gnu.org
Subject: bug#63759: 29.0.91; dockerfile-ts-mode--imenu returns invalid index
Date: Sun, 28 May 2023 00:57:03 +0000 [thread overview]
Message-ID: <3L3FD8w6qqIZzCOUi2VZg1RNgfSDljIQvLCNffR0X9_waGZ1dWIiwyHZoiK-Nkv19wAwKy8PULK5RLDU82cAAQ2OV3ivxGCCdLn4TBVMYNA=@rjt.dev> (raw)
In-Reply-To: <83y1l9ipxx.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]
On Saturday, May 27th, 2023 at 14:33, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Jimmy Yuen Ho Wong wyuenho@gmail.com
>
> > Date: Sat, 27 May 2023 18:38:29 +0100
> >
> > Reproduction:
> >
> > 0. Open a Emacs GUI, i.e. NS port
> > 1. C-x C-f /some/nonexistent/Dockerfile
> > 2. M-x toggle-debug-on-error
> > 2. M-x imenu-add-menubar-index
> > 3. Click on the Index > Stage menu item
> > 4. Observe the following error pops up
> >
> > Expectation:
> >
> > If the dockerfile-ts-mode buffer is empty, there should not be an extra
> > item preset in the imenu index that when clicked on will jump to a
> > non-existent location and result in an error.
> >
> > `Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) imenu-default-goto-function("Stage" nil) imenu(("Stage" nil imenu-default-goto-function)) imenu(("Stage")) imenu--menubar-select(("Stage")) #f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>)() funcall-interactively(#f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>)) #<subr call-interactively>(#f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>) nil nil) call-interactively@ido-cr+-record-current-command(#<subr call-interactively> #f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>) nil nil) apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (#f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>) nil nil)) call-interactively(#f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>) nil nil) command-execute(#f(compiled-function () (interactive nil) #<bytecode 0xcfe8182542f4cbd>))`
>
>
> Thanks.
>
> Randy, can you p-lease look into this?
Thanks for the report Jimmy.
Patch attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-dockerfile-ts-mode-Prevent-empty-categories-in-imenu.patch --]
[-- Type: text/x-patch; name=0001-dockerfile-ts-mode-Prevent-empty-categories-in-imenu.patch, Size: 1200 bytes --]
From 479d474153a71753391ae3323416cdadfe79638d Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Sat, 27 May 2023 20:52:37 -0400
Subject: [PATCH] dockerfile-ts-mode: Prevent empty categories in imenu
(Bug#63759)
* lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode--imenu):
Don't include empty categories.
---
lisp/progmodes/dockerfile-ts-mode.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el
index f2f30cf2617..078f5965341 100644
--- a/lisp/progmodes/dockerfile-ts-mode.el
+++ b/lisp/progmodes/dockerfile-ts-mode.el
@@ -123,8 +123,10 @@ dockerfile-ts-mode--imenu
(let* ((node (treesit-buffer-root-node))
(stage-tree (treesit-induce-sparse-tree
node "from_instruction"
- nil 1000)))
- `(("Stage" . ,(dockerfile-ts-mode--imenu-1 stage-tree)))))
+ nil 1000))
+ (stage-index (dockerfile-ts-mode--imenu-1 stage-tree)))
+ (append
+ (when stage-index `(("Stage" . ,stage-index))))))
(defun dockerfile-ts-mode--imenu-1 (node)
"Helper for `dockerfile-ts-mode--imenu'.
--
2.40.1
next prev parent reply other threads:[~2023-05-28 0:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-27 17:38 bug#63759: 29.0.91; dockerfile-ts-mode--imenu returns invalid index Jimmy Yuen Ho Wong
2023-05-27 18:34 ` Eli Zaretskii
2023-05-28 0:57 ` Randy Taylor [this message]
2023-05-28 1:28 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-28 2:08 ` Randy Taylor
2023-05-28 10:34 ` Jimmy Wong
2023-05-31 13:03 ` Randy Taylor
2023-05-31 13:19 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='3L3FD8w6qqIZzCOUi2VZg1RNgfSDljIQvLCNffR0X9_waGZ1dWIiwyHZoiK-Nkv19wAwKy8PULK5RLDU82cAAQ2OV3ivxGCCdLn4TBVMYNA=@rjt.dev' \
--to=dev@rjt.dev \
--cc=63759@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=wyuenho@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).