summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2009-11-30 16:05:47 +0000
committerJuri Linkov <juri@jurta.org>2009-11-30 16:05:47 +0000
commit2952b1ae0475a3efd8646281bc8aa0e6aeb5e8f6 (patch)
tree769b8c7db805db536723973331609d9b3325fbd0 /lisp/replace.el
parent20565545f2e2094d4ff811223213d7c8b537ee80 (diff)
downloademacs-2952b1ae0475a3efd8646281bc8aa0e6aeb5e8f6.tar.gz
emacs-2952b1ae0475a3efd8646281bc8aa0e6aeb5e8f6.tar.bz2
emacs-2952b1ae0475a3efd8646281bc8aa0e6aeb5e8f6.zip
(perform-replace): Let-bind recenter-last-op to nil.
For def=recenter, replace `recenter' with `recenter-top-bottom' that is called with `this-command' and `last-command' let-bound to `recenter-top-bottom'. When the last `def' was not `recenter', set `recenter-last-op' to nil. (Bug#4981)
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 7e14895d1e6..e9ff4ff47e8 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1549,6 +1549,7 @@ make, or the user didn't cancel the call."
(replace-count 0)
(nonempty-match nil)
(multi-buffer nil)
+ (recenter-last-op nil) ; Start cycling order with initial position.
;; If non-nil, it is marker saying where in the buffer to stop.
(limit nil)
@@ -1785,7 +1786,12 @@ make, or the user didn't cancel the call."
((eq def 'skip)
(setq done t))
((eq def 'recenter)
- (recenter nil))
+ ;; `this-command' has the value `query-replace',
+ ;; so we need to bind it to `recenter-top-bottom'
+ ;; to allow it to detect a sequence of `C-l'.
+ (let ((this-command 'recenter-top-bottom)
+ (last-command 'recenter-top-bottom))
+ (recenter-top-bottom)))
((eq def 'edit)
(let ((opos (point-marker)))
(setq real-match-data (replace-match-data
@@ -1839,9 +1845,12 @@ make, or the user didn't cancel the call."
unread-command-events))
(setq done t)))
(when query-replace-lazy-highlight
- ;; Force lazy rehighlighting only after replacements
+ ;; Force lazy rehighlighting only after replacements.
(if (not (memq def '(skip backup)))
- (setq isearch-lazy-highlight-last-string nil))))
+ (setq isearch-lazy-highlight-last-string nil)))
+ (unless (eq def 'recenter)
+ ;; Reset recenter cycling order to initial position.
+ (setq recenter-last-op nil)))
;; Record previous position for ^ when we move on.
;; Change markers to numbers in the match data
;; since lots of markers slow down editing.