summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2015-12-07 15:12:15 +0000
committerAlan Mackenzie <acm@muc.de>2015-12-07 15:12:15 +0000
commit3194f1ccd99cfd13ddaf621d6e7f1e1aa1645165 (patch)
tree3963195a29eea661a697516ad424567a05cfdfeb /lisp/replace.el
parentf5c403d269f4f5079dc47853f16a51e9542ea238 (diff)
downloademacs-3194f1ccd99cfd13ddaf621d6e7f1e1aa1645165.tar.gz
emacs-3194f1ccd99cfd13ddaf621d6e7f1e1aa1645165.tar.bz2
emacs-3194f1ccd99cfd13ddaf621d6e7f1e1aa1645165.zip
Further progress making Isearch, Ispell, Replace work with Follow Mode.
* lisp/follow.el: (follow-mode): Remove references to sit*-for-function, which no longer exists. Add follow-post-command-hook to three special purpose hooks at setup, and remove them at tear down. * lisp/isearch.el: (isearch-update): invoke isearch-update-post-hook before isearch-lazy-highlight-new-loop. (isearch-lazy-highlight-new-loop): Restore this function to what it previously was, merging the functionality of isearch-lazy-highlight-maybe-new-loop into it. (isearch-lazy-highlight-maybe-new-loop): function removed. * lisp/replace.el: (replace-update-post-hook): New hook variable. (perform-replace): Add second (nil) argument to looking-back. Invoke replace-update-post-hook before calling replace-highlight. * lisp/textmodes/ispell.el: (ispell-update-post-hook): New hook variable. (ispell-command-loop): invoke ispell-update-post-hook. Add GROUP argument to call of pos-visible-in-window-p. (ispell-display-buffer): Place *Choices* window at the top of the last window in a window group.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 54b3a71bda2..d48f4f3fdf9 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2011,6 +2011,9 @@ passed in. If LITERAL is set, no checking is done, anyway."
(when backward (goto-char (nth 0 match-data)))
noedit)
+(defvar replace-update-post-hook nil
+ "Function(s) to call after query-replace has found a match in the buffer.")
+
(defvar replace-search-function nil
"Function to use when searching for strings to replace.
It is used by `query-replace' and `replace-string', and is called
@@ -2264,7 +2267,7 @@ It must return a string."
(and nonempty-match
(or (not regexp-flag)
(and (if backward
- (looking-back search-string)
+ (looking-back search-string nil)
(looking-at search-string))
(let ((match (match-data)))
(and (/= (nth 0 match) (nth 1 match))
@@ -2318,7 +2321,8 @@ It must return a string."
;; `real-match-data'.
(while (not done)
(set-match-data real-match-data)
- (replace-highlight
+ (run-hooks 'replace-update-post-hook) ; Before `replace-highlight'.
+ (replace-highlight
(match-beginning 0) (match-end 0)
start end search-string
regexp-flag delimited-flag case-fold-search backward)