unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master c5cf630: Don't clobber match data in utf-8-hfs conversion (bug#41445)
       [not found] ` <20200527143043.D0DDC20A2C@vcs0.savannah.gnu.org>
@ 2020-05-28 13:40   ` Stefan Monnier
  2020-05-28 14:56     ` Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2020-05-28 13:40 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

>  ;; Pre-write conversion for `utf-8-hfs'.
>  ;; _from and _to are legacy arguments (see `define-coding-system').
>  (defun ucs-normalize-hfs-nfd-pre-write-conversion (_from _to)
> -  (ucs-normalize-HFS-NFD-region (point-min) (point-max)))
> +  (save-match-data
> +    (ucs-normalize-HFS-NFD-region (point-min) (point-max))))

IIUC this is needed because `(en|de)code-coding-string`  is not supposed
to touch the match-data, right?

If so, I think we should do two things:

1- document that `(en|de)code-coding-string` preserve the match-data.
2- document in `define-coding-system` that the pre/post-conversion
   functions should preserve the match-data.

WDYT?


        Stefan




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

* Re: master c5cf630: Don't clobber match data in utf-8-hfs conversion (bug#41445)
  2020-05-28 13:40   ` master c5cf630: Don't clobber match data in utf-8-hfs conversion (bug#41445) Stefan Monnier
@ 2020-05-28 14:56     ` Mattias Engdegård
  2020-05-28 16:27       ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Engdegård @ 2020-05-28 14:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

28 maj 2020 kl. 15.40 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

> 1- document that `(en|de)code-coding-string` preserve the match-data.
> 2- document in `define-coding-system` that the pre/post-conversion
>   functions should preserve the match-data.

Very reasonable; now done on master.
We could perhaps say the same thing about {en,de}code-coding-region but I didn't do that in this change.




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

* Re: master c5cf630: Don't clobber match data in utf-8-hfs conversion (bug#41445)
  2020-05-28 14:56     ` Mattias Engdegård
@ 2020-05-28 16:27       ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2020-05-28 16:27 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: Emacs developers

>> 1- document that `(en|de)code-coding-string` preserve the match-data.
>> 2- document in `define-coding-system` that the pre/post-conversion
>>   functions should preserve the match-data.
>
> Very reasonable; now done on master.
> We could perhaps say the same thing about {en,de}code-coding-region but
> I didn't do that in this change.

`(en|de)code-coding-region` run various other (buffer-modification)
hooks, so I don't think anyone currently relies on them preserving the
match-data (and it would be a wrong assumption), also because those
function can change buffer positions making the match-data invalid even
if it's not modified.  So I don't see any need to declare that those
functions preserve the match-data.


        Stefan




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

end of thread, other threads:[~2020-05-28 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200527143042.599.17398@vcs0.savannah.gnu.org>
     [not found] ` <20200527143043.D0DDC20A2C@vcs0.savannah.gnu.org>
2020-05-28 13:40   ` master c5cf630: Don't clobber match data in utf-8-hfs conversion (bug#41445) Stefan Monnier
2020-05-28 14:56     ` Mattias Engdegård
2020-05-28 16:27       ` Stefan Monnier

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