From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Date: Sat, 10 Aug 2024 10:56:48 +0300 Message-ID: <86le14kdz3.fsf@gnu.org> References: <87sevfxecp.fsf.ref@aol.com> <87sevfxecp.fsf@aol.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32102"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72525@debbugs.gnu.org To: Ergus , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 10 09:57:46 2024 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 1scgyt-00082V-VE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Aug 2024 09:57:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1scgym-0000qr-0Z; Sat, 10 Aug 2024 03:57:36 -0400 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 1scgyj-0000qK-2m for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 03:57:33 -0400 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 1scgyi-0002gK-QI for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 03:57:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=zzYAI755ClxGbDPPhEcuxLihuiEhVj3MqCRYfEtWIJ0=; b=KZjIYwh8J6IeDVvsVYcvAIIoWUl6hIb9Vt8CBmIxIlUnk/wXyuxd9zMdLBetVLsSEu2xAzKSnvaViCwe8V12EaConG7762u/26Bs95YU8VcloEu9VCBE6exTb9zRUO8Jvn4CsInpWwmB8sh3Guihy3KCy3NqcszIqlv/jW9gJSVmwZh/ySNweJWUwt7ObzDiPyPJERMX0jGZ53+MEvsJeE8SPT7aXNe+Sr9lKC7d8Ms4pkHnJcRVwFEaQ7qMzxwiqx0DFjJlteQXsk9ZSJWgrLz/pmJqczzp2UPDQ9yA/yv+BoNx3Ps8gJVJ70yBdVqNyY5SN/q7Lpt8IQGTDAw+4w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1scgzB-00069R-P1 for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 03:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Aug 2024 07:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72525 X-GNU-PR-Package: emacs Original-Received: via spool by 72525-submit@debbugs.gnu.org id=B72525.172327664823600 (code B ref 72525); Sat, 10 Aug 2024 07:58:01 +0000 Original-Received: (at 72525) by debbugs.gnu.org; 10 Aug 2024 07:57:28 +0000 Original-Received: from localhost ([127.0.0.1]:38998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scgye-00068a-0p for submit@debbugs.gnu.org; Sat, 10 Aug 2024 03:57:28 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scgyc-00068G-Ae for 72525@debbugs.gnu.org; Sat, 10 Aug 2024 03:57:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scgy3-0002aM-Vv; Sat, 10 Aug 2024 03:56:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zzYAI755ClxGbDPPhEcuxLihuiEhVj3MqCRYfEtWIJ0=; b=prZbEgd0ZujO AuxtB71CBxHpygx3dselcEwPadBs4h1+MIKAjWOaChYNy3wq+xFWdMKXTFVTEMDpaZE64iP6KzBB5 Io0w2K2PPzCjnW8KckNStctRiZ06OhBL+//ucPIMFOQoPIw7pfHm5iglkGW/tJ90pc/lgD+Xy4nTZ s2wmP3CwWmvU4Doi3TefItNCuXCJ+JPu/36ufCz5Yj7wSLEw+9C6KOsKdIwNl9NuggrgldaLRvjcG nivNkAohyXQAEIz9hXFoEtLexCAcrFSK9WpsFutJScNvNrIQKJ7kb+TwMCcsxzBsUJxOTTaBBJKlE SHtRCemqrPQLWu6pPW8BEw==; In-Reply-To: <87sevfxecp.fsf@aol.com> (bug-gnu-emacs@gnu.org) 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:289986 Archived-At: > Date: Thu, 08 Aug 2024 16:45:42 +0200 > From: Ergus via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > > Hi: > > Using this code: > > ``` > int main() > { > abort(); /* 1 */ > abort(); /* 1 */ > } > ``` > > There is an inconsistency in the c++-ts-mode behavior of `forward-sexp`. > > When there is a comment at the end of the line, if I do `mark-sexp` > (C-M-SPC) consecutively I get this selected regions: > > ----------------------------- > 1. > abort(); > > 2. > abort(); /* 1 */ > > 3. > abort(); /* 1 */ > abort > > 4. > abort(); /* 1 */ > abort() > > 5. > abort(); /* 1 */ > abort(); > > 6. > abort(); /* 1 */ > abort(); /* 1 */ > > ------------------------------- > > > > But when there is NOT trailing comment > > ``` > int main() > { > abort(); > abort(); > } > ``` > > ------------------------------- > 1. > abort(); > > 2. > abort(); > abort(); > ------------------------------- > > > It looks like in the fist example after 3 the sexp definition is more fine > grained (similar to the previous c++-mode behavior) and it selects > separately: > the function name, > the arguments > the semicolon > the comment > > But if there is no comment at the end, it always considers the complete > line as a sexp (including the ;). > > For my use case I would prefer the old behavior because it is consistent > with the current sexp definition in all emacs (with maybe the exception > of python-mode). Because it is easier to copy function names or > function calls with a few movements. > > However, if it is too difficult to reproduce the old behavior; then the > new one may be implemented consistently. Yuan, any comments or suggestions? FWIW, I'm not sure this is a bug: what constitutes a "sexp" in C++ source code is not well-defined.