From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.devel Subject: Re: Plug treesit.el into other emacs constructs Date: Fri, 16 Dec 2022 11:02:59 +0100 Message-ID: <87fsdfacoc.fsf@gmail.com> References: <87wn6whete.fsf@thornhill.no> <861qp1tvcw.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19029"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier , Theodor Thornhill , emacs-devel@gnu.org, eliz@gnu.org, casouri@gmail.com To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 16 11:04:04 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 1p67ZQ-0004aW-Cq for ged-emacs-devel@m.gmane-mx.org; Fri, 16 Dec 2022 11:04:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p67Yh-0001zp-GK; Fri, 16 Dec 2022 05:03:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p67YX-0001xn-OZ for emacs-devel@gnu.org; Fri, 16 Dec 2022 05:03:11 -0500 Original-Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p67YV-0008WS-IK; Fri, 16 Dec 2022 05:03:04 -0500 Original-Received: by mail-wm1-x32c.google.com with SMTP id ay40so1495193wmb.2; Fri, 16 Dec 2022 02:03:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zlHhTLKLDLMz/fSB6hmqvt/fnl3FUg0zGxGfeW4bZzI=; b=cK7+gF/DMMAsLowQQ298NBhW/g6fqoIozVJw6yGYMg+7qtUkDaxY40cCIGL7vbGWe+ r2rOxkvCwXbQH2z2eP4crJWIKm+ssVAUA69z4F3BzaDRY87T/Lm6xNp8yMHh4pvUlgIE sADAN9zv3r6rdHuvqr44NUmJ+BD33knZAC0wVmyKfdsFAvklpkDaNWj2DMTMDrMGrj/U NZi/kzyXO8D/D2CSVVJSGSXQ1K/xAawCUg6mOzOxg0UbLspQgW4Fc+RAhqF+V7aJYgXR 7pTO2318f7F3IUGMF7BCCTJ9CVWKtpHcZhozuWcLLu/2uSAxDVOV5thIaM/EOeK2nQ2c VsJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zlHhTLKLDLMz/fSB6hmqvt/fnl3FUg0zGxGfeW4bZzI=; b=TNfFVr4WK+WDi+9zyu7mQ6BC+RPYFrGgL75dA2FJH6qAhrQbi2Pn5hlI5JFUn6WYvw ubPJ0OZPfAmkk6m0ZUgQZe8caOGKlQB479cNTYRWIdprkRZvBNbY4l3tr5/nVa8aixsr ZuDCF5pz3i3/B1+MINjHoaZyIbMrU/Rgg5Dg8S5UJhAkGHsBf9YDWH2eDPziIWa7rIM+ 4CgTNh+xI/W/STk41Z4h1cbRV94sONCWaFzkDbbcC3Y/tzjJB0X7eiYKO/YuIK21vDwP TwfFE7lUuOjj+XwcWxK+DvChrmwObVfrwm1YEKxpm1NBzvj4S6c2jhDkX6lL57hdPoso KMUg== X-Gm-Message-State: ANoB5pnK3NAjHZNS+8u2/ev3qcgIjt+Opkxhnr4Ij0CykSgVUlD6fQDc 7oUUDlNl9rPpAJ61vMVaO7g= X-Google-Smtp-Source: AA0mqf7kfZ6p+vp7T1MRo/+xSaudDnnsEAwH1szmwzjv8HIUc+2jVWd0hXmeY2dIdX8zxsq4yKw+Nw== X-Received: by 2002:a05:600c:3496:b0:3d0:878b:d005 with SMTP id a22-20020a05600c349600b003d0878bd005mr24554888wmq.41.1671184981277; Fri, 16 Dec 2022 02:03:01 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id h5-20020a05600c2ca500b003d1e1f421bfsm9803816wmc.10.2022.12.16.02.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 02:03:00 -0800 (PST) In-Reply-To: <861qp1tvcw.fsf@stephe-leake.org> (Stephen Leake's message of "Wed, 14 Dec 2022 15:32:15 -0800") Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=kevin.legouguec@gmail.com; helo=mail-wm1-x32c.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301481 Archived-At: Stephen Leake writes: > Stefan Monnier writes: > >> Cool, thanks, a few comments (based on my experience with adding >> similar things based on `smie`): >> >>> ** Forward-sexp: >>> Executing C-M-f repeatedly will go from: >>> ``` >>> public void foo(|String bar, String baz) {} >>> ``` >>> to >>> ``` >>> public void foo(String bar|, String baz) {} >>> ``` >> >> That looks wrong. `String` is a valid AST node. Whether it gets a node >> in tree-sitter or not, I don't know, but here there are several "sexps" >> that start at point and I think `forward-sexp` should be conservative >> and keep advancing by the smallest option. > > ada-mode has something similar; forward-sexp goes to the next labeled > keyword. That's more useful than stopping at every little AST node. It > relies on markup in the grammar to label the keywords; tree-sitter would > need another markup similar to the current indent markup. Chiming in since I got bitten by this in ada-mode right now: as someone used to mark long_identifiers_with_underscores with C-M-SPC in other modes, it's tripping me up that mark-sexp (and sexp movement in general) "overshoots" and goes over much bigger expressions in ada-mode. Identifiers are a unit I manipulate much more often than other kinds of expressions, so it's useful for me to have C-M-* recognize them. I find it tolerable to "spam" C-M-* when needed to move over bigger units; YMMV =F0=9F=A4=B7