GNU bug report logs -
#24767
jgraph comments not recognized any more
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24767 in the body.
You can then email your comments to 24767 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Sat, 22 Oct 2016 21:25:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 22 Oct 2016 21:25:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Package: Emacs
Try the following:
% emacs -Q -l .../elpa/packages/jgraph-mode/jgraph-mode.el ~/foo.jgr
(* hello *)
The string "(* hello *)" should be highlighted as a comment, and is
indeed correctly highlighted this way in Emacs-25 (and Emacs-24), but
not in "master".
The particularity of jgraph-mode's handling of (*...*) is that ?(, ?),
and ?* are given "symbol" syntax, so I guess that src/syntax.c was
modified in a way which makes it skip the whole (* as being a symbol.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Sun, 23 Oct 2016 06:18:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 24767 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Sat, 22 Oct 2016 17:24:01 -0400
>
> % emacs -Q -l .../elpa/packages/jgraph-mode/jgraph-mode.el ~/foo.jgr
> (* hello *)
>
> The string "(* hello *)" should be highlighted as a comment, and is
> indeed correctly highlighted this way in Emacs-25 (and Emacs-24), but
> not in "master".
>
> The particularity of jgraph-mode's handling of (*...*) is that ?(, ?),
> and ?* are given "symbol" syntax, so I guess that src/syntax.c was
> modified in a way which makes it skip the whole (* as being a symbol.
I suspect 9dcf599. Alan, could you please take a look?
Stefan, I think it would be good to have a test for this in the test
suite, even if for now it will fail.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Sun, 23 Oct 2016 15:35:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 24767 <at> debbugs.gnu.org (full text, mbox):
Hello, Eli.
On Sun, Oct 23, 2016 at 09:17:19AM +0300, Eli Zaretskii wrote:
> > From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> > Date: Sat, 22 Oct 2016 17:24:01 -0400
> >
> > % emacs -Q -l .../elpa/packages/jgraph-mode/jgraph-mode.el ~/foo.jgr
> > (* hello *)
> >
> > The string "(* hello *)" should be highlighted as a comment, and is
> > indeed correctly highlighted this way in Emacs-25 (and Emacs-24), but
> > not in "master".
> >
> > The particularity of jgraph-mode's handling of (*...*) is that ?(, ?),
> > and ?* are given "symbol" syntax, so I guess that src/syntax.c was
> > modified in a way which makes it skip the whole (* as being a symbol.
> I suspect 9dcf599. Alan, could you please take a look?
Yes, 9dcf599 is indeed where the bug was introduced. I'll be looking at
it.
> Stefan, I think it would be good to have a test for this in the test
> suite, even if for now it will fail.
> Thanks.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Mon, 24 Oct 2016 19:36:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 24767 <at> debbugs.gnu.org (full text, mbox):
Hello, Stefan.
On Sat, Oct 22, 2016 at 05:24:01PM -0400, Stefan Monnier wrote:
> Package: Emacs
> Try the following:
> % emacs -Q -l .../elpa/packages/jgraph-mode/jgraph-mode.el ~/foo.jgr
> (* hello *)
> The string "(* hello *)" should be highlighted as a comment, and is
> indeed correctly highlighted this way in Emacs-25 (and Emacs-24), but
> not in "master".
> The particularity of jgraph-mode's handling of (*...*) is that ?(, ?),
> and ?* are given "symbol" syntax, so I guess that src/syntax.c was
> modified in a way which makes it skip the whole (* as being a symbol.
Suppose the jgraph buffer contains:
he(*llo*)
. Is this supposed to analyse as the symbol "he" followed by a comment,
or should it be the symbol "he(*llo*)"? Currently, even Emacs-25
doesn't recognise the "(*llo*)" as a comment. It seems to me more
likely that the comment should be recognised, but I don't know jgraph.
To blame for this is the section of code in scan_sexps_forward (in
Emacs-25) just after the label symstarted: where there is a subsidiary
loop on "(from < end)" which doesn't do any checking on the comment
flags.
Maybe the solution (in master) would be to add the checking of the
comment flags into this subsidiary loop.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Tue, 25 Oct 2016 13:53:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 24767 <at> debbugs.gnu.org (full text, mbox):
> Suppose the jgraph buffer contains:
>
> he(*llo*)
>
> . Is this supposed to analyse as the symbol "he" followed by a comment,
> or should it be the symbol "he(*llo*)"?
Good question. To the extent that src/syntax.c shouldn't be specific to
jgraph-mode, the answer shouldn't depend on the choice made by
Jgraph's author.
> Currently, even Emacs-25 doesn't recognise the "(*llo*)" as a comment.
I think it's good enough to preserve backward compatibility, then.
> It seems to me more likely that the comment should be recognised, but
> I don't know jgraph.
To choose which of the two behavior is desired, the major mode author
can use syntax-propertize to catch this rare corner case anyway.
> Maybe the solution (in master) would be to add the checking of the
> comment flags into this subsidiary loop.
Let's not worry about it.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Sat, 29 Oct 2016 11:03:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 24767 <at> debbugs.gnu.org (full text, mbox):
Hello, Stefan.
On Tue, Oct 25, 2016 at 09:52:28AM -0400, Stefan Monnier wrote:
> > Suppose the jgraph buffer contains:
> >
> > he(*llo*)
> >
> > . Is this supposed to analyse as the symbol "he" followed by a comment,
> > or should it be the symbol "he(*llo*)"?
> Good question. To the extent that src/syntax.c shouldn't be specific to
> jgraph-mode, the answer shouldn't depend on the choice made by
> Jgraph's author.
> > Currently, even Emacs-25 doesn't recognise the "(*llo*)" as a comment.
> I think it's good enough to preserve backward compatibility, then.
> > It seems to me more likely that the comment should be recognised, but
> > I don't know jgraph.
> To choose which of the two behavior is desired, the major mode author
> can use syntax-propertize to catch this rare corner case anyway.
> > Maybe the solution (in master) would be to add the checking of the
> > comment flags into this subsidiary loop.
> Let's not worry about it.
In the end, that's what I've done. The fix was less tricky than I
thought it would be. It recognises the comment in he(*llo*).
Would you try out the following patch, please, and let me know whether
there are still problems with it. Thanks.
diff --git a/src/syntax.c b/src/syntax.c
index 667de40..d463f7e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3124,6 +3124,7 @@ scan_sexps_forward (struct lisp_parse_state *state,
ptrdiff_t prev_from; /* Keep one character before FROM. */
ptrdiff_t prev_from_byte;
int prev_from_syntax, prev_prev_from_syntax;
+ int syntax;
bool boundary_stop = commentstop == -1;
bool nofence;
bool found;
@@ -3191,8 +3192,6 @@ do { prev_from = from; \
while (from < end)
{
- int syntax;
-
if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
&& (c1 = FETCH_CHAR (from_byte),
syntax = SYNTAX_WITH_FLAGS (c1),
@@ -3258,7 +3257,24 @@ do { prev_from = from; \
while (from < end)
{
int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte);
- switch (SYNTAX (symchar))
+
+ if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
+ && (syntax = SYNTAX_WITH_FLAGS (symchar),
+ SYNTAX_FLAGS_COMSTART_SECOND (syntax)))
+ {
+ state->comstyle
+ = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax);
+ comnested = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax)
+ | SYNTAX_FLAGS_COMMENT_NESTED (syntax));
+ state->incomment = comnested ? 1 : -1;
+ state->comstr_start = prev_from;
+ INC_FROM;
+ prev_from_syntax = Smax;
+ code = Scomment;
+ goto atcomment;
+ }
+
+ switch (SYNTAX (symchar))
{
case Scharquote:
case Sescape:
@@ -3280,6 +3296,7 @@ do { prev_from = from; \
case Scomment_fence: /* Can't happen because it's handled above. */
case Scomment:
+ atcomment:
if (commentstop || boundary_stop) goto done;
startincomment:
/* The (from == BEGV) test was to enter the loop in the middle so
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24767
; Package
emacs
.
(Sun, 30 Oct 2016 16:05:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 24767 <at> debbugs.gnu.org (full text, mbox):
> Would you try out the following patch, please, and let me know whether
> there are still problems with it. Thanks.
I confirm it fixes my problems, thank you,
Stefan
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Sun, 30 Oct 2016 17:38:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
bug acknowledged by developer.
(Sun, 30 Oct 2016 17:38:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 24767-done <at> debbugs.gnu.org (full text, mbox):
Hello, Stefan.
On Sat, Oct 29, 2016 at 11:12:51AM -0400, Stefan Monnier wrote:
> > Would you try out the following patch, please, and let me know whether
> > there are still problems with it. Thanks.
> I confirm it fixes my problems, thank you,
I've committed it, and am closing the bug.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 28 Nov 2016 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.