all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Herman Géza" <geza.herman@gmail.com>
Cc: acm@muc.de, Eli Zaretskii <eliz@gnu.org>, 70435@debbugs.gnu.org
Subject: bug#70435: 30.0.50; cc-mode: <> are sometimes not reconized as parentheses
Date: Sun, 28 Apr 2024 20:31:17 +0000	[thread overview]
Message-ID: <Zi6yFdb9ppQr2qOb@ACM> (raw)
In-Reply-To: <87y18xifpb.fsf@gmail.com>

Hello again, Géza.

On Sun, Apr 28, 2024 at 18:47:47 +0200, Herman, Géza wrote:
> Hello Alan,

> Alan Mackenzie <acm@muc.de> writes:

> > You've been a little less than fully explicit, but I think you're
> > executing these commands in the *scratch* buffer.  The first two
> > lines, which are commented out in emacs-lisp-mode, are no longer
> > commented out in C++ Mode.  There is a whole line of garbage after
> > the last end of statement marker, the (double) semicolon on line 2.

> > On using ig<TAB> to insert the snippet, it is hardly surprising that
> > CC Mode's syntactic analysis gets confused.  If you first comment
> > out those first two lines (put the region around them and do C-c
> > C-c), then the inserted snippet appears to get the correct syntax on
> > its template markers.

> > I don't think there's a bug here.  If you could show ig<TAB>
> > producing the effect when typed inside a syntactically correct
> > context, things might be different.  Can you reproduce the effect in
> > correct C++ code?

> You're right, it seems that the example I provided wasn't the best 
> (this issue happens with me in real code, I tried to create a 
> minimal reproducible example).

That's always appreciated.

> If you delete the garbage from the scratch buffer, the bug doesn't 
> reproduce indeed.  But, if you run (setq 
> font-lock-maximum-decoration 2) before switching to c++-mode, the 
> issue reproduces with an empty scratch buffer.  I use this setting 
> because font-lock runs much faster this way, and I rely on the LSP 
> server to do the "full" highlighting.

I confirm I can reproduce the bug with font-lock-maximum-decoration set
to 2.  I'll look into it.

> Sorry about the bad example, here are the fixed repro steps:

> Repro:
> - put the yasnippet file (included below) into
> <emacs-config-dir>/snippets/c++-mode/something
> - install yasnippet
> - start emacs, scratch buffer appears
> - delete the contents of the scratch buffer
> - M-: (setq font-lock-maximum-decoration 2)
> - M-x c++-mode
> - M-x yas-minor-mode
> - load snippets with "M-x yas-reload-all"
> - write "ig", then press TAB to "yas-expand" the snippet
> - move the cursor on the opening "<", and execute "M-x 
>   describe-char"
> - notice that it will say "syntax: . which means: punctuation"
> - if you edit the buffer (like add a space somewhere), and execute
> describe-char again, Emacs will say "syntax: > which means: open,
> matches >", so the syntax class becomes correct.

> Geza

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2024-04-28 20:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 10:47 bug#70435: 30.0.50; cc-mode: <> are sometimes not reconized as parentheses Herman, Géza
2024-04-27  8:33 ` Eli Zaretskii
2024-04-27 10:08   ` Alan Mackenzie
2024-04-28 15:44 ` Alan Mackenzie
2024-04-28 16:47   ` Herman, Géza
2024-04-28 20:31     ` Alan Mackenzie [this message]
2024-04-29 15:53     ` Alan Mackenzie
2024-04-29 17:21       ` Herman, Géza
2024-05-02  9:30         ` Eli Zaretskii
2024-05-02 10:24           ` Alan Mackenzie
2024-05-02 12:49             ` Herman, Géza
2024-05-02 13:16               ` bug#70435: 30.0.50; cc-mode: <> are sometimes not recognized " Alan Mackenzie
2024-05-02 19:58                 ` Herman, Géza
2024-05-05 11:55                   ` Alan Mackenzie

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=Zi6yFdb9ppQr2qOb@ACM \
    --to=acm@muc.de \
    --cc=70435@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=geza.herman@gmail.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.