all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <Stephen.Berman@gmx.net>
Subject: Re: match-string debugging problem
Date: Fri, 11 Mar 2005 23:18:06 +0100	[thread overview]
Message-ID: <873bv1omht.fsf@nolde.local.home> (raw)
In-Reply-To: 8764zzkr35.fsf@thalassa.informatimago.com

On 11 Mar 2005 00:40:14 +0100 Pascal Bourguignon <spam@mouse-potato.com> wrote:

> Stephen Berman <Stephen.Berman@gmx.net> writes:
>
>> [...]
>> >>     (let ((mystring-list ()))
>> >>       (while (re-search-forward
>> >> 	      (concat "^" (regexp-quote mystring1) "\\(.+\\)"
>> >> 		      (regexp-quote mystring2) "$")
>> >> 	      (point-max) t)
>> >> 	(setq mystring-list (append (list (match-string 1)) mystring-list)))
>> >>       (insert "\n")
>> >>       (setq mystring-list (reverse mystring-list))
>> >>       (dolist (elt mystring-list)
>> >> 	(insert elt " ")))))
>> 
>> [...]
>> In any case, what I did find is that I can in fact track match-string
>> by explicitly entering the ordinary Lisp debugger at that point.  So
>> putting `(debug)' before `(match-string 1)' in the above code stops
>> execution there and stepping into the function by pressing `d' returns
>> the matched string.  So if there's a bug, then it's only in Edebug.  I
>> couldn't find any relevant discussion in the Edebug section of the
>> manual.  So at the very least, the Elisp documentation could be more
>> explicit on this issue.
>
>
> My guess is that either:
>
> - Edebug matches regexp itself, and therefore erases the match-data, 
>   (a save-match-data would be in order in Edebug), or
>
> - Edebug changes the current buffer, and therefore when it executes 
>   (match-string 1), this functions refers the match-data of the Edebug 
>   buffer instead of that of the original buffer
>   (a save-excursion would be in order in Edebug).
>
> I'd bet for the former, since save-excursion is more commonly used
> than save-match-data... (save-excursion calls save-buffer).

I'm going to file a bug report to see if someone can confirm or refute
your conjecture.  Even if there's no code bug, I think the failure to
mention this behavior is at least a doc bug.

Steve Berman

  reply	other threads:[~2005-03-11 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3303.1110470311.32256.help-gnu-emacs@gnu.org>
2005-03-10 17:06 ` match-string debugging problem Pascal Bourguignon
2005-03-10 22:27   ` Stephen Berman
     [not found]   ` <mailman.3372.1110495427.32256.help-gnu-emacs@gnu.org>
2005-03-10 23:40     ` Pascal Bourguignon
2005-03-11 22:18       ` Stephen Berman [this message]
2005-03-13 21:52 ` Alan Wehmann
2005-03-14 19:32   ` Stephen Berman
2005-03-10 15:18 Stephen Berman

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=873bv1omht.fsf@nolde.local.home \
    --to=stephen.berman@gmx.net \
    /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.