all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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: Mon, 24 Dec 2012 00:09:55 -0500	[thread overview]
Message-ID: <jwvhancm45l.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <878v8outs8.fsf@bzg.ath.cx> (Bastien's message of "Mon, 24 Dec 2012 02:24:07 +0100")

> 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.

Basically, if you need the match-data, you should get it right after the
match itself.  So save-match-data is something to use between the match
and the match-data extraction (unless this code is trivial, as is
usually the case), rather than around functions that might potentially
appear occasionally somewhere between a match and
a match-data extraction.

I know these requests will keep coming until the byte-compiler is
enhanced to flag places where a save-match-data is potentially missing,
or maybe until we replace the "string-match followed by
match-beginning/end" with a "match and then bind subgroups to provided
vars".


        Stefan





  reply	other threads:[~2012-12-24  5:09 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       ` 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 [this message]
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=jwvhancm45l.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.