bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#35354: 26.2; `dired-do-query-replace-regexp': How to replace only wo


From: Drew Adams
Subject: bug#35354: 26.2; `dired-do-query-replace-regexp': How to replace only word-delimited matches?
Date: Sun, 21 Apr 2019 16:57:57 -0700 (PDT)

> > `dired-do-query-replace-regexp' has taken the key binding of
> > `dired-do-find-regexp-and-replace'.

(I obviously said that backward.  The latter took the
binding of the former.)

> > I was expecting that it would do
> > all that the latter does plus more.
> 
> I don't really understand how we can both expect FROM
> to be a regexp and have a separate argument DELIMITED.

Why is that a problem?

That's exactly what `dired-do-query-replace-regexp' does.
Its FROM is a REGEXP.  Doc string:

 Do ‘query-replace-regexp’ of FROM with TO, on all marked files.
 Third arg DELIMITED (prefix arg) means replace only
 word-delimited matches.
 If you exit (C-g, RET or q), you can resume the query replace
 with the command M-x tags-loop-continue.

(Of course, before the loss of key bindings, the last line
read simply "with the command M-,.)

> > How does a user use `dired-do-query-replace-regexp' to
> > replace only word-delimited matches?

(Again, I meant `dired-do-find-regexp-and-replace'.)

> How about \<input\>?

How do you specify delimited _replacement_?  It's about
the 3rd element returned by `query-replace-read-args',
which you're not currently using anywhere (even though
it is provided).

It's no different than it is for `query-replace-regexp'
or other commands that use `query-replace-read-args'.
But `xref-query-replace-in-results' doesn't accept that
3rd element, DELIMITED.  This bug report asks it to do so.

Also, args FROM and TO for `xref-query-replace-in-results'
aren't even described in its doc string.  They should be.

The doc string of `dired-do-query-replace-regexp' refers
to `query-replace-regexp', so users can tell that FROM is
in fact a REGEXP.  They deserve similar help for
`xref-query-replace-in-results', no?

`dired-do-query-replace-regexp' lets you use a prefix arg
to specify word-delimiting.  A prefix arg isn't even used
for `dired-do-find-regexp-and-replace'.  It would be simple
to do the same, provided `xref-query-replace-in-results'
could handle the DELIMITED arg.





reply via email to

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