emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xref-query-replace


From: Eli Zaretskii
Subject: Re: xref-query-replace
Date: Sat, 09 Jan 2016 18:36:19 +0200

> Cc: address@hidden
> From: Dmitry Gutov <address@hidden>
> Date: Sat, 9 Jan 2016 18:50:00 +0300
> 
> On 01/09/2016 06:28 PM, Eli Zaretskii wrote:
> > Is this command supposed to work?
> 
> You invoke it from an xref output buffer, to perform replacement across 
> the results of a "find references" or "find regexp" command.

That's what I believe I tried.  See below.

> I've posted a thread about it in November: 
> http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01465.html

Thanks.  I've read it now, and it describes exactly what I did.  (Btw,
why does it say to agree to ".*"? aren't other regexps supposed to
work as well?)

> > If so, could someone please explain
> > what its argument FROM means?
> 
> Regexp to match within each match. So, if you made a search for 
> xref-query-replace, you can easily replace "query" with "interactive" in 
> all those matches.

That's what I thought.

> Yes, it's a bit convoluted.

It isn't, really.  The doc string and the prompts could use some
improvement to be less confusing, but they only confused me because
the expected thing didn't happen.

> > I tried the command with both ELisp and etags back-ends, and it seems
> > to always say "No suitable matches here".  The doc string says just
> >
> >    "Perform interactive replacement in all current matches."
> >
> > but what are "current matches"?  Matches of what?
> 
> Matches for input you've given previously to xref-find-regexp?

That's what I thought.

OK, so here's the recipe that didn't work for me on the emacs-25
branch:

  emacs -Q
  M-. deactivate-mark RET

You are now presented with a *xref* buffer with 2 matches, and that
buffer's window is selected.

  r RET ddd RET

Result: "No suitable matches here".

Same result with this recipe:

  emacs -Q
  C-x C-f src/xdisp.c
  M-.

Press RET to confirm visiting the TAGS table in src/ (you should have
one, of course).  You are now presented with a *xref* buffer that
lists many matches for "Display".  (Should xref pick up symbols inside
comments?)  In that buffer, type:

  r RET xyzzy RET

I get the same disappointing result.

Stepping through xref-query-replace, it seems like xref-match-length
always returns nil, so no matches are collected.  Which sounds about
right, since I see no non-trivial definitions for xref-match-length,
or maybe I'm blind.

What am I doing wrong?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]