all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Saving match data
Date: Wed, 28 Sep 2016 19:00:44 +0200	[thread overview]
Message-ID: <87mvist0w3.fsf@mbork.pl> (raw)
In-Reply-To: <CAArVCkQmYyxK2j+Ey4T_JgFNZpKkSDESoFPgudO70B9MZahtkw@mail.gmail.com>


On 2016-09-28, at 16:01, Philipp Stephani <p.stephani2@gmail.com> wrote:

> Hi,
>
> the Elisp manual (section "The Match Data") says:
>
> "Notice that all functions are allowed to overwrite the match data
> unless they’re explicitly documented not to do so."
>
> I think this statement is surprising and puts unnecessary burden on Elisp

Yes, it is surprising.  Here's a story from three years ago about how
this hit me:
http://mbork.pl/2013-09-18_Selective_replacement_in_LaTeX_documents_(en)

OTOH, I agree with Stefan and Eli that changing that would be a huge
work (and it would make Emacs slower).

OYAH, I think that it is safe to assume that only functions related to
searching actually mess with match data, and one could easily grep the
Emacs sources to make a list of functions which actually change match
data.  Then, we could extend these functions' docstrings (and mentions
in the manual) with a suitable mention.  IOW, I would consider doing
this

> and then clean up existing documentation [...]

but not this:

> [...] add `save-match-data' where appropriate.

Also, one might consider (as hinted in my post) adding `save-match-data'
to _interactive_ functions messing with match data.  This way, the user
would not be surprised as I was back then.  This _might_ be a reasonable
compromise, no?

WDYT?

> Philipp

Best,

-- 
Marcin Borkowski



  parent reply	other threads:[~2016-09-28 17:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 14:01 Saving match data Philipp Stephani
2016-09-28 15:03 ` Eli Zaretskii
2016-09-28 16:11 ` Stefan Monnier
2016-09-28 16:49   ` Michael Heerdegen
2016-09-28 18:25     ` Stefan Monnier
2016-09-28 18:37       ` Michael Heerdegen
2016-09-28 20:00     ` Eli Zaretskii
2016-09-28 20:15       ` Michael Heerdegen
2016-09-28 20:22         ` Eli Zaretskii
2016-09-28 20:42           ` Michael Heerdegen
2016-09-28 20:58             ` Lars Ingebrigtsen
2016-09-29  2:36             ` Eli Zaretskii
2016-10-08  4:02               ` Michael Heerdegen
2016-10-08  6:25                 ` Eli Zaretskii
2016-10-08 15:06                 ` Stefan Monnier
2017-06-16 19:24   ` Philipp Stephani
2017-06-16 19:53     ` Stefan Monnier
2017-06-16 22:16       ` Philipp Stephani
2017-06-17 13:53         ` Stefan Monnier
2017-06-17 14:02           ` Philipp Stephani
2017-10-08 15:56             ` Philipp Stephani
2017-10-08 16:01       ` Philipp Stephani
2016-09-28 17:00 ` Marcin Borkowski [this message]
2016-09-29  9:29   ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvist0w3.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=emacs-devel@gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.