From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration on feature/tree-sitter Date: Wed, 18 May 2022 23:07:05 +0200 Message-ID: <87leuy5z46.fsf@thornhill.no> References: <5bada349-2f43-4325-b696-70918584cd3d@email.android.com> <83mtfsuluo.fsf@gnu.org> <87sfpjhm33.fsf@thornhill.no> <83a6brufe5.fsf@gnu.org> <87pmkmhp8i.fsf@thornhill.no> <83v8ueuc7i.fsf@gnu.org> <73DE25BA-5EEF-4497-8F98-8C5F20853A61@gmail.com> <87v8uewfuq.fsf@thornhill.no> <87mtfkbt9n.fsf@thornhill.no> <1179E1EC-90EF-4989-BE1D-115498F77F60@gmail.com> <87k0ajygry.fsf@thornhill.no> <6EF70929-5759-4F1A-B878-0C1660FB6831@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3394"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , Emacs Devel , Daniel Colascione To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 18 23:08:07 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrQtq-0000h9-IB for ged-emacs-devel@m.gmane-mx.org; Wed, 18 May 2022 23:08:07 +0200 Original-Received: from localhost ([::1]:50698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrQto-0004e2-LC for ged-emacs-devel@m.gmane-mx.org; Wed, 18 May 2022 17:08:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrQsy-0003xa-Pz for emacs-devel@gnu.org; Wed, 18 May 2022 17:07:12 -0400 Original-Received: from out1.migadu.com ([2001:41d0:2:863f::]:45954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrQsw-0005Kk-Dg; Wed, 18 May 2022 17:07:12 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1652908027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AE9SCyVF8+FAQWRSS5CbItJHepm9BS9Di6XxZ/OfrfY=; b=USqyLY1KDaW8ERfEh8xyUf0YWsWmubv6Gfc7YSKvZvK5Dwz2kKEXZl2RJxPL5uQjwmLL9w tcs74A87ZObVDO449RW0t4i75h/ItcNoYxIC5DCTZ60VUIGgiE3vPgvS5MsojNeYRvYm1H t0jLsWtnOiV5ZawCBjvgDgl9TE6KvYOlA0so+vK6F2VJ9VmytkjuBlLgzKkOmup+MgxuTt Txed0muuPHuwrIT0LtsJMyNGybGZZMBNop+Ok5hdxpECUKQv4wcfOE+x23EMVFoJZBXHg9 0hJqh5laUsxOwZfTxkg1NdtLaykCeeQHFpRsmbNt53YqroS3ejC9MygZyy1DnQ== In-Reply-To: <6EF70929-5759-4F1A-B878-0C1660FB6831@gmail.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: thornhill.no Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=theo@thornhill.no; helo=out1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289937 Archived-At: --=-=-= Content-Type: text/plain > > Thanks, I think it could be very useful. I can add an option for the > user of treesit-traverse-depth-first to control the depth it goes. And > same for treesit-traverse-forward-depth-first. A relative depth of 0 > could mean only traverse siblings and parent, nil means traverse all > the way, a positive number n means traverse n steps down. > Nice, thanks! Also, discovered a typo, and shielded the defuns with a fallback value, see provided patch: Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-fallback-value-for-arg.patch >From b1ef6a6ab06feaae26594206eaa9c93392353ab6 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 18 May 2022 23:03:55 +0200 Subject: [PATCH] Add fallback value for arg Also, fix typo in docstring --- lisp/treesit.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 3313168d66..761c7147a0 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -927,20 +927,20 @@ treesit-beginning-of-defun With ARG, do it that many times. Negative ARG means move forward to the ARGth following beginning of defun. Defun is defined -according to `treesit-defun-pattern'." +according to `treesit-defun-query'." (unless treesit-defun-query (error "Variable `treesit-defun-query' is unset")) - (treesit-search-beginning treesit-defun-query (- arg))) + (treesit-search-beginning treesit-defun-query (- (or arg 1)))) (defun treesit-end-of-defun (&optional arg) "Move forward to the end of a defun. With ARG, do it that many times. Negative ARG means move back to ARGth preceding end of defun. Defun is defined according to -`treesit-defun-pattern'." +`treesit-defun-query'." (unless treesit-defun-query (error "Variable `treesit-defun-query' is unset")) - (treesit-search-end treesit-defun-query arg)) + (treesit-search-end treesit-defun-query (or arg 1))) ;;; Debugging -- 2.25.1 --=-=-=--