unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
@ 2022-06-04 19:17 Alan Mackenzie
  2022-06-05 14:23 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2022-06-04 19:17 UTC (permalink / raw)
  To: 55798

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).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
  2022-06-04 19:17 bug#55798: font-lock-fontify-syntactically-region uses point without initializing it Alan Mackenzie
@ 2022-06-05 14:23 ` Lars Ingebrigtsen
  2022-06-05 18:46   ` Alan Mackenzie
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-05 14:23 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 55798

Alan Mackenzie <acm@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
  2022-06-05 14:23 ` Lars Ingebrigtsen
@ 2022-06-05 18:46   ` Alan Mackenzie
  2022-06-05 19:07     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2022-06-05 18:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 55798

Hello, Lars.

On Sun, Jun 05, 2022 at 16:23:35 +0200, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@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).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
  2022-06-05 18:46   ` Alan Mackenzie
@ 2022-06-05 19:07     ` Lars Ingebrigtsen
  2022-06-05 20:31       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-05 19:07 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 55798, Stefan Monnier

Alan Mackenzie <acm@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
  2022-06-05 19:07     ` Lars Ingebrigtsen
@ 2022-06-05 20:31       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-05 20:34         ` Lars Ingebrigtsen
  2022-06-06 22:14         ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-05 20:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Alan Mackenzie, 55798

Lars Ingebrigtsen [2022-06-05 21:07:30] wrote:
> Alan Mackenzie <acm@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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
  2022-06-05 20:31       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-05 20:34         ` Lars Ingebrigtsen
  2022-06-06 22:14         ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-05 20:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Alan Mackenzie, 55798

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#55798: font-lock-fontify-syntactically-region uses point without initializing it.
  2022-06-05 20:31       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-05 20:34         ` Lars Ingebrigtsen
@ 2022-06-06 22:14         ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2022-06-06 22:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: acm, larsi, 55798

[[[ 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)







^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-06 22:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-04 19:17 bug#55798: font-lock-fontify-syntactically-region uses point without initializing it Alan Mackenzie
2022-06-05 14:23 ` Lars Ingebrigtsen
2022-06-05 18:46   ` Alan Mackenzie
2022-06-05 19:07     ` Lars Ingebrigtsen
2022-06-05 20:31       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-05 20:34         ` Lars Ingebrigtsen
2022-06-06 22:14         ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).