Subject: [PATCH] Fix treesit-install-language-grammar recipe addition
From: nvp <[email-masked]>
To: [email-masked]
Date: Sat, 21 Oct 2023 20:09:21 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

* lisp/treesit.el (treesit-install-language-grammar): fix recipe
addition to `treesit-language-source-alist`

Bug: `treesit-install-language-grammar` adds repeated language
entry to `treesit-language-source-alist` causing circular list.

Recipe to reproduce:
1. `M-x treesit-install-language-grammar` `bash` (enter all defaults)
2. `M-x treesit-install-language-grammar` `bash`

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2023-10-21 built on noah-X580VD
Repository revision: 6f87ee0e3a0727e16079778a4264e6e35cd7f3a8
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
--with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
CXX=gcc-12'
From 9968ab4c223e1f65ab6984543cb63d3c9d62860e Mon Sep 17 00:00:00 2001
From: nverno <[email-masked]>
Date: Sat, 21 Oct 2023 19:54:10 -0700
Subject: [PATCH] Fix treesit-install-language-grammar recipe addition

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

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 80bdf164b07..8100e418303 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -3354,7 +3354,7 @@ treesit-install-language-grammar
                           " ")))
               ;; If success, Save the recipe for the current session.
               (setf (alist-get lang treesit-language-source-alist)
-                    recipe))))
+                    (cdr recipe)))))
       (error
        (display-warning
         'treesit
-- 
2.34.1