]> git.eshelyaron.com Git - emacs.git/commitdiff
dockerfile-ts-mode: Prevent empty categories in imenu (Bug#63759)
authorRandy Taylor <dev@rjt.dev>
Sun, 28 May 2023 00:52:37 +0000 (20:52 -0400)
committerEli Zaretskii <eliz@gnu.org>
Wed, 31 May 2023 13:17:19 +0000 (16:17 +0300)
* lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode--imenu):
Don't include empty categories.

lisp/progmodes/dockerfile-ts-mode.el

index f2f30cf2617e8bbd3e14e64b619e1468766e23bc..2973b5149dbf1d1a16861629d75567d30a9cd5e3 100644 (file)
@@ -123,8 +123,9 @@ continuation to the previous entry."
   (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'.