diff options
| author | Juri Linkov | 2009-11-30 16:05:47 +0000 |
|---|---|---|
| committer | Juri Linkov | 2009-11-30 16:05:47 +0000 |
| commit | 2952b1ae0475a3efd8646281bc8aa0e6aeb5e8f6 (patch) | |
| tree | 769b8c7db805db536723973331609d9b3325fbd0 | |
| parent | 20565545f2e2094d4ff811223213d7c8b537ee80 (diff) | |
| download | emacs-2952b1ae0475a3efd8646281bc8aa0e6aeb5e8f6.tar.gz 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)
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/replace.el | 15 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f53049dc538..568f1d30c86 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-11-30 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * replace.el (perform-replace): Let-bind recenter-last-op to nil. | ||
| 4 | For def=recenter, replace `recenter' with `recenter-top-bottom' | ||
| 5 | that is called with `this-command' and `last-command' let-bound | ||
| 6 | to `recenter-top-bottom'. When the last `def' was not `recenter', | ||
| 7 | set `recenter-last-op' to nil. (Bug#4981) | ||
| 8 | |||
| 1 | 2009-11-30 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2009-11-30 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | Minor cleanup and simplification. | 11 | Minor cleanup and simplification. |
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." | |||
| 1549 | (replace-count 0) | 1549 | (replace-count 0) |
| 1550 | (nonempty-match nil) | 1550 | (nonempty-match nil) |
| 1551 | (multi-buffer nil) | 1551 | (multi-buffer nil) |
| 1552 | (recenter-last-op nil) ; Start cycling order with initial position. | ||
| 1552 | 1553 | ||
| 1553 | ;; If non-nil, it is marker saying where in the buffer to stop. | 1554 | ;; If non-nil, it is marker saying where in the buffer to stop. |
| 1554 | (limit nil) | 1555 | (limit nil) |
| @@ -1785,7 +1786,12 @@ make, or the user didn't cancel the call." | |||
| 1785 | ((eq def 'skip) | 1786 | ((eq def 'skip) |
| 1786 | (setq done t)) | 1787 | (setq done t)) |
| 1787 | ((eq def 'recenter) | 1788 | ((eq def 'recenter) |
| 1788 | (recenter nil)) | 1789 | ;; `this-command' has the value `query-replace', |
| 1790 | ;; so we need to bind it to `recenter-top-bottom' | ||
| 1791 | ;; to allow it to detect a sequence of `C-l'. | ||
| 1792 | (let ((this-command 'recenter-top-bottom) | ||
| 1793 | (last-command 'recenter-top-bottom)) | ||
| 1794 | (recenter-top-bottom))) | ||
| 1789 | ((eq def 'edit) | 1795 | ((eq def 'edit) |
| 1790 | (let ((opos (point-marker))) | 1796 | (let ((opos (point-marker))) |
| 1791 | (setq real-match-data (replace-match-data | 1797 | (setq real-match-data (replace-match-data |
| @@ -1839,9 +1845,12 @@ make, or the user didn't cancel the call." | |||
| 1839 | unread-command-events)) | 1845 | unread-command-events)) |
| 1840 | (setq done t))) | 1846 | (setq done t))) |
| 1841 | (when query-replace-lazy-highlight | 1847 | (when query-replace-lazy-highlight |
| 1842 | ;; Force lazy rehighlighting only after replacements | 1848 | ;; Force lazy rehighlighting only after replacements. |
| 1843 | (if (not (memq def '(skip backup))) | 1849 | (if (not (memq def '(skip backup))) |
| 1844 | (setq isearch-lazy-highlight-last-string nil)))) | 1850 | (setq isearch-lazy-highlight-last-string nil))) |
| 1851 | (unless (eq def 'recenter) | ||
| 1852 | ;; Reset recenter cycling order to initial position. | ||
| 1853 | (setq recenter-last-op nil))) | ||
| 1845 | ;; Record previous position for ^ when we move on. | 1854 | ;; Record previous position for ^ when we move on. |
| 1846 | ;; Change markers to numbers in the match data | 1855 | ;; Change markers to numbers in the match data |
| 1847 | ;; since lots of markers slow down editing. | 1856 | ;; since lots of markers slow down editing. |