branch: externals/ivy-hydra
commit 3d9c2223e372657732a5959f465b7d835a6bf130
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
swiper.el (swiper--query-replace-updatefn): Fix
Now when using \,() style of replacement, the replacements are
correct, instead of using the replacement of the last match.
---
swiper.el | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/swiper.el b/swiper.el
index 687e1e9..1635585 100644
--- a/swiper.el
+++ b/swiper.el
@@ -149,20 +149,16 @@ Treated as non-nil when searching backwards."
(defun swiper--query-replace-updatefn ()
(let ((lisp (ignore-errors (nth 2 (query-replace-compile-replacement
ivy-text t)))))
(dolist (ov swiper--query-replace-overlays)
- (when lisp
- (dolist (x (overlay-get ov 'matches))
- (setq lisp (cl-subst (cadr x) (car x) lisp :test #'equal)))
- (setq lisp (ignore-errors (eval lisp))))
(overlay-put
ov 'after-string
(propertize
- (if (stringp lisp)
- lisp
- (set-match-data (overlay-get ov 'md))
- (condition-case nil
- (with-current-buffer (overlay-buffer ov)
- (match-substitute-replacement ivy-text))
- (error ivy-text)))
+ (condition-case nil
+ (with-current-buffer (overlay-buffer ov)
+ (set-match-data (overlay-get ov 'md))
+ (if (consp lisp)
+ (eval lisp)
+ (match-substitute-replacement ivy-text)))
+ (error ivy-text))
'face 'error)))))
(defun swiper--query-replace-cleanup ()