[Top][All Lists]

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

Re: Saving match data

From: Stefan Monnier
Subject: Re: Saving match data
Date: Sat, 08 Oct 2016 11:06:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

> #+begin_src emacs-lisp
> (with-match-data data
>      (search-forward "test")
>    (do-this)
>    (maybe-change-match-data-here)
>    (do-that)
>    (use-match-data data
>       (use-the-match-data)))
> #+end_src

It would still be based on state, with the same risks and issues.
The idea of using

    (let ((data (new-search-forward "test")))
      (use-match-result data)

is that the user is forced to pass `data` hence to explicitly say with
which search result to do the work.


reply via email to

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