all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Subject: match-data confusion...
Date: 18 Jun 2004 12:10:42 +0200	[thread overview]
Message-ID: <x5zn71qiql.fsf@lola.goethe.zz> (raw)


I am having a problem with getting stuff right in replace.el.

The problem is that

(match-data t) is basically dangerous since it is lacking the
information to restore last_thing_searched.  But that means that
(set-match-data (match-data t)) is not a noop, even if the buffer is
not changed in between since the restored match-data stops being
adjust when buffer changes occur before it.

Two possible amendments: one thing would be to add the buffer itself
as a list element into match-data.  That might be an incompatible
change, however.

The second one would be to allow an optional argument to
set-match-data that specifies a buffer, so that
(set-match-data (match-data t) buffer) will set last_thing_searched
to the specified buffer again.

As it is, I will probably have to write a special purpose function in
replace.el for now that looks like
(defun replace-set-match-data (match-data)
   (if (integerp (car match-data))
     (let ((marker (make-marker)))
         (set-marker marker (car match-data))
         (set-match-data (cons marker (cdr match-data)))
         (set-marker marker nil))
     (set-match-data match-data)))

which is pretty ugly and relies on some internals to stay the way
they are now.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

             reply	other threads:[~2004-06-18 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-18 10:10 David Kastrup [this message]
2004-06-18 11:42 ` match-data confusion David Kastrup
2004-06-19  3:19 ` Richard Stallman

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=x5zn71qiql.fsf@lola.goethe.zz \
    --to=dak@gnu.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.