On 5 June 2018 at 13:30, Ryan Thompson <rct@thompsonclan.org> wrote:
>
> The following code throws an error:
>
> (progn
> (string-match "h.*o" "hello")
> (format-spec "This sets the %s" (format-spec-make ?s "match data"))
> (match-string 0 "hello"))
>
> This is because the implementation of "format-spec" uses regular
> expressions internally, and does not save the match data and restore it
> afterward.
(elisp) Match Data:
Notice that all functions are allowed to overwrite the match data
unless they’re explicitly documented not to do so.
Wow, I was not aware of that. This seems... really fragile. In any case, I suppose the behavior is as documented, so you can close this bug.