all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: spacibba@aol.com, 72525@debbugs.gnu.org
Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode
Date: Sat, 24 Aug 2024 11:28:12 +0300	[thread overview]
Message-ID: <86le0mnx43.fsf@gnu.org> (raw)
In-Reply-To: <83A0F72A-F41C-4965-8648-9E3C2DDA2BF7@gmail.com> (message from Yuan Fu on Sat, 10 Aug 2024 22:10:01 -0700)

Ping!  Any progress with this?

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 10 Aug 2024 22:10:01 -0700
> Cc: Ergus <spacibba@aol.com>,
>  72525@debbugs.gnu.org
> 
> 
> 
> > On Aug 10, 2024, at 12:56 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> >> Date: Thu, 08 Aug 2024 16:45:42 +0200
> >> From:  Ergus via "Bug reports for GNU Emacs,
> >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >> 
> >> 
> >> 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.
> 
> Yeah I’ll look into this. And yeah there were some discussion around how should we define sexp in c++-ts-mode but there wasn’t a concrete conclusion (I don’t think it’s possible to come up with a concrete one anyway.) Still, if it can be made more convenient for common use-cases I’m more than happy to improve it. Just be aware that I’ll be super busy next week (and I still haven’t done the parse string feature) so it might take me a while to get back.
> 
> Yuan





  reply	other threads:[~2024-08-24  8:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87sevfxecp.fsf.ref@aol.com>
2024-08-08 14:45 ` bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-10  7:56   ` Eli Zaretskii
2024-08-11  5:10     ` Yuan Fu
2024-08-24  8:28       ` Eli Zaretskii [this message]
2024-08-27  2:53         ` Yuan Fu
2024-09-07  7:36           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86le0mnx43.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72525@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.