unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Randy Taylor <dev@rjt.dev>
To: Ruijie Yu <ruijie@netyu.xyz>
Cc: Eli Zaretskii <eliz@gnu.org>,
	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 02:08:07 +0000	[thread overview]
Message-ID: <0EAFO0dt2aGv_b4IpqeoEFbeJOQ7nGwDT5YRFYOJjZT174aJgf0tVqpJu-Vl5MvqNX2vJU5pUS5uIStEkQjBKHB535Yzieu4DqZfveAVuEk=@rjt.dev> (raw)
In-Reply-To: <sdvh6rxutvs.fsf@netyu.xyz>

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Saturday, May 27th, 2023 at 21:28, Ruijie Yu <ruijie@netyu.xyz> wrote:
> Randy Taylor dev@rjt.dev writes:
> 
> > Thanks for the report Jimmy.
> > 
> > Patch attached.
> > 
> > [2. text/x-patch; 0001-dockerfile-ts-mode-Prevent-empty-categories-in-imenu.patch]...
> 
> 
> I think you can get rid of the `append' call, no?
> 
> --
> Best,
> 
> 
> RY

Good point, thanks. That's what I get for lazily copying from my other tree-sitter mode :).

New 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: 1183 bytes --]

From 3ec61886ce3807f6125ea315bcb73a446981ad1d 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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el
index f2f30cf2617..2973b5149db 100644
--- a/lisp/progmodes/dockerfile-ts-mode.el
+++ b/lisp/progmodes/dockerfile-ts-mode.el
@@ -123,8 +123,9 @@ 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)))
+    (when stage-index `(("Stage" . ,stage-index)))))
 
 (defun dockerfile-ts-mode--imenu-1 (node)
   "Helper for `dockerfile-ts-mode--imenu'.
-- 
2.40.1


  reply	other threads:[~2023-05-28  2:08 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
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 [this message]
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='0EAFO0dt2aGv_b4IpqeoEFbeJOQ7nGwDT5YRFYOJjZT174aJgf0tVqpJu-Vl5MvqNX2vJU5pUS5uIStEkQjBKHB535Yzieu4DqZfveAVuEk=@rjt.dev' \
    --to=dev@rjt.dev \
    --cc=63759@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ruijie@netyu.xyz \
    --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).