From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lynn Winebarger Newsgroups: gmane.emacs.devel Subject: Re: Plug treesit.el into other emacs constructs Date: Tue, 27 Dec 2022 10:46:35 -0500 Message-ID: References: <87wn6whete.fsf@thornhill.no> <87r0x3gnv5.fsf@thornhill.no> <04BB786A-3ED1-4918-8583-17AA01A1E453@gmail.com> <4E3940CA-67A6-45B7-8785-4E60FDECCDFB@gmail.com> <4315EFC6-7AA8-4A48-845C-9CA8B88034D9@thornhill.no> <87bko521n0.fsf@thornhill.no> <87359h1ybt.fsf@thornhill.no> <871qp01msi.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40105"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , Yuan Fu , emacs-devel@gnu.org, eliz@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 27 16:47:20 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 1pACAh-000AEF-SO for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Dec 2022 16:47:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pACAN-0002N2-BU; Tue, 27 Dec 2022 10:46:59 -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 1pACAH-0002MP-Lg for emacs-devel@gnu.org; Tue, 27 Dec 2022 10:46:54 -0500 Original-Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pACAE-0006lK-KT; Tue, 27 Dec 2022 10:46:51 -0500 Original-Received: by mail-pf1-x430.google.com with SMTP id w26so9082006pfj.6; Tue, 27 Dec 2022 07:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DDzIaaEohLh311MXIjladXQaFVLvrnIKMzoZAB3jFe4=; b=E6oS1GBlLiJXe+uXRdEAGQvdWnCJ7xOc9pypcwBlN4uzzCAKrcnJmNvE1gJ8MMBp6Z qr0F6qkaBwHxHxQRMRhHsa1CcQGTZwF7lnOuomTn50pcap8am1453CAjtD2ceYQp/Sw0 WtMqCQafXRgSyJxT2bGf59pIXC7vLRKIJ6+mSNDoKQ1GZ41D1oXRl4ShUSu0pgaiXasj P0B0msPMcoEXEtMpe27IBMrijb5YnDA6TaWdUTUvUyr0UGD4KBdqVKMWIoNLbGzvBGiN ztUYJnVPWQQFzO94HIuUWKDoWCR7IXrcZ2z4bKYPno9Mpx/HBw1YGYdsUXpuZh0Hv1Cy EXHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DDzIaaEohLh311MXIjladXQaFVLvrnIKMzoZAB3jFe4=; b=m6EW52oSZr8sXFD0SGVDxJGq9O2VgcBeBCVb5S/HofAZyjfcS7X33Y4saxaYEdEc58 ap+JN0iNelNb0yGNuIq6oSTDy9u059OR/kygIHxsvQzLtdYxX1fFHJ3nHJYtws0685QK pC5Jr8b2mOLTxTNkJjq9BxC9ajzhRLJL2OWR9WBptTN+X5xrdLjOCsvO8qvS+cY6fQet X1Iidy51J4DqtG6/EeMfD4ONWjp0wFtT8wQhjOJOhxN7fzF0xLgoOlSs7bXgqdrzTmI4 JpNit3zdt2eZV+3gJgmrNc7TPj4sXzuEWsBT7VQE/LlZIZv2Ec/fhFn4H3/gZFg07sZq zdqg== X-Gm-Message-State: AFqh2kphSuzOTwaaG0oQHGRE+ue4eyyJuFMjspft4KoFgVT8aiMG0hLv s84aRoovy+LNJI6lrOywMrjjqWuBR4SioxK9XUg= X-Google-Smtp-Source: AMrXdXsrTdIvL9gD5qDcSUcdfV3FFQV6NfPkgx2C1OTK7R0DdTWAO7Qd7kjiHPuMF9IQPOHobk2Fe/U4UfS9Nz0ohM4= X-Received: by 2002:a63:38a:0:b0:494:7a78:4bc5 with SMTP id 132-20020a63038a000000b004947a784bc5mr1342198pgd.425.1672156008482; Tue, 27 Dec 2022 07:46:48 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=owinebar@gmail.com; helo=mail-pf1-x430.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:301965 Archived-At: On Thu, Dec 15, 2022 at 2:57 PM Stefan Monnier wrote: > > > If this code is plugged into transpose-sexps we get this nice behavior: > > It's a bit different from what SMIE would do, but there's a lot of > overlap and when it's different it's arguably better, so sounds good > to me. > > > Now forward/backward-sexp can actually work a little differently, as you > > suggest, or we can let it use the same "move over siblings"-semantic. > > In that case we don't even need the treesit-sexp-type-regexp variables to > > control this, I think. > > > > What do you think? > > I'm not sufficiently familiar with the tree-sitter tree to foresee > precisely how it would affect `forward/backward-sexp`, but I think you > have a good enough understanding to make a good judgment at this > point :-) A while ago, I created a LALR(1) grammar with "generic" symbols that encapsulated essentially all "standard" syntactic constructs I've seen in programming languages: top-level forms, statements, blocks, sequences, constructors, keyword forms (including ones with op, l-values, r-values, prefix/postfix/infix & unary/binary operators, calls, destructuring l-values, quoted data, interpolating quotation and other interpolating forms, etc. It was pretty neat. If I can ensure it (or some equivalent grammar) is unencumbered I'd like to document it and extend emacs's syntax tables to be able to analyze a buffer using these constructs instead of just s-expressions, with modes just providing a map of language-specific tokens to the generic symbols. Lynn