[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109901: * lisp/replace.el (replace-l
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109901: * lisp/replace.el (replace-lax-whitespace): New defcustom. |
Date: |
Thu, 06 Sep 2012 11:49:40 +0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109901
fixes bug: http://debbugs.gnu.org/10885
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Thu 2012-09-06 11:49:40 +0300
message:
* lisp/replace.el (replace-lax-whitespace): New defcustom.
(query-replace, query-replace-regexp, query-replace-regexp-eval)
(replace-string, replace-regexp): Mention it in docstrings.
(perform-replace, replace-highlight): Let-bind
isearch-lax-whitespace and isearch-regexp-lax-whitespace according
to the values of replace-lax-whitespace and regexp-flag.
Don't let-bind search-whitespace-regexp.
* lisp/isearch.el (isearch-query-replace): Let-bind
replace-lax-whitespace instead of let-binding
replace-search-function and replace-re-search-function.
(isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace
and isearch-regexp-lax-whitespace to lazy-highlight variables.
(isearch-toggle-symbol): Set isearch-regexp to nil
in isearch-word mode (like in isearch-toggle-word).
modified:
etc/NEWS
lisp/ChangeLog
lisp/isearch.el
lisp/replace.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-09-05 09:22:20 +0000
+++ b/etc/NEWS 2012-09-06 08:49:40 +0000
@@ -197,6 +197,13 @@
`isearch-lax-whitespace'. In regexp incremental search, it toggles
the value of the variable `isearch-regexp-lax-whitespace'.
+** query-replace changes
+
+*** When new option `replace-lax-whitespace' is non-nil,
+and you enter a space or spaces in the strings or regexps
+to be replaced, `query-replace' will match any sequence matched
+by the regexp `search-whitespace-regexp'.
+
** M-x move-to-column, if called interactively with no prefix arg, now
prompts for a column number.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-09-06 08:33:17 +0000
+++ b/lisp/ChangeLog 2012-09-06 08:49:40 +0000
@@ -1,5 +1,23 @@
2012-09-06 Juri Linkov <address@hidden>
+ * replace.el (replace-lax-whitespace): New defcustom.
+ (query-replace, query-replace-regexp, query-replace-regexp-eval)
+ (replace-string, replace-regexp): Mention it in docstrings.
+ (perform-replace, replace-highlight): Let-bind
+ isearch-lax-whitespace and isearch-regexp-lax-whitespace according
+ to the values of replace-lax-whitespace and regexp-flag.
+ Don't let-bind search-whitespace-regexp. (Bug#10885)
+
+ * isearch.el (isearch-query-replace): Let-bind
+ replace-lax-whitespace instead of let-binding
+ replace-search-function and replace-re-search-function.
+ (isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace
+ and isearch-regexp-lax-whitespace to lazy-highlight variables.
+ (isearch-toggle-symbol): Set isearch-regexp to nil
+ in isearch-word mode (like in isearch-toggle-word).
+
+2012-09-06 Juri Linkov <address@hidden>
+
* replace.el (replace-search-function)
(replace-re-search-function): Set default values to nil.
(perform-replace): Let-bind isearch-related variables based on
=== modified file 'lisp/isearch.el'
--- a/lisp/isearch.el 2012-09-02 09:31:45 +0000
+++ b/lisp/isearch.el 2012-09-06 08:49:40 +0000
@@ -1405,6 +1405,7 @@
(interactive)
(setq isearch-word (unless (eq isearch-word 'isearch-symbol-regexp)
'isearch-symbol-regexp))
+ (if isearch-word (setq isearch-regexp nil))
(setq isearch-success t isearch-adjusted t)
(isearch-update))
@@ -1579,14 +1580,11 @@
;; set `search-upper-case' to nil to not call
;; `isearch-no-upper-case-p' in `perform-replace'
(search-upper-case nil)
- (replace-search-function
- (if (and isearch-lax-whitespace (not regexp-flag))
- #'search-forward-lax-whitespace
- replace-search-function))
- (replace-re-search-function
- (if (and isearch-regexp-lax-whitespace regexp-flag)
- #'re-search-forward-lax-whitespace
- replace-re-search-function))
+ (replace-lax-whitespace
+ (and search-whitespace-regexp
+ (if isearch-regexp
+ isearch-regexp-lax-whitespace
+ isearch-lax-whitespace)))
;; Set `isearch-recursive-edit' to nil to prevent calling
;; `exit-recursive-edit' in `isearch-done' that terminates
;; the execution of this command when it is non-nil.
@@ -2956,10 +2954,14 @@
(let ((case-fold-search isearch-lazy-highlight-case-fold-search)
(isearch-regexp isearch-lazy-highlight-regexp)
(isearch-word isearch-lazy-highlight-word)
+ (isearch-lax-whitespace
+ isearch-lazy-highlight-lax-whitespace)
+ (isearch-regexp-lax-whitespace
+ isearch-lazy-highlight-regexp-lax-whitespace)
+ (isearch-forward isearch-lazy-highlight-forward)
(search-invisible nil) ; don't match invisible text
(retry t)
(success nil)
- (isearch-forward isearch-lazy-highlight-forward)
(bound (if isearch-lazy-highlight-forward
(min (or isearch-lazy-highlight-end-limit (point-max))
(if isearch-lazy-highlight-wrapped
=== modified file 'lisp/replace.el'
--- a/lisp/replace.el 2012-09-06 08:33:17 +0000
+++ b/lisp/replace.el 2012-09-06 08:49:40 +0000
@@ -33,6 +33,14 @@
:type 'boolean
:group 'matching)
+(defcustom replace-lax-whitespace nil
+ "Non-nil means `query-replace' matches a sequence of whitespace chars.
+When you enter a space or spaces in the strings or regexps to be replaced,
+it will match any sequence matched by the regexp `search-whitespace-regexp'."
+ :type 'boolean
+ :group 'matching
+ :version "24.3")
+
(defvar query-replace-history nil
"Default history list for query-replace commands.
See `query-replace-from-history-variable' and
@@ -226,6 +234,10 @@
matched is all caps, or capitalized, then its replacement is upcased
or capitalized.)
+If `replace-lax-whitespace' is non-nil, a space or spaces in the string
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
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.
@@ -270,6 +282,10 @@
all caps, or capitalized, then its replacement is upcased or
capitalized.)
+If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
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.
@@ -346,6 +362,10 @@
Preserves case in each replacement if `case-replace' and `case-fold-search'
are non-nil and REGEXP has no uppercase letters.
+If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
only matches that are surrounded by word boundaries.
Fourth and fifth arg START and END specify the region to operate on."
@@ -437,6 +457,10 @@
\(Preserving case means that if the string matched is all caps, or capitalized,
then its replacement is upcased or capitalized.)
+If `replace-lax-whitespace' is non-nil, a space or spaces in the string
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
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.
@@ -475,6 +499,10 @@
Preserve case in each match if `case-replace' and `case-fold-search'
are non-nil and REGEXP has no uppercase letters.
+If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
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.
@@ -1760,6 +1788,10 @@
replace-search-function)
(let ((isearch-regexp regexp-flag)
(isearch-word delimited-flag)
+ (isearch-lax-whitespace
+ (and replace-lax-whitespace (not regexp-flag)))
+ (isearch-regexp-lax-whitespace
+ (and replace-lax-whitespace regexp-flag))
(isearch-case-fold-search case-fold-search)
(isearch-forward t))
(isearch-search-fun))))
@@ -2113,7 +2145,10 @@
(let ((isearch-string search-string)
(isearch-regexp regexp-flag)
(isearch-word delimited-flag)
- (search-whitespace-regexp nil)
+ (isearch-lax-whitespace
+ (and replace-lax-whitespace (not regexp-flag)))
+ (isearch-regexp-lax-whitespace
+ (and replace-lax-whitespace regexp-flag))
(isearch-case-fold-search case-fold-search)
(isearch-forward t)
(isearch-error nil))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109901: * lisp/replace.el (replace-lax-whitespace): New defcustom.,
Juri Linkov <=