GNU bug report logs - #55798
font-lock-fontify-syntactically-region uses point without initializing it.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 4 Jun 2022 19:18:02 UTC

Severity: normal

Tags: notabug

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55798 in the body.
You can then email your comments to 55798 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Sat, 04 Jun 2022 19:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 04 Jun 2022 19:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: font-lock-fontify-syntactically-region uses point without
 initializing it.
Date: Sat, 4 Jun 2022 19:17:42 +0000
Hello, Emacs.

Emacs master branch:

* emacs/lisp/font-lock.el (font-lock-fontify-syntactically-region): At
line 26 of this function, appears:

    (setq state (parse-partial-sexp (point) end nil nil state
                                    'syntax-table))

..  However, there is no goto-char or other way of setting point earlier
in the function (except in one arm of an `if' form).  Neither is point
defined to have a defined setting at the entry to the function.

This is a bug.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Sun, 05 Jun 2022 14:24:02 GMT) Full text and rfc822 format available.

Message #8 received at 55798 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 55798 <at> debbugs.gnu.org
Subject: Re: bug#55798: font-lock-fontify-syntactically-region uses point
 without initializing it.
Date: Sun, 05 Jun 2022 16:23:35 +0200
Alan Mackenzie <acm <at> muc.de> writes:

> * emacs/lisp/font-lock.el (font-lock-fontify-syntactically-region): At
> line 26 of this function, appears:
>
>     (setq state (parse-partial-sexp (point) end nil nil state
>                                     'syntax-table))
>
> ..  However, there is no goto-char or other way of setting point earlier
> in the function (except in one arm of an `if' form).  Neither is point
> defined to have a defined setting at the entry to the function.

(syntax-ppss start) (called earlier) will skip to start, won't it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Sun, 05 Jun 2022 18:47:02 GMT) Full text and rfc822 format available.

Message #11 received at 55798 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55798 <at> debbugs.gnu.org
Subject: Re: bug#55798: font-lock-fontify-syntactically-region uses point
 without initializing it.
Date: Sun, 5 Jun 2022 18:46:04 +0000
Hello, Lars.

On Sun, Jun 05, 2022 at 16:23:35 +0200, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm <at> muc.de> writes:

> > * emacs/lisp/font-lock.el (font-lock-fontify-syntactically-region): At
> > line 26 of this function, appears:

> >     (setq state (parse-partial-sexp (point) end nil nil state
> >                                     'syntax-table))

> > ..  However, there is no goto-char or other way of setting point earlier
> > in the function (except in one arm of an `if' form).  Neither is point
> > defined to have a defined setting at the entry to the function.

> (syntax-ppss start) (called earlier) will skip to start, won't it?

Er, yes, it will.  Somehow I didn't know that syntax-ppss did that.
Sorry for the false bug report.  I'll close it as notabug (assuming you
haven't done this already.)

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

-- 
Alan Mackenzie (Nuremberg, Germany).




Added tag(s) notabug. Request was from Alan Mackenzie <acm <at> muc.de> to control <at> debbugs.gnu.org. (Sun, 05 Jun 2022 18:52:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 55798 <at> debbugs.gnu.org and Alan Mackenzie <acm <at> muc.de> Request was from Alan Mackenzie <acm <at> muc.de> to control <at> debbugs.gnu.org. (Sun, 05 Jun 2022 18:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Sun, 05 Jun 2022 19:08:02 GMT) Full text and rfc822 format available.

Message #18 received at 55798 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 55798 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#55798: font-lock-fontify-syntactically-region uses point
 without initializing it.
Date: Sun, 05 Jun 2022 21:07:30 +0200
Alan Mackenzie <acm <at> muc.de> writes:

> Er, yes, it will.  Somehow I didn't know that syntax-ppss did that.

The doc string doesn't mention point movements at all, and perhaps it
should?  Hm...  reading the code now, and I'm not quite sure whether
it's guaranteed to do so or not, really, so perhaps there is a bug here
in some cases.  I've added Stefan to the CCs; perhaps he has a comment
here.

> Sorry for the false bug report.  I'll close it as notabug (assuming you
> haven't done this already.)

No, haven't done so.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Sun, 05 Jun 2022 20:32:01 GMT) Full text and rfc822 format available.

Message #21 received at 55798 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Alan Mackenzie <acm <at> muc.de>, 55798 <at> debbugs.gnu.org
Subject: Re: bug#55798: font-lock-fontify-syntactically-region uses point
 without initializing it.
Date: Sun, 05 Jun 2022 16:31:06 -0400
Lars Ingebrigtsen [2022-06-05 21:07:30] wrote:
> Alan Mackenzie <acm <at> muc.de> writes:
>> Er, yes, it will.  Somehow I didn't know that syntax-ppss did that.
> The doc string doesn't mention point movements at all, and perhaps it
> should?

Doesn't it say:

    Point is at POS when this function returns.

?


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Sun, 05 Jun 2022 20:36:01 GMT) Full text and rfc822 format available.

Message #24 received at 55798 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Alan Mackenzie <acm <at> muc.de>, 55798 <at> debbugs.gnu.org
Subject: Re: bug#55798: font-lock-fontify-syntactically-region uses point
 without initializing it.
Date: Sun, 05 Jun 2022 22:34:54 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Doesn't it say:
>
>     Point is at POS when this function returns.
>
> ?

Oh, I interpreted that as meaning...  er...  not a lot.  I think I'll
tweak the doc string.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55798; Package emacs. (Mon, 06 Jun 2022 22:16:01 GMT) Full text and rfc822 format available.

Message #27 received at 55798 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: acm <at> muc.de, larsi <at> gnus.org, 55798 <at> debbugs.gnu.org
Subject: Re: bug#55798: font-lock-fontify-syntactically-region uses point
 without initializing it.
Date: Mon, 06 Jun 2022 18:14:48 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

      > Point is at POS when this function returns.

That way of saying it could be confusing because it doesn't describe
an action.  It sounds like a coincidence.  Would this be clearer?

     This function finishes by moving point to POS.
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Jul 2022 11:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 44 days ago.

Previous Next


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