From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: treesit-forward-sexp (was: Make all tree-sitter modes optional) Date: Tue, 17 Jan 2023 19:50:34 +0200 Message-ID: <91305408-5e7b-ec94-a4ef-4cd21d92ca71@yandex.ru> References: <84973.1672843723@hassadar.pretzelnet.org> <83wn62xi3k.fsf@gnu.org> <83o7rexe2n.fsf@gnu.org> <83h6x5xym7.fsf@gnu.org> <83h6wr6gmz.fsf@gnu.org> <831qnu64la.fsf@gnu.org> <83o7qy4l2v.fsf@gnu.org> <55d39dcb-de2f-fe02-e069-f1dd1e50e59b@yandex.ru> <83edru4jaj.fsf@gnu.org> <83sfg92ryn.fsf@gnu.org> <86h6wp5h1j.fsf_-_@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="885"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: Eli Zaretskii , casouri@gmail.com, monnier@iro.umontreal.ca, larsi@gnus.org, theo@thornhill.no, jostein@secure.kjonigsen.net, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 17 18:51:30 2023 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 1pHq7O-000AaT-Bh for ged-emacs-devel@m.gmane-mx.org; Tue, 17 Jan 2023 18:51:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHq6q-0000EV-Vv; Tue, 17 Jan 2023 12:50:57 -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 1pHq6c-00005i-PZ for emacs-devel@gnu.org; Tue, 17 Jan 2023 12:50:47 -0500 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHq6a-0004DG-Ry; Tue, 17 Jan 2023 12:50:42 -0500 Original-Received: by mail-ed1-x52f.google.com with SMTP id z11so46204267ede.1; Tue, 17 Jan 2023 09:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=iUdhw/OzSwx3b7FTYIXJuLrWpfjgUgsPYWlMZQAVudg=; b=G0iSBV4WAYyKjYF9022FdXOBZyJ/nDlTxlI9V+Vt2XhvKjeKGNP1brRdUujRn/2tME w9myRY1mbW0r5q/YVfFZVcMc5K3DU37122q0An4b3ggIfIrWh1a4t9QSbZQ5MFH9rzCL SqSqtX+QXXnsNP3QoE/iJ+Tc/PO1KbMWpj2pffmlRMKKZm/xVx9Q30PwbjwlXN0/yQPm sh5Jr4GCR9M3yqv/gfLIhq9Ztl03rU3Zl9Nj4yqul3XzFDnNYv7Ofowv2SnsiyTp1QXH JCP+RAX8Uh1mCKIZOGMaKcnoRkDmQRK759s7dABgOzHY+wDNDcz0IJHhv/mJcgcujyJz D2mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iUdhw/OzSwx3b7FTYIXJuLrWpfjgUgsPYWlMZQAVudg=; b=tnPR6YHaSikjEPxv0QZ5BUzQRUyg7vYf6fAetygF8THR+DQ7NZsleIjQgL84LA+OhI qFHZlTiDUwGXAqdPZNsIAW0m1ZSIAxWjrmLMS82ezI0P2ZJIKAyiJhVpNs+i1gawDf38 yuBeXOVVH1LL15zy15HhqTGEb598fxsMjEK0M1/XB+OlYFW6IYbMcS2dCqKqDIVlJuIn 0EHeWeLDlRZhasgOFlB9kbMiWwQFsrGYRdGVUl6yRZgdmsSP5MYfCB8IKG5DAt4/NgNm fi1HhV36BAiQBaj79kG1VxaOyQStk8ufQ9Ah00QnkAUu8OxBIRmbfTeek2K8jW1aW1mK XaiA== X-Gm-Message-State: AFqh2kpdgidOSBbChmiBl50wjPySkzw/hOq5Eam/4WRaYclSRtORIJDk FWjiDQ/g25kyYysBFDzn3tc= X-Google-Smtp-Source: AMrXdXvvAkCV2Qyfp4P74kqo7LyvsMa/z70CJJMZYq81Nx6bWkkeTI8oNkGGx9Y9o9g55cSxigJSDw== X-Received: by 2002:a05:6402:cba:b0:49d:25f3:6b4e with SMTP id cn26-20020a0564020cba00b0049d25f36b4emr3704892edb.28.1673977839150; Tue, 17 Jan 2023 09:50:39 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id w5-20020a50fa85000000b00491c819d6d2sm13107364edr.44.2023.01.17.09.50.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 09:50:38 -0800 (PST) Content-Language: en-US In-Reply-To: <86h6wp5h1j.fsf_-_@mail.linkov.net> Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=raaahh@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.097, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:302488 Archived-At: On 17/01/2023 19:34, Juri Linkov wrote: >> I'm using ruby-mode, at least for now, while all the wrinkles with >> indentation haven't been ironed out (and we'll probably not manage to get >> them all 100% right before the 29 release), and while ts modes don't >> support show-paren-mode like SMIE does. No proper sexp navigation, etc. > > BTW, how ruby-ts-mode is intended to be used without proper sexp navigation? > > I see that forward-sentence support for tree sitter was added recently > with treesit-forward-sentence. There are also treesit-transpose-sexps, > treesit-beginning-of-defun and treesit-end-of-defun. > > Are there any plans to add treesit-forward-sexp as well? > > Currently I'm using such workaround: > > ``` > (with-eval-after-load 'ruby-ts-mode > (add-hook 'ruby-ts-mode-hook > (lambda () > (smie-setup ruby-smie-grammar #'ruby-smie-rules > :forward-token #'ruby-smie--forward-token > :backward-token #'ruby-smie--backward-token)))) > ``` I have also been toying with the idea of using SMIE for indentation with ruby-ts-mode, keeping tree-sitter for font-lock and other facilities which are easier to support. But for now I'm working on improving tree-sitter based indentation. After all, the underlying data it's using is by definition more correct. > Maybe something like this should be added to emacs-29 > until treesit-forward-sexp is implemented in master? I don't know if everybody will agree with that. ruby-ts-mode's author in particular. So it's probably better suited for personal customizations, like yours above. BTW note that smie-setup also sets indent-line-function.