From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Bastien <bzg@altern.org>
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: Sun, 23 Dec 2012 19:54:00 -0500 [thread overview]
Message-ID: <jwvfw2wgtpe.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87bodkbu2k.fsf@bzg.ath.cx> (Bastien's message of "Sun, 23 Dec 2012 17:40:35 +0100")
>>> I know the policy is to let any function assume the match data
>>> are not saved, but I think an exception would be useful here.
>> Why?
> Because delete-char is very low-level and because it is hard to
> guess why it would modify the match data -- hence very easy to
> assume it will not, while it does.
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.
> 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.
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.
Stefan
next prev parent reply other threads:[~2012-12-24 0:54 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 [this message]
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 ` bug#13260: 24.3.50; save match data for core functions like `delete-char' and `delete-backward-char'? Bastien
2012-12-24 5:09 ` 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=jwvfw2wgtpe.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=13260@debbugs.gnu.org \
--cc=bzg@altern.org \
/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.