From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes Date: Sun, 05 Jan 2025 20:05:53 +0200 Organization: LINKOV.NET Message-ID: <871pxhp24e.fsf@mail.linkov.net> References: <87plox4mtp.fsf@masteringemacs.org> <8634lmbs8t.fsf@gnu.org> <87bk0a1u0o.fsf@masteringemacs.org> <86tte2a5o3.fsf@gnu.org> <877cay1lqt.fsf@masteringemacs.org> <86frpma06f.fsf@gnu.org> <86ikueiekp.fsf@mail.linkov.net> <86ed4zg1cc.fsf@mail.linkov.net> <87zflac68t.fsf@mail.linkov.net> <87jzcdlxdp.fsf@mail.linkov.net> <87o71jocgs.fsf@mail.linkov.net> <87wmfwqg7e.fsf@mail.linkov.net> <8734i5fyv1.fsf@mail.linkov.net> <875xmumpzv.fsf@mail.linkov.net> <86ikqubdsd.fsf@gnu.org> <87wmf9912l.fsf@mail.linkov.net> <867c798lco.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25956"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: mickey@masteringemacs.org, casouri@gmail.com, theo@thornhill.no, 73404@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 05 19:25:17 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tUVJM-0006bu-Mn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 19:25:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUVJA-0004Yl-VX; Sun, 05 Jan 2025 13:25:05 -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 1tUVJ9-0004Y0-8n for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:25:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUVJ8-00050u-W1 for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:25:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=zFqBJ9tb9/RvkNoDPUTmzjsaUE20zpEfDECkAjNrR5o=; b=hHE+v1GAINS2d/K/JWph3zblBUQDQc5ZQEBHGVSjPg7Z5oIIAgU576HYpv2pg5StKEgOZLItCzOZPS2jYbDZZJFXXnNMQoY+aqACUvkuN3AafWve2EmG1fJFuKwv7aPy9/1BFyJds41q3O3qz9zaujx+G0lkMPF1RL05THAJSCa5mF2A2/vxyMay+Eyr82hN/0QlgnILrZy+MlQl6uHEPEfWZxDw4VjTRvvrvCUYM/PNcNdVHyiXJpB2fczfSwoOaM/pTULari5uG8NtcLGcc4P4LBM0W1SOaNqDjLYyj8T9AcDgbBX2v/jcbyrYB+PVuqLnoxmTtS/YhsdokRH7Yw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUVJ8-0001TW-Nv for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 18:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73404 X-GNU-PR-Package: emacs Original-Received: via spool by 73404-submit@debbugs.gnu.org id=B73404.17361014895618 (code B ref 73404); Sun, 05 Jan 2025 18:25:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 5 Jan 2025 18:24:49 +0000 Original-Received: from localhost ([127.0.0.1]:35156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUVIu-0001SX-JS for submit@debbugs.gnu.org; Sun, 05 Jan 2025 13:24:48 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:58997) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUVIs-0001S2-T4 for 73404@debbugs.gnu.org; Sun, 05 Jan 2025 13:24:47 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id D82A0E0003; Sun, 5 Jan 2025 18:24:37 +0000 (UTC) In-Reply-To: <867c798lco.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 05 Jan 2025 15:02:31 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298586 Archived-At: >> The command is 'forward-list'. With 'list' it will do in ts-modes >> the same that 'forward-list' already does in non-ts modes. > > Thanks. > > I tried this now in c-ts-mode, and it seems to behave strangely in > some cases. > > First, AFAICT it supports "lists" enclosed in "(..)", "{..}" and > "<..>", but not "[..]". Is that expected? Why don't we support > "[..]"? This looks like a bug. It would be nice if you posted an example. > Next, it many times signals an error "No next group", which is less > useful than it could be. For example: > > w32_get_internal_run_time (void) > { > if (get_process_times_fn) > { > FILETIME create, exit, kernel, user; > HANDLE proc = GetCurrentProcess (); > if ((*get_process_times_fn) (proc, &create, &exit, &kernel, &user)) > { > return ltime (total.QuadPart); > } ^ > } > > return Fcurrent_time (); > } > > If you put point on the semi-colon marked by "^", C-M-n signals an > error. Can't we instead move to the next "list" after > "Fcurrent_time"? 'C-M-n' doesn't move to the next statement in c-mode, since we need to support backward-compatibility. The key that moves to the next statement ignoring nested lists in C modes is 'M-e'. > Also, it sometimes "misses" what looks like a "list". For example: > > s_pfn_Open_Process_Token = (OpenProcessToken_Proc) > get_proc_addr (hm_advapi32, "OpenProcessToken"); > > If you put point at the beginning of the line, C-M-n moves to the end > of the 2nd parenthesized group, not to the end of the first group. Welcome to the twisty maze of tree-sitter grammars. C-M-n is unable to move to the first group because it's inside the node in the AST: (cast_expression "(" type: (type_descriptor type: (type_identifier)) ")" value: (call_expression function: (identifier) arguments: (argument_list "(" (identifier) , (string_literal " (string_content) ") ")"))) Both the first and the 2nd parenthesized groups are inside the "cast_expression" node. > As for terminology: the Emacs user manual calls these "groupings > delimited by parentheses (or whatever else serves as delimiters in the > language you are working with)", or in short "parenthetical group". > Why cannot we keep this terminology? It sounds like it describes its > subject as accurate as we can come up with. So you prefer "group" over "list"? Then 'forward-list' should move over "group"?