emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/anzu b310647932 085/288: Add separator parameter of 'to' s


From: ELPA Syncer
Subject: [nongnu] elpa/anzu b310647932 085/288: Add separator parameter of 'to' string
Date: Thu, 6 Jan 2022 03:58:42 -0500 (EST)

branch: elpa/anzu
commit b310647932b101e4c76c5bbaf02fcc61dd0c27c4
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    Add separator parameter of 'to' string
---
 README.md | 10 +++++++++-
 anzu.el   | 12 ++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 8987ff6f17..15239bbb57 100644
--- a/README.md
+++ b/README.md
@@ -163,6 +163,10 @@ It is hard to see with anzu replace command when region is 
active.
 Thing at point of `anzu-query-replace-at-cursor-thing`.
 This parameter is same as `thing-at-point`.
 
+#### `anzu-replace-to-string-separator`(Default is "")
+
+Separator of `to` string.
+
 
 ## Sample Configuration
 
@@ -173,5 +177,9 @@ This parameter is same as `thing-at-point`.
 (set-face-attribute 'anzu-mode-line nil
                     :foreground "yellow" :weight 'bold)
 
-(setq anzu-search-threshold 1000)
+(custom-set-variables
+ '(anzu-mode-lighter "")
+ '(anzu-deactivate-region t)
+ '(anzu-search-threshold 1000)
+ '(anzu-replace-to-string-separator " => "))
 ```
diff --git a/anzu.el b/anzu.el
index 38373b750a..d2e4531b53 100644
--- a/anzu.el
+++ b/anzu.el
@@ -97,6 +97,11 @@
   :type 'symbol
   :group 'anzu)
 
+(defcustom anzu-replace-to-string-separator ""
+  "Separator of `to' string"
+  :type 'string
+  :group 'anzu)
+
 (defface anzu-mode-line
   '((t (:foreground "magenta" :weight bold)))
   "face of anzu modeline"
@@ -393,6 +398,10 @@
         collect ov into anzu-overlays
         finally return (sort anzu-overlays 'anzu--overlay-sort)))
 
+(defsubst anzu--propertize-to-string (str)
+  (let ((separator (or anzu-replace-to-string-separator "")))
+    (propertize (concat separator str) 'face 'anzu-replace-to)))
+
 (defun anzu--append-replaced-string (buf beg end use-regexp overlay-limit)
   (let ((content (minibuffer-contents))
         (replace-count 0))
@@ -405,8 +414,7 @@
             (if replace-evaled
                 (incf replace-count)
               (setq replace-evaled content))
-            (overlay-put ov 'after-string
-                         (propertize replace-evaled 'face 
'anzu-replace-to))))))))
+            (overlay-put ov 'after-string (anzu--propertize-to-string 
replace-evaled))))))))
 
 (defun anzu--read-to-string (from prompt beg end use-regexp overlay-limit)
   (let ((curbuf (current-buffer))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]