unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Barry OReilly <gundaetiapo@gmail.com>
Cc: 14281@debbugs.gnu.org
Subject: bug#14281: 24.3; replace-match leaves point at wrong place
Date: Wed, 15 May 2013 11:03:58 -0400	[thread overview]
Message-ID: <CAFM41H09SxxDVdfNpWnDd=HFaphPUi0GQFvFjzyAjQKednej7w@mail.gmail.com> (raw)
In-Reply-To: <CAFM41H1f19mQPGDNH0doEaX8_C==aX798LsFW1Un2mY3qVrjgw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

To clarify and expand on the previous:

(defadvice evil-track-last-insertion (around
my-advice-evil-track-last-insertion activate)
  (my-msg "DEBUG: 01a evil-track-last-insertion match-beginning=%s
match-end=%s match-data=%s" (match-beginning 0) (match-end 0) (match-data))
  (save-match-data ad-do-it)
  (my-msg "DEBUG: 01b evil-track-last-insertion match-beginning=%s
match-end=%s match-data=%s" (match-beginning 0) (match-end 0) (match-data))
  )

Causes output:

2013-05-15T09:15:21.604604 DEBUG: 01a evil-track-last-insertion
match-beginning=0 match-end=5 match-data=(#<marker at 1 in Redacted.cc>
#<marker at 5 in Redacted.cc> #<marker at 4 in Redacted.cc> #<marker at 5
in Redacted.cc>)
2013-05-15T09:15:21.613707 DEBUG: 01b evil-track-last-insertion
match-beginning=1 match-end=5 match-data=(#<marker at 1 in Redacted.cc>
#<marker at 5 in Redacted.cc> #<marker at 4 in Redacted.cc> #<marker at 5
in Redacted.cc>)

(match-beginning 0) evaluates to 0 while the first element of (match-data)
is a marker at 1. Is this discrepancy expected?

I determined the reason for the discrepancy is that when match-data creates
the markers, set-marker can adjust the position. This puts the markers
saved and restored through save-match-data out of sync with the
search_regs. I suspect this is a problem since replace-match assumes
search_regs don't change during change hooks. It certainly creates a
problem for the error checking approach.

[-- Attachment #2: Type: text/html, Size: 1574 bytes --]

  reply	other threads:[~2013-05-15 15:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27  1:19 bug#14281: 24.3; replace-match leaves point at wrong place Barry OReilly
2013-05-09 19:07 ` Barry OReilly
2013-05-09 21:27   ` Stefan Monnier
2013-05-10 13:27     ` Barry OReilly
2013-05-10 18:19       ` Barry OReilly
2013-05-10 20:56         ` Stefan Monnier
2013-05-14 17:01           ` Barry OReilly
2013-05-15 15:03             ` Barry OReilly [this message]
2013-05-15 19:18               ` Stefan Monnier
2013-05-15 20:44                 ` Barry OReilly
2013-05-15 20:58                   ` Barry OReilly
2013-05-21 21:49                     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAFM41H09SxxDVdfNpWnDd=HFaphPUi0GQFvFjzyAjQKednej7w@mail.gmail.com' \
    --to=gundaetiapo@gmail.com \
    --cc=14281@debbugs.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).