From: Bastien <bzg@altern.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 13260@debbugs.gnu.org
Subject: bug#13260: 24.3.50; save match data for core functions like `delete-char' and `delete-backward-char'?
Date: Mon, 24 Dec 2012 02:24:07 +0100 [thread overview]
Message-ID: <878v8outs8.fsf@bzg.ath.cx> (raw)
In-Reply-To: <jwvfw2wgtpe.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 23 Dec 2012 19:54:00 -0500")
Hi Stefan,
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> AFAIK delete-char does not modify the match-data any more than other
> buffer-modifying operations (such as delete-region, insert, ...).
> They all just modify the buffer, which is turn can modify the match-data
> because it runs various hooks which can do all kinds of things.
Okay.
>> Principle of least surprise?
>
> The rule "expect the match-data to be destroyed all the time" is the one
> that leads to the least surprise. 99% of the functions can destroy the
> match-data, even though they may preserve it in 99% of
> the circumstances.
That's fine -- but what about "should"?
For all the functions like (defun x () "..." (save-match-data ...))
the match data is saved. For 99% of these functions, it's a design
choice saying "these functions *should* save the match data". (Yes,
there are such functions!)
> And in 99% of the cases where they do destroy the match-data, nobody
> cares anyway, which is why we shouldn't always save-match-data.
I'm fine with a rule like "anything that modifies the buffer should
be assumed to destroy the match data" -- given your explanation above.
But I'm not convinced this should apply to all other functions.
--
Bastien
next prev parent reply other threads:[~2012-12-24 1:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-23 15:18 bug#13260: 24.3.50; save match data for core functions like `delete-char' and `delete-backward-char'? Bastien Guerry
2012-12-23 15:47 ` Stefan Monnier
2012-12-23 16:40 ` Bastien
2012-12-24 0:54 ` Stefan Monnier
2012-12-24 1:03 ` bug#13260: 24.3.50; save match data for core functions like `delete-char' and`delete-backward-char'? Drew Adams
2012-12-24 1:24 ` Bastien [this message]
2012-12-24 5:09 ` bug#13260: 24.3.50; save match data for core functions like `delete-char' and `delete-backward-char'? Stefan Monnier
2012-12-24 1:25 ` Bastien
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=878v8outs8.fsf@bzg.ath.cx \
--to=bzg@altern.org \
--cc=13260@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.