GNU logs - #50640, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#50640: 28.0.50; incorrect highlighting in C++ mode
Resent-From: Vincent Lefevre <vincent@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 17 Sep 2021 12:59:02 +0000
Resent-Message-ID: <handler.50640.B.16318834879562 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 50640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 50640 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.16318834879562
          (code B ref -1); Fri, 17 Sep 2021 12:59:02 +0000
Received: (at submit) by debbugs.gnu.org; 17 Sep 2021 12:58:07 +0000
Received: from localhost ([127.0.0.1]:58729 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRDRP-0002UA-8H
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 08:58:07 -0400
Received: from lists.gnu.org ([209.51.188.17]:60246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vincent@HIDDEN>) id 1mRDRL-0002U0-6o
 for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 08:58:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45246)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <vincent@HIDDEN>)
 id 1mRDRK-0005L1-V2
 for bug-gnu-emacs@HIDDEN; Fri, 17 Sep 2021 08:58:02 -0400
Received: from joooj.vinc17.net ([2001:4b99:1:3:216:3eff:fe20:ac98]:37684)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <vincent@HIDDEN>)
 id 1mRDR5-0001hO-AV
 for bug-gnu-emacs@HIDDEN; Fri, 17 Sep 2021 08:58:02 -0400
Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128])
 by joooj.vinc17.net (Postfix) with ESMTPSA id E2DE4307;
 Fri, 17 Sep 2021 14:57:31 +0200 (CEST)
Received: by zira.vinc17.org (Postfix, from userid 1000)
 id A3AF3C20ED3; Fri, 17 Sep 2021 14:57:31 +0200 (CEST)
From: Vincent Lefevre <vincent@HIDDEN>
Date: Fri, 17 Sep 2021 14:57:31 +0200
Message-ID: <87czp79x6s.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: none client-ip=2001:4b99:1:3:216:3eff:fe20:ac98;
 envelope-from=vincent@HIDDEN; helo=joooj.vinc17.net
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)


Consider a test.cc file containing:

  if (xMin - xt < t3Font->glyphX ||
      yMin - yt < t3Font->glyphY ||
      xMax - xt > t3Font->glyphX + t3Font->glyphW ||
      yMax - yt > t3Font->glyphY + t3Font->glyphH) {
  }

(this comes from the xpdf source) and open it with "emacs -Q".

The first two "xt" and "yt" are highlighted in green instead of
remaining in black. If I remove the last condition as follows
and reopen the file:

  if (xMin - xt < t3Font->glyphX ||
      yMin - yt < t3Font->glyphY ||
      xMax - xt > t3Font->glyphX + t3Font->glyphW) {
  }

then only the "yt" is highlighted incorrectly.


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)
 of 2021-09-17 built on zira
Repository revision: 8220df9355e105459e91623dd63f7a08a08cfe09
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix=/home/vinc17/opt/emacs-master'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: C.UTF-8
  value of $LC_TIME: en_DK.utf8
  value of $LANG: POSIX
  locale-coding-system: utf-8-unix

Major mode: C++//l

Minor modes in effect:
  display-time-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr warnings emacsbug message rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json map text-property-search
time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
cc-mode cc-fonts cc-guess cc-menus cc-cmds time cus-load paren cc-styles
cc-align cc-engine cc-vars cc-defs edmacro kmacro cl-loaddefs cl-lib
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 80328 6010)
 (symbols 48 9599 1)
 (strings 32 26386 987)
 (string-bytes 1 979203)
 (vectors 16 13517)
 (vector-slots 8 174949 9740)
 (floats 8 28 46)
 (intervals 56 237 0)
 (buffers 992 12))




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Vincent Lefevre <vincent@HIDDEN>
Subject: bug#50640: Acknowledgement (28.0.50; incorrect highlighting in
 C++ mode)
Message-ID: <handler.50640.B.16318834879562.ack <at> debbugs.gnu.org>
References: <87czp79x6s.fsf@HIDDEN>
X-Gnu-PR-Message: ack 50640
X-Gnu-PR-Package: emacs
Reply-To: 50640 <at> debbugs.gnu.org
Date: Fri, 17 Sep 2021 12:59:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 50640 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
50640: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D50640
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#50640: 28.0.50; incorrect highlighting in C++ mode
Resent-From: Stefan Kangas <stefan@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 25 Sep 2021 18:18:02 +0000
Resent-Message-ID: <handler.50640.B50640.163259383632412 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 50640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: 50640 <at> debbugs.gnu.org, Vincent Lefevre <vincent@HIDDEN>
Received: via spool by 50640-submit <at> debbugs.gnu.org id=B50640.163259383632412
          (code B ref 50640); Sat, 25 Sep 2021 18:18:02 +0000
Received: (at 50640) by debbugs.gnu.org; 25 Sep 2021 18:17:16 +0000
Received: from localhost ([127.0.0.1]:34659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mUCEe-0008Qi-HA
	for submit <at> debbugs.gnu.org; Sat, 25 Sep 2021 14:17:16 -0400
Received: from mail-pf1-f171.google.com ([209.85.210.171]:37728)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1mUCEb-0008QD-KQ
 for 50640 <at> debbugs.gnu.org; Sat, 25 Sep 2021 14:17:14 -0400
Received: by mail-pf1-f171.google.com with SMTP id n23so8967734pfv.4
 for <50640 <at> debbugs.gnu.org>; Sat, 25 Sep 2021 11:17:13 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:in-reply-to:references:user-agent
 :mime-version:date:message-id:subject:to:cc;
 bh=07Dy293fvnf9fiN+PaqAuy+uR4alTzp63kUjJULGcT8=;
 b=4h10C0aGtd/OL1D571FH09ShArIvJ8E/JyNAOegDsNK7Vk1Hg2exH9WA4+fLs7IHJd
 rDBLKBKhNXY9Gmm9T3PeRVRkJK6NuTNqzpveX/Ce5fWJaLpMY5MFTnjTs0ZuekFNYios
 aE88hYGnbZurIuumpPzkyMesAMzyNCBHwFU4s/lFHT4A13SAtCr1tglaMqOsOwCsNtbo
 FmOOaTBnruWPdGItRjl/OuJQaussRTe/LycmCPko4rY3WvNKmkdEMY9GmNxcvlc/ACPK
 Hvt57ELKbaeRbul+YG+6MdtbUXKfwqb01fC0sDjfefgx2SGgwa/OhbjllOO5tnjXkFr6
 qOyQ==
X-Gm-Message-State: AOAM532cGN1Q6K3x0QuI5tq/++l9Pf/6QQwwo2Sojjf8wsZXi9/ruA9/
 qRBq1WdSWrvd4G8Vb0+WU3B+Y+/7Z7LxBlosUWbu4Ld2BLY=
X-Google-Smtp-Source: ABdhPJxIiBMwa05rzjGrvoK33aUvaZNc0qH6D72CRkLceSfVUK6BpbFe0Avutn477RJxFQDnKC1rl8diCrUcq7kOTHo=
X-Received: by 2002:a05:6a00:1586:b0:447:b30c:4a65 with SMTP id
 u6-20020a056a00158600b00447b30c4a65mr15393484pfk.0.1632593828001; Sat, 25 Sep
 2021 11:17:08 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sat, 25 Sep 2021 11:17:07 -0700
From: Stefan Kangas <stefan@HIDDEN>
In-Reply-To: <87czp79x6s.fsf@HIDDEN> (Vincent Lefevre's message of "Fri,
 17 Sep 2021 14:57:31 +0200")
References: <87czp79x6s.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Date: Sat, 25 Sep 2021 11:17:07 -0700
Message-ID: <CADwFkmmi5Dc=1TT+8jw4fJCC8OYM9kB8Dm5fscs+g8oTB1UbVQ@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.5 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

Vincent Lefevre <vincent@HIDDEN> writes:

> Consider a test.cc file containing:
>
>   if (xMin - xt < t3Font->glyphX ||
>       yMin - yt < t3Font->glyphY ||
>       xMax - xt > t3Font->glyphX + t3Font->glyphW ||
>       yMax - yt > t3Font->glyphY + t3Font->glyphH) {
>   }
>
> (this comes from the xpdf source) and open it with "emacs -Q".
>
> The first two "xt" and "yt" are highlighted in green instead of
> remaining in black. If I remove the last condition as follows
> and reopen the file:
>
>   if (xMin - xt < t3Font->glyphX ||
>       yMin - yt < t3Font->glyphY ||
>       xMax - xt > t3Font->glyphX + t3Font->glyphW) {
>   }
>
> then only the "yt" is highlighted incorrectly.

Alan, could you take a look at this bug report?

(I don't know if you're subscribed to the bug list, my apologies if you
have already seen it.)




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#50640: 28.0.50; incorrect highlighting in C++ mode
Resent-From: Alan Mackenzie <acm@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 25 Sep 2021 21:18:02 +0000
Resent-Message-ID: <handler.50640.B50640.16326046371208 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 50640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Kangas <stefan@HIDDEN>, Vincent Lefevre <vincent@HIDDEN>
Cc: 50640 <at> debbugs.gnu.org
Received: via spool by 50640-submit <at> debbugs.gnu.org id=B50640.16326046371208
          (code B ref 50640); Sat, 25 Sep 2021 21:18:02 +0000
Received: (at 50640) by debbugs.gnu.org; 25 Sep 2021 21:17:17 +0000
Received: from localhost ([127.0.0.1]:34931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mUF2r-0000J8-0x
	for submit <at> debbugs.gnu.org; Sat, 25 Sep 2021 17:17:17 -0400
Received: from colin.muc.de ([193.149.48.1]:23597 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1mUF2o-0000CM-AM
 for 50640 <at> debbugs.gnu.org; Sat, 25 Sep 2021 17:17:15 -0400
Received: (qmail 85445 invoked by uid 3782); 25 Sep 2021 21:17:07 -0000
Received: from acm.muc.de (p2e5d55d2.dip0.t-ipconnect.de [46.93.85.210])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Sat, 25 Sep 2021 23:17:07 +0200
Received: (qmail 7856 invoked by uid 1000); 25 Sep 2021 21:17:06 -0000
Date: Sat, 25 Sep 2021 21:17:06 +0000
Message-ID: <YU+R0ju3SDUm42/6@ACM>
References: <87czp79x6s.fsf@HIDDEN>
 <CADwFkmmi5Dc=1TT+8jw4fJCC8OYM9kB8Dm5fscs+g8oTB1UbVQ@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CADwFkmmi5Dc=1TT+8jw4fJCC8OYM9kB8Dm5fscs+g8oTB1UbVQ@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Vincent and Stefan.

On Sat, Sep 25, 2021 at 11:17:07 -0700, Stefan Kangas wrote:
> Vincent Lefevre <vincent@HIDDEN> writes:

> > Consider a test.cc file containing:

> >   if (xMin - xt < t3Font->glyphX ||
> >       yMin - yt < t3Font->glyphY ||
> >       xMax - xt > t3Font->glyphX + t3Font->glyphW ||
> >       yMax - yt > t3Font->glyphY + t3Font->glyphH) {
> >   }

> > (this comes from the xpdf source) and open it with "emacs -Q".

> > The first two "xt" and "yt" are highlighted in green instead of
> > remaining in black.

Yes.  C++ Mode is recognising the < .. < .. > .. > as two nested
templates.  The green is font-lock-type-face.  :-(

> > If I remove the last condition as follows and reopen the file:

> >   if (xMin - xt < t3Font->glyphX ||
> >       yMin - yt < t3Font->glyphY ||
> >       xMax - xt > t3Font->glyphX + t3Font->glyphW) {
> >   }

> > then only the "yt" is highlighted incorrectly.

Yes, then only yt opens a "template", there being no closing > to balance
the xt <.

There's really not much which can be done about this in CC Mode, sorry.
CC Mode's analysis of ambiguous C++ constructs is not very deep, so it
sometimes gets it wrong, as here.

I would be in favour of closing this bug as "won't fix" (actually, can't
fix).

There's an intention in the medium future to introduce rigorous analyses
of source code into Emacs with a language server protocol program called
"Tree Sitter".  That should solve problems like this one.

In the meantime, a workaround would be to change the order of the terms
in that expression so that the <s come after the >s rather than before
them, if you have control of the source code.

> Alan, could you take a look at this bug report?

> (I don't know if you're subscribed to the bug list, my apologies if you
> have already seen it.)

I'm not actually subscribed to the bug list.  I'd have trouble coping
with the volume of posts there.  I try to skim over the archive on the
web every week or so, to try not to miss anything.  So thanks, Stefan,
for the heads up!

-- 
Alan Mackenzie (Nuremberg, Germany).




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#50640: 28.0.50; incorrect highlighting in C++ mode
Resent-From: Vincent Lefevre <vincent@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 25 Sep 2021 21:52:02 +0000
Resent-Message-ID: <handler.50640.B50640.16326066826464 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 50640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alan Mackenzie <acm@HIDDEN>
Cc: 50640 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN>
Received: via spool by 50640-submit <at> debbugs.gnu.org id=B50640.16326066826464
          (code B ref 50640); Sat, 25 Sep 2021 21:52:02 +0000
Received: (at 50640) by debbugs.gnu.org; 25 Sep 2021 21:51:22 +0000
Received: from localhost ([127.0.0.1]:34986 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mUFZq-0001gB-DC
	for submit <at> debbugs.gnu.org; Sat, 25 Sep 2021 17:51:22 -0400
Received: from joooj.vinc17.net ([155.133.131.76]:55326)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vincent@HIDDEN>) id 1mUFZo-0001g0-CK
 for 50640 <at> debbugs.gnu.org; Sat, 25 Sep 2021 17:51:21 -0400
Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128])
 by joooj.vinc17.net (Postfix) with ESMTPSA id 81F6A191;
 Sat, 25 Sep 2021 23:51:18 +0200 (CEST)
Received: by zira.vinc17.org (Postfix, from userid 1000)
 id 83DCEC214DC; Sat, 25 Sep 2021 23:51:17 +0200 (CEST)
Date: Sat, 25 Sep 2021 23:51:17 +0200
From: Vincent Lefevre <vincent@HIDDEN>
Message-ID: <20210925215117.GU7497@HIDDEN>
References: <87czp79x6s.fsf@HIDDEN>
 <CADwFkmmi5Dc=1TT+8jw4fJCC8OYM9kB8Dm5fscs+g8oTB1UbVQ@HIDDEN>
 <YU+R0ju3SDUm42/6@ACM>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <YU+R0ju3SDUm42/6@ACM>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/2.1.3+60 (d7d7b4b3) vl-138565 (2021-09-13)
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2021-09-25 21:17:06 +0000, Alan Mackenzie wrote:
> Hello, Vincent and Stefan.
> 
> On Sat, Sep 25, 2021 at 11:17:07 -0700, Stefan Kangas wrote:
> > Vincent Lefevre <vincent@HIDDEN> writes:
> 
> > > Consider a test.cc file containing:
> 
> > >   if (xMin - xt < t3Font->glyphX ||
> > >       yMin - yt < t3Font->glyphY ||
> > >       xMax - xt > t3Font->glyphX + t3Font->glyphW ||
> > >       yMax - yt > t3Font->glyphY + t3Font->glyphH) {
> > >   }
> 
> > > (this comes from the xpdf source) and open it with "emacs -Q".
> 
> > > The first two "xt" and "yt" are highlighted in green instead of
> > > remaining in black.
> 
> Yes.  C++ Mode is recognising the < .. < .. > .. > as two nested
> templates.  The green is font-lock-type-face.  :-(
> 
> > > If I remove the last condition as follows and reopen the file:
> 
> > >   if (xMin - xt < t3Font->glyphX ||
> > >       yMin - yt < t3Font->glyphY ||
> > >       xMax - xt > t3Font->glyphX + t3Font->glyphW) {
> > >   }
> 
> > > then only the "yt" is highlighted incorrectly.
> 
> Yes, then only yt opens a "template", there being no closing > to balance
> the xt <.
> 
> There's really not much which can be done about this in CC Mode, sorry.
> CC Mode's analysis of ambiguous C++ constructs is not very deep, so it
> sometimes gets it wrong, as here.

Note that when < .. < .. > .. > comparisons occur, there is
probably || or && between them. Are C++ nested templates common
with || or && inside them? If not, || and && should be forbidden
in nested template matching.

Alternatively, whitespace characters could also give a hint:
AFAIK, for templates, this is usually no whitespace after '<'
and no whitespace before '>'.

-- 
Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 29 Sep 2021 15:20:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 29 11:20:45 2021
Received: from localhost ([127.0.0.1]:49855 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mVbO0-0007jF-Sg
	for submit <at> debbugs.gnu.org; Wed, 29 Sep 2021 11:20:44 -0400
Received: from mail-pl1-f178.google.com ([209.85.214.178]:45603)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1mVbNy-0007io-MI
 for control <at> debbugs.gnu.org; Wed, 29 Sep 2021 11:20:43 -0400
Received: by mail-pl1-f178.google.com with SMTP id n2so1746007plk.12
 for <control <at> debbugs.gnu.org>; Wed, 29 Sep 2021 08:20:42 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:mime-version:date:message-id:subject:to;
 bh=qE1DN5oXTMeI15lqNaZEJuLV+DM76vPnXLckCwPRCMY=;
 b=yqp01KobowlzGaL6PbXGnR/T5c1bzpaN+9mgBJ74QETIeqV3peRX8tiKQwSkrnWCGE
 oUCYbSEJWIL4tzx5PrMhRY7Yk66nbiD2K244c9d7pSgxkaVLdarVodbmC0YtW8h9CYFo
 tKrdUonIpwC1ueRjiCBWMyLv4yCZi78rwRbkY0pnn8jyGqEslG2rv41o/rew6E2U2r1x
 1KasKc/Y/hD6VYjWp+NFCXsyW1/P3clj/VMX1DkFt0qNlvzRwAShoJTUVHA1cZrVXazI
 ek508noaZUhdE1gvv04l6sPY0s1sMfazRqrp5mMDjl4sreC3ksUriTjONbksVeL2OaTI
 QKFQ==
X-Gm-Message-State: AOAM532VqEcOCTOMncpe3qbf4C0DpHxtQvk0y2qZi1j8mmoGz41qvRvs
 kn19KlCnlKozs6+Fp0ygkd8r4ANKbF5nim30Wjsz9eIU
X-Google-Smtp-Source: ABdhPJwB0C9XxWAqXNDLFMZFMY9q3ERoKs9BfFOWXA1OvvOdoq/vgTfcdjG5dA2RlGq0oA4ETfR062CF9HdSpaXCmCA=
X-Received: by 2002:a17:902:c1c5:b0:13e:2e1e:aaa4 with SMTP id
 c5-20020a170902c1c500b0013e2e1eaaa4mr249734plc.32.1632928837075; Wed, 29 Sep
 2021 08:20:37 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Wed, 29 Sep 2021 08:20:36 -0700
From: Stefan Kangas <stefan@HIDDEN>
MIME-Version: 1.0
Date: Wed, 29 Sep 2021 08:20:36 -0700
Message-ID: <CADwFkmkxXs+_de50zmpO3cZSX6FbXTaQui7s9nYNGxAUMKkgqQ@HIDDEN>
Subject: control message for bug #50640
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

severity 50640 minor
quit





Last modified: Wed, 29 Sep 2021 15:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.