emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master fb4f2aa038: * lisp/textmodes/paragraphs.el (repunctuate-sente


From: Stefan Monnier
Subject: Re: master fb4f2aa038: * lisp/textmodes/paragraphs.el (repunctuate-sentences-filter): New function.
Date: Tue, 04 Jan 2022 15:44:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
> index fc10a0dd1b..e3b5ecbcca 100644
> --- a/lisp/textmodes/paragraphs.el
> +++ b/lisp/textmodes/paragraphs.el
> @@ -487,6 +487,8 @@ repunctuate-sentences-filter
>  with a set of predefined abbreviations to skip from adding two spaces."
>    (not (length= (match-string 4) 2)))
>  
> +(defvar repunctuate-sentences-filter #'repunctuate-sentences-filter)

Note that the default function (whose body is visible above) depends on
the match data set by the caller, so `add-function` risks messing it up
if it clobbers the match data with code that runs before this default.

At the very least, we need a docstring that makes it very clear what
match-data is expected to be set when the function is called and that
explains how/when it should be preserved.

Tho maybe a better approach is to change the calling convention so we
don't need to depend this way on the match data set by the caller.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]