* lisp/replace.el (query-replace-interactive): Declare obsolete.
(query-replace-read-from): Add the last incremental search string to the list of default values accessible via M-n. (map-query-replace-regexp): Use `read-regexp'. (query-replace, query-replace-regexp, query-replace-regexp-eval) (map-query-replace-regexp, replace-string, replace-regexp): Fix docstrings to replace mentions of `query-replace-interactive' with alternatives. Fixes: debbugs:12526
This commit is contained in:
parent
93cacb6d08
commit
0e2ae83d4b
3 changed files with 42 additions and 23 deletions
1
etc/NEWS
1
etc/NEWS
|
@ -858,6 +858,7 @@ See the "Face Attributes" section of the Elisp manual.
|
|||
*** `macro-declaration-function' (use `macro-declarations-alist').
|
||||
*** `window-system-version'
|
||||
*** `dired-pop-to-buffer' (use `dired-mark-pop-up')
|
||||
*** `query-replace-interactive'
|
||||
|
||||
|
||||
* Changes in Emacs 24.3 on non-free operating systems
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2012-10-04 Juri Linkov <juri@jurta.org>
|
||||
|
||||
* replace.el (query-replace-interactive): Declare obsolete.
|
||||
(query-replace-read-from): Add the last incremental search string
|
||||
to the list of default values accessible via M-n.
|
||||
(map-query-replace-regexp): Use `read-regexp'.
|
||||
(query-replace, query-replace-regexp, query-replace-regexp-eval)
|
||||
(map-query-replace-regexp, replace-string, replace-regexp):
|
||||
Fix docstrings to replace mentions of `query-replace-interactive'
|
||||
with alternatives. (Bug#12526)
|
||||
|
||||
2012-10-04 Juri Linkov <juri@jurta.org>
|
||||
|
||||
* dired.el (dired-shrink-to-fit): Declare obsolete. (Bug#1806)
|
||||
|
|
|
@ -62,6 +62,10 @@ no default value.")
|
|||
(defvar query-replace-interactive nil
|
||||
"Non-nil means `query-replace' uses the last search string.
|
||||
That becomes the \"string to replace\".")
|
||||
(make-obsolete-variable 'query-replace-interactive
|
||||
"use `M-n' to pull the last incremental search string
|
||||
to the minibuffer that reads the string to replace, or invoke replacements
|
||||
from Isearch by using a key sequence like `C-s C-s M-%'." "24.3")
|
||||
|
||||
(defcustom query-replace-from-history-variable 'query-replace-history
|
||||
"History list to use for the FROM argument of `query-replace' commands.
|
||||
|
@ -142,7 +146,8 @@ wants to replace FROM with TO."
|
|||
(if regexp-flag
|
||||
(read-regexp prompt nil query-replace-from-history-variable)
|
||||
(read-from-minibuffer
|
||||
prompt nil nil nil query-replace-from-history-variable nil t)))))
|
||||
prompt nil nil nil query-replace-from-history-variable
|
||||
(car (if regexp-flag regexp-search-ring search-ring)) t)))))
|
||||
(if (and (zerop (length from)) query-replace-defaults)
|
||||
(cons (car query-replace-defaults)
|
||||
(query-replace-compile-replacement
|
||||
|
@ -231,9 +236,11 @@ what to do with it. For directions, type \\[help-command] at that time.
|
|||
In Transient Mark mode, if the mark is active, operate on the contents
|
||||
of the region. Otherwise, operate from point to the end of the buffer.
|
||||
|
||||
If `query-replace-interactive' is non-nil, the last incremental search
|
||||
string is used as FROM-STRING--you don't have to specify it with the
|
||||
minibuffer.
|
||||
Use \\<minibuffer-local-map>\\[next-history-element] \
|
||||
to pull the last incremental search string to the minibuffer
|
||||
that reads FROM-STRING, or invoke replacements from
|
||||
incremental search with a key sequence like `C-s C-s M-%'
|
||||
to use its current search string as the string to replace.
|
||||
|
||||
Matching is independent of case if `case-fold-search' is non-nil and
|
||||
FROM-STRING has no uppercase letters. Replacement transfers the case
|
||||
|
@ -279,9 +286,11 @@ what to do with it. For directions, type \\[help-command] at that time.
|
|||
In Transient Mark mode, if the mark is active, operate on the contents
|
||||
of the region. Otherwise, operate from point to the end of the buffer.
|
||||
|
||||
If `query-replace-interactive' is non-nil, the last incremental search
|
||||
regexp is used as REGEXP--you don't have to specify it with the
|
||||
minibuffer.
|
||||
Use \\<minibuffer-local-map>\\[next-history-element] \
|
||||
to pull the last incremental search regexp to the minibuffer
|
||||
that reads REGEXP, or invoke replacements from
|
||||
incremental search with a key sequence like `C-M-s C-M-s C-M-%'
|
||||
to use its current search regexp as the regexp to replace.
|
||||
|
||||
Matching is independent of case if `case-fold-search' is non-nil and
|
||||
REGEXP has no uppercase letters. Replacement transfers the case
|
||||
|
@ -364,9 +373,9 @@ In interactive use, `\\#' in itself stands for `replace-count'.
|
|||
In Transient Mark mode, if the mark is active, operate on the contents
|
||||
of the region. Otherwise, operate from point to the end of the buffer.
|
||||
|
||||
If `query-replace-interactive' is non-nil, the last incremental search
|
||||
regexp is used as REGEXP--you don't have to specify it with the
|
||||
minibuffer.
|
||||
Use \\<minibuffer-local-map>\\[next-history-element] \
|
||||
to pull the last incremental search regexp to the minibuffer
|
||||
that reads REGEXP.
|
||||
|
||||
Preserves case in each replacement if `case-replace' and `case-fold-search'
|
||||
are non-nil and REGEXP has no uppercase letters.
|
||||
|
@ -417,19 +426,16 @@ of the region. Otherwise, operate from point to the end of the buffer.
|
|||
|
||||
Non-interactively, TO-STRINGS may be a list of replacement strings.
|
||||
|
||||
If `query-replace-interactive' is non-nil, the last incremental search
|
||||
regexp is used as REGEXP--you don't have to specify it with the minibuffer.
|
||||
Use \\<minibuffer-local-map>\\[next-history-element] \
|
||||
to pull the last incremental search regexp to the minibuffer
|
||||
that reads REGEXP.
|
||||
|
||||
A prefix argument N says to use each replacement string N times
|
||||
before rotating to the next.
|
||||
Fourth and fifth arg START and END specify the region to operate on."
|
||||
(interactive
|
||||
(let* ((from (if query-replace-interactive
|
||||
(car regexp-search-ring)
|
||||
(read-from-minibuffer "Map query replace (regexp): "
|
||||
nil nil nil
|
||||
query-replace-from-history-variable
|
||||
nil t)))
|
||||
(let* ((from (read-regexp "Map query replace (regexp): " nil
|
||||
query-replace-from-history-variable))
|
||||
(to (read-from-minibuffer
|
||||
(format "Query replace %s with (space-separated strings): "
|
||||
(query-replace-descr from))
|
||||
|
@ -475,9 +481,9 @@ Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
|
|||
only matches surrounded by word boundaries.
|
||||
Fourth and fifth arg START and END specify the region to operate on.
|
||||
|
||||
If `query-replace-interactive' is non-nil, the last incremental search
|
||||
string is used as FROM-STRING--you don't have to specify it with the
|
||||
minibuffer.
|
||||
Use \\<minibuffer-local-map>\\[next-history-element] \
|
||||
to pull the last incremental search string to the minibuffer
|
||||
that reads FROM-STRING.
|
||||
|
||||
This function is usually the wrong thing to use in a Lisp program.
|
||||
What you probably want is a loop like this:
|
||||
|
@ -540,8 +546,9 @@ When using those Lisp features interactively in the replacement
|
|||
text, TO-STRING is actually made a list instead of a string.
|
||||
Use \\[repeat-complex-command] after this command for details.
|
||||
|
||||
If `query-replace-interactive' is non-nil, the last incremental search
|
||||
regexp is used as REGEXP--you don't have to specify it with the minibuffer.
|
||||
Use \\<minibuffer-local-map>\\[next-history-element] \
|
||||
to pull the last incremental search regexp to the minibuffer
|
||||
that reads REGEXP.
|
||||
|
||||
This function is usually the wrong thing to use in a Lisp program.
|
||||
What you probably want is a loop like this:
|
||||
|
|
Loading…
Add table
Reference in a new issue