[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4a37e1e 314/399: swiper.el (swiper-query-replace): Make ev
From: |
Oleh Krehel |
Subject: |
[elpa] master 4a37e1e 314/399: swiper.el (swiper-query-replace): Make eval-style replacement more accessible |
Date: |
Sat, 20 Jul 2019 14:57:47 -0400 (EDT) |
branch: master
commit 4a37e1ed6c1ae5e6152b4b5a57f042ec3d5863f3
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper-query-replace): Make eval-style replacement more
accessible
For example, suppose in swiper.el, we want to rename:
(defTYPE swiper- to (defTYPE ivy
where TYPE is (group, face, fun, var ...).
1. `swiper-isearch' for "(def\sw+ swiper"
2. "M-q" to replace and "TAB" to get: "\,(concat \1 " " \2)"
3. Modify it to "\,(concat \1 " ivy")"
Re #2096
---
swiper.el | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/swiper.el b/swiper.el
index 620416c..06a9bb2 100644
--- a/swiper.el
+++ b/swiper.el
@@ -184,17 +184,19 @@
(unwind-protect
(let* ((enable-recursive-minibuffers t)
(from (ivy--regex ivy-text))
+ (default
+ (format "\\,(concat %s)"
+ (if (<= ivy--subexps 1)
+ "\\&"
+ (mapconcat (lambda (i) (format "\\%d" i))
+ (number-sequence 1 ivy--subexps)
+ " \" \" "))))
(to
(query-replace-compile-replacement
- (minibuffer-with-setup-hook
- (lambda ()
- (setq minibuffer-default
- (if (string-match
"\\`\\\\_<\\(.*\\)\\\\_>\\'" ivy-text)
- (match-string 1 ivy-text)
- ivy-text)))
- (ivy-read
- (format "Query replace %s with: " from) nil
- :update-fn #'swiper--query-replace-updatefn))
+ (ivy-read
+ (format "Query replace %s with: " from) nil
+ :def default
+ :update-fn #'swiper--query-replace-updatefn)
t)))
(swiper--cleanup)
(ivy-exit-with-action
- [elpa] master d39f82b 307/399: counsel-yank-pop-height is obselete and doesn't do anything, (continued)
- [elpa] master d39f82b 307/399: counsel-yank-pop-height is obselete and doesn't do anything, Oleh Krehel, 2019/07/20
- [elpa] master c11797a 290/399: swiper.el (swiper--line-at-point): Fix swiper-isearch in compilation buffers, Oleh Krehel, 2019/07/20
- [elpa] master 94f107b 304/399: counsel.el (counsel-mark-ring): Add highlight by candidate, Oleh Krehel, 2019/07/20
- [elpa] master 034f3af 306/399: swiper.el (swiper-isearch): Allow char-fold-to-regexp, Oleh Krehel, 2019/07/20
- [elpa] master 5cc1e5c 298/399: swiper.el (swiper-isearch-thing-at-point): Improve, Oleh Krehel, 2019/07/20
- [elpa] master 3b6c898 303/399: counsel.el (counsel-mark-ring): Add preview by candidate, Oleh Krehel, 2019/07/20
- [elpa] master 93616f7 296/399: ivy.el (ivy--regex): Match initial dot in the input as a literal dot, Oleh Krehel, 2019/07/20
- [elpa] master ac1e07c 305/399: ivy.el (ivy--reset-state): Modify prompt for multi-isearch-buffers, Oleh Krehel, 2019/07/20
- [elpa] master 4078eb9 308/399: counsel.el (counsel-yank-pop-height): Remove, Oleh Krehel, 2019/07/20
- [elpa] master 895906e 309/399: counsel.el (counsel-descbinds-function): Add, Oleh Krehel, 2019/07/20
- [elpa] master 4a37e1e 314/399: swiper.el (swiper-query-replace): Make eval-style replacement more accessible,
Oleh Krehel <=
- [elpa] master dd2d495 312/399: swiper.el (swiper-all-thing-at-point): Add, Oleh Krehel, 2019/07/20
- [elpa] master 0576b61 315/399: .github/FUNDING.yml: Add, Oleh Krehel, 2019/07/20
- [elpa] master d060eea 313/399: swiper.el (swiper-query-replace): Add query-replace-compile-replacement, Oleh Krehel, 2019/07/20
- [elpa] master 09b9508 321/399: ivy.el (ivy--find-file-action): Fix for virtual buffers, Oleh Krehel, 2019/07/20
- [elpa] master 7d46450 311/399: Add more information about the collection argument in `ivy-read`., Oleh Krehel, 2019/07/20
- [elpa] master 676a8ee 318/399: swiper.el (swiper-isearch-current-match): Remove unused face, Oleh Krehel, 2019/07/20
- [elpa] master ba626e7 317/399: ivy.el (ivy-next-history-element): Use minibuffer-default for dired-dwim-target, Oleh Krehel, 2019/07/20
- [elpa] master 51e765e 316/399: ivy.el (ivy-partial): Return nil when comletion was not updated, Oleh Krehel, 2019/07/20
- [elpa] master 16d2268 320/399: Fix ivy-push/switch-view windows layout, Oleh Krehel, 2019/07/20
- [elpa] master d260c48 322/399: swiper.el: Obey search-invisible, Oleh Krehel, 2019/07/20