From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#70435: 30.0.50; cc-mode: <> are sometimes not reconized as parentheses Date: Sun, 28 Apr 2024 15:44:35 +0000 Message-ID: References: <87le5cuuyq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33435"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , 70435@debbugs.gnu.org To: Herman@muc.de, =?UTF-8?Q?G=C3=A9za?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 28 17:46:10 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 1s16jC-0008XU-3y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Apr 2024 17:46:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s16iz-0006Ng-5T; Sun, 28 Apr 2024 11:45:57 -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 1s16il-0006NF-5n for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 11:45:43 -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 1s16ik-0003gy-UI for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 11:45:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s16j4-0000Mu-B3 for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 11:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Apr 2024 15:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70435 X-GNU-PR-Package: emacs Original-Received: via spool by 70435-submit@debbugs.gnu.org id=B70435.17143191081391 (code B ref 70435); Sun, 28 Apr 2024 15:46:02 +0000 Original-Received: (at 70435) by debbugs.gnu.org; 28 Apr 2024 15:45:08 +0000 Original-Received: from localhost ([127.0.0.1]:50887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s16iC-0000ML-BR for submit@debbugs.gnu.org; Sun, 28 Apr 2024 11:45:08 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:34651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s16i9-0000Lg-9F for 70435@debbugs.gnu.org; Sun, 28 Apr 2024 11:45:06 -0400 Original-Received: (qmail 10323 invoked by uid 3782); 28 Apr 2024 17:44:39 +0200 Original-Received: from muc.de (p4fe15141.dip0.t-ipconnect.de [79.225.81.65]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 28 Apr 2024 17:44:39 +0200 Original-Received: (qmail 13064 invoked by uid 1000); 28 Apr 2024 15:44:35 -0000 Content-Disposition: inline In-Reply-To: <87le5cuuyq.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:284096 Archived-At: Hello, Géza. On Wed, Apr 17, 2024 at 12:47:25 +0200, Herman wrote: > This is a subtle bug. In some cases, <> template delimiters are > not recognized as delimiters, but punctuation characters. > Repro: > - put the yasnippet file (included below) into > /snippets/c++-mode/something > - install yasnippet > - start emacs > - 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. 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 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 producing the effect when typed inside a syntactically correct context, things might be different. Can you reproduce the effect in correct C++ code? > A possible explanation for this is that yasnippet edits the buffer in a > way that cc-mode doesn't notices the edit, so it has no chance to put > the correct syntax info on the inserted characters. > This is the snippet file (a simple template declaration): > --8<---------------cut here---------------start------------->8--- > # -*- mode: snippet -*- > # name: something > # key: ig > # -- > template <${1:typename AAA}> struct Foo; > --8<---------------cut here---------------end--------------->8--- > In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, cairo version > 1.18.0) of 2024-04-12 built on okoska > Repository revision: b83d0d07bb316cd851517897a9d688d639441f90 > Repository branch: my-modifications > Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 > System Description: Debian GNU/Linux trixie/sid -- Alan Mackenzie (Nuremberg, Germany).