GNU bug report logs -
#72311
[PATCH] Treat period as a symbol constituent in cc-mode
Previous Next
Reported by: Vladislav Yegorov <vlad <at> yegorov.org>
Date: Fri, 26 Jul 2024 20:00:03 UTC
Severity: wishlist
Tags: patch
Merged with 72310
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 72311 <at> debbugs.gnu.org (full text, mbox):
Hello, Vladislav and Eli.
On Sat, Jul 27, 2024 at 11:22:11 +0200, Vladislav Yegorov wrote:
> > What about stuff like 'foo.bar', where 'foo' is a struct and 'bar'
> > is its member? won't this change make them a single symbol?
That was my first reaction, too.
> You are right, kind of forgot about that. I think in that case a
> simple syntax table modification like my patch provides won't do the
> trick.
> My motivation for this patch was to able to use C-M-f (forward-sexp)
> to skip over decimal numbers. What are your thoughts on defining a
> forward-sexp-function that will use a alternate syntax table in
> certain contexts? maybe a bit too hacky?
It would be possible to put a syntax-table text property on a '.' when
it is followed directly by a decimal digit, with no space between.
Maybe we could also check that there's a valid number character before
the . (space, BOL, 0-9, -, ...?), but that might be over engineering.
My next thought is, for consistency, how would we handle something like
1.381E-23? For consistency, C-M-f ought to move forward over that
number in its entirety. That would need some more rigorous analysis of
every piece of text, probably by a regexp, and putting syntax-table
properties on both the '.' and the '-'. This would slow CC Mode down,
even if not by a lot.
So, it could be done, yes. Is it worth doing, though? I've got very
little experience of hacking files with lots of floating point constants
in them, so it's difficult for me to judge just how annoying it is for
C-M-f and C-M-b only to move over part of a number.
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 146 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.