Discussion:
Potential Bug in Digit Separation in C++
Lud
2017-06-13 19:05:44 UTC
Permalink
Hello Dimitri,

I remember I raised this issue some time ago. A patch was available in
the CC Mode branch c++11-0-1.

For more details, here is the link of the discussion:

https://sourceforge.net/p/cc-mode/mailman/cc-mode-help/thread/427ff2260eff60edcc941abdbcb5e3d6%40lud.cc/

Today, I don't know if this patch is merged in the default branch.

Lud
Hello,
I have encountered issues while writing in C++ while using the quotation
mark (') as a digit separator in long numbers (e.g. 100'000'000). It
appears that rather than being interpreted as a number, regions of the
file are instead interpreted as char-type regions. These subsequently
cause a potentially large-scale behavioral change in buffers. An image
example of the current behavior follows.
17-Jun-12_193453.png
I've asked for assistance elsewhere (freenode #emacs), and those who
addressed this could recreate the behavior but had no solution. Is there
something that can be done about this?
Thank you,
Dimitri
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Alan Mackenzie
2017-06-13 19:36:50 UTC
Permalink
Hello, Lud and Dimitri.
Post by Lud
Hello Dimitri,
I remember I raised this issue some time ago. A patch was available in
the CC Mode branch c++11-0-1.
https://sourceforge.net/p/cc-mode/mailman/cc-mode-help/thread/427ff2260eff60edcc941abdbcb5e3d6%40lud.cc/
Today, I don't know if this patch is merged in the default branch.
This patch has been merged and is available in the CC Mode version 33
release available from http://cc-mode.sourceforge.net/. It is NOT yet
available in the latest release of GNU Emacs, i.e. Emacs 25.2.

Normally, I would advise you either to (i) Download CC Mode 33 from
SourceForge; (ii) Pull the repository head from SourceForge; or (iii)
(for the truly adventurous) Pull the repository master for Emacs.

However, there's a complication: the fix for digit separators is buggy:
it correctly parses separators which are already in the buffer, but not
those you type in, one by one.

So I ask you to be a little patient, while I fix this bug. I'll be in
touch!
Post by Lud
Lud
Hello,
I have encountered issues while writing in C++ while using the quotation
mark (') as a digit separator in long numbers (e.g. 100'000'000). It
appears that rather than being interpreted as a number, regions of the
file are instead interpreted as char-type regions. These subsequently
cause a potentially large-scale behavioral change in buffers. An image
example of the current behavior follows.
17-Jun-12_193453.png
I've asked for assistance elsewhere (freenode #emacs), and those who
addressed this could recreate the behavior but had no solution. Is there
something that can be done about this?
Thank you,
Dimitri
--
Alan Mackenzie (Nuremberg, Germany).
Alan Mackenzie
2017-07-01 15:59:12 UTC
Permalink
Hello, Dimitri and Lud.
Post by Alan Mackenzie
Post by Lud
Hello Dimitri,
I remember I raised this issue some time ago. A patch was available in
the CC Mode branch c++11-0-1.
https://sourceforge.net/p/cc-mode/mailman/cc-mode-help/thread/427ff2260eff60edcc941abdbcb5e3d6%40lud.cc/
Today, I don't know if this patch is merged in the default branch.
This patch has been merged and is available in the CC Mode version 33
release available from http://cc-mode.sourceforge.net/. It is NOT yet
available in the latest release of GNU Emacs, i.e. Emacs 25.2.
Normally, I would advise you either to (i) Download CC Mode 33 from
SourceForge; (ii) Pull the repository head from SourceForge; or (iii)
(for the truly adventurous) Pull the repository master for Emacs.
it correctly parses separators which are already in the buffer, but not
those you type in, one by one.
So I ask you to be a little patient, while I fix this bug. I'll be in
touch!
I have now rewritten the code which deals with digit separators, in the
process improving the handling of quote marks generally.

To get this new code, do one of the following:
(i) Download the head of the CC Mode repository, and install it.
Instructions for doing this are at
<http://cc-mode.sourceforge.net/hgaccess.php>.
(ii) Download the head of the Emacs repository from savannah. (If you
want to do this, you'll already know how to go about it.)
Post by Alan Mackenzie
Post by Lud
Lud
Hello,
I have encountered issues while writing in C++ while using the quotation
mark (') as a digit separator in long numbers (e.g. 100'000'000). It
appears that rather than being interpreted as a number, regions of the
file are instead interpreted as char-type regions. These subsequently
cause a potentially large-scale behavioral change in buffers. An image
example of the current behavior follows.
17-Jun-12_193453.png
I've asked for assistance elsewhere (freenode #emacs), and those who
addressed this could recreate the behavior but had no solution. Is there
something that can be done about this?
Thank you,
Dimitri
--
Alan Mackenzie (Nuremberg, Germany).
Alan Mackenzie
2017-07-02 13:10:27 UTC
Permalink
Hello, Dimitri and Lud.
Post by Alan Mackenzie
Post by Alan Mackenzie
So I ask you to be a little patient, while I fix this bug. I'll be in
touch!
I have now rewritten the code which deals with digit separators, in the
process improving the handling of quote marks generally.
(i) Download the head of the CC Mode repository, and install it.
Instructions for doing this are at
<http://cc-mode.sourceforge.net/hgaccess.php>.
(ii) Download the head of the Emacs repository from savannah. (If you
want to do this, you'll already know how to go about it.)
There was a bug in the code committed yesterday, which has now been
fixed. If you've already downloaded CC Mode to get this feature, would
you please update your download with the latest repository head which
now contains the fix.
Post by Alan Mackenzie
Post by Alan Mackenzie
Thank you,
Dimitri
--
Alan Mackenzie (Nuremberg, Germany).
Lud
2017-07-04 20:16:40 UTC
Permalink
Hello Alan
Post by Alan Mackenzie
There was a bug in the code committed yesterday, which has now been
fixed. If you've already downloaded CC Mode to get this feature, would
you please update your download with the latest repository head which
now contains the fix.
I compared GNU Emacs 25.2 and 26 (master branch as of today) and it
looks good. See pictures attached of some examples I tried.

Thank you for your time.

Lud

PS: It's note related to this thread, the mode line is different from
"C++/l" to "C++//l".
Alan Mackenzie
2017-07-05 14:11:03 UTC
Permalink
Hello, Lud.
Post by Lud
Hello Alan
Post by Alan Mackenzie
There was a bug in the code committed yesterday, which has now been
fixed. If you've already downloaded CC Mode to get this feature, would
you please update your download with the latest repository head which
now contains the fix.
I compared GNU Emacs 25.2 and 26 (master branch as of today) and it
looks good. See pictures attached of some examples I tried.
Thanks for the testing.
Post by Lud
Thank you for your time.
Lud
PS: It's note related to this thread, the mode line is different from
"C++/l" to "C++//l".
Yes. That's another new feature. With C-c C-k, you can toggle the
default comment format between line comment and block comment. The
second "/" in the mode line indicates what sort of comment is current.
(No prizes for guessing what it looks like after typing C-c C-k. :-)

It's even described in the CC Mode manual.
--
Alan Mackenzie (Nuremberg, Germany).
Loading...