GNU bug report logs -
#11982
24.1.50; (Contains ERT Test) show-paren-mode doesn't work in C comments if there's a quote between the parenthesis (affects c-mode and modes derived from it)
Previous Next
Reported by: Rolando Pereira <rolando_pereira <at> sapo.pt>
Date: Wed, 18 Jul 2012 20:23:01 UTC
Severity: minor
Tags: confirmed, fixed
Found in versions 25.3, 25.2, 24.1.50
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello, Vincent and Noam.
In article <mailman.72.1566487266.1922.bug-gnu-emacs <at> gnu.org> you wrote:
> On 2019-08-22 11:05:04 -0400, Noam Postavsky wrote:
>> I can reproduce up to 25.3, but it seems to be fixed in 26.1.
> No, not fixed in 26.1, where this depends on some context.
This "context" is a syntax-table text property on the apostrophe which
"neutralises" it's normal string syntax. Without this text property,
the apostrophe, a string opener, breaks the association of the two
parentheses.
The code which applies and removes these syntax-table text properties is
somewhat involved. I believe it is working correctly in the master
branch, but wasn't in Emacs-26.
> This is rather random, but here's a way to reproduce the
> bug in Debian:
> 1. emacs-gtk -Q foo.c
> (where foo.c does not exist)
> 2. Paste "// Comments are good (aren't they?)"
For some value of "paste". Inserting the text on a Linux tty with the GPM
mouse utility (in 26.1) causes the text property to be correctly set.
Killing the entire line with C-k, followed by yanking it with C-y leaves
the text property unset (again in 26.1).
> 3. Type C-M-p
> I get an error:
> forward-list: Scan error: "Unbalanced parentheses", 35, 1
> This problem does not occur without the apostrophe.
No. The apostrophe is a "string opener", see above. It's normal use is
to delimit character constants, as:
char foo = 'F';
> --
> Vincent Lefèvre <vincent <at> vinc17.net> - 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)
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 5 years and 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.