GNU bug report logs -
#41692
26.3; Enhancement request, `query-replace': let user use text at point as default
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Wed, 3 Jun 2020 18:36:01 UTC
Severity: wishlist
Tags: fixed
Found in version 26.3
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Currently `query-replace-read-from' has:
> (if regexp-flag
> (read-regexp prompt nil 'minibuffer-history)
> (read-from-minibuffer
> prompt nil nil nil nil (car search-ring) t))
>
> It's easy to extend `read-regexp' with more options,
> but what to do for non-regexp case?
>
> Maybe to try to use `read-string' and extend it with
> more M-n options like in `read-regexp'.
I don't understand the question. `read-from-minibuffer'
accepts a list of default values. Or maybe I don't
understand what you mean by "more options".
I think I referred you to my code in `replace+.el'.
Here it is, in case I didn't:
https://www.emacswiki.org/emacs/download/replace%2b.el
In my code for `query-replace-read-from' I determine
the default value(s) by evaluating this:
(search/replace-default
(symbol-value query-replace-from-history-variable))
I use function `search/replace-default' in lots of
search and replace functions. It's the place where
this logic is used to get default values:
Return a default value or list of such for search &
replace functions.
A list of default input strings is computed and
returned. The possible strings are, in order:
* The active region, if option
`search/replace-region-as-default-flag' is non-nil.
* The secondary selection, if option
`search/replace-2nd-sel-as-default-flag' is non-nil.
* The result of calling the value of option
`search/replace-default-fn', if non-nil.
* The first entry in the history list HISTORY.
Option `search/replace-default-fn' lets users decide
what function to use, to grab buffer text as the
default. The option's default value is a function
that grabs the non-nil symbol name that's nearest point.
If that function isn't available then the default value
is `word-at-point'.
HTH.
This bug report was last modified 4 years and 210 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.