[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/anzu ff54963946 232/288: Merge pull request #67 from syohe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/anzu ff54963946 232/288: Merge pull request #67 from syohex/refactoring |
Date: |
Thu, 6 Jan 2022 03:58:56 -0500 (EST) |
branch: elpa/anzu
commit ff54963946b12b3fe94b0deed4c6e695ef9be4dd
Merge: 09cc87ad9b 1e5c3ca0b7
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Merge pull request #67 from syohex/refactoring
Refactoring code
---
anzu.el | 78 +++++++++++++++++++++++------------------------------------------
1 file changed, 28 insertions(+), 50 deletions(-)
diff --git a/anzu.el b/anzu.el
index 6b6641f84e..444734b709 100644
--- a/anzu.el
+++ b/anzu.el
@@ -47,76 +47,62 @@
(defcustom anzu-mode-lighter " Anzu"
"Lighter of anzu-mode"
- :type 'string
- :group 'anzu)
+ :type 'string)
(defcustom anzu-cons-mode-line-p t
"Set nil if you use your own mode-line setting"
- :type 'boolean
- :group 'anzu)
+ :type 'boolean)
(defcustom anzu-minimum-input-length 1
"Minimum input length to enable anzu"
- :type 'integer
- :group 'anzu)
+ :type 'integer)
(defcustom anzu-search-threshold nil
"Limit of search number"
:type '(choice (integer :tag "Threshold of search")
- (boolean :tag "No threshold" nil))
- :group 'anzu)
+ (boolean :tag "No threshold" nil)))
(defcustom anzu-replace-threshold nil
"Limit of replacement overlays."
:type '(choice (integer :tag "Threshold of replacement overlays")
- (boolean :tag "No threshold" nil))
- :group 'anzu)
+ (boolean :tag "No threshold" nil)))
(defcustom anzu-use-migemo nil
"Flag of using migemo"
- :type 'boolean
- :group 'anzu)
+ :type 'boolean)
-(defcustom anzu-mode-line-update-function nil
+(defcustom anzu-mode-line-update-function #'anzu--update-mode-line-default
"Function which return mode-line string"
- :type 'function
- :group 'anzu)
+ :type 'function)
(defcustom anzu-regexp-search-commands '(isearch-forward-regexp
isearch-backward-regexp)
"Search function which use regexp."
- :type '(repeat function)
- :group 'anzu)
+ :type '(repeat function))
(defcustom anzu-input-idle-delay 0.05
"Idle second for updating modeline at replace commands"
- :type 'number
- :group 'anzu)
+ :type 'number)
(defcustom anzu-deactivate-region nil
"Deactive region if you use anzu a replace command with region"
- :type 'boolean
- :group 'anzu)
+ :type 'boolean)
(defcustom anzu-replace-at-cursor-thing 'defun
"Replace thing. This parameter is same as `thing-at-point'"
- :type 'symbol
- :group 'anzu)
+ :type 'symbol)
(defcustom anzu-replace-to-string-separator ""
"Separator of `to' string"
- :type 'string
- :group 'anzu)
+ :type 'string)
(defface anzu-mode-line
'((t (:foreground "magenta" :weight bold)))
- "face of anzu modeline"
- :group 'anzu)
+ "face of anzu modeline")
(defface anzu-replace-highlight
'((t :inherit query-replace))
- "highlight of replaced string"
- :group 'anzu)
+ "highlight of replaced string")
(defface anzu-match-1
'((((class color) (background light))
@@ -124,8 +110,7 @@
(((class color) (background dark))
:background "limegreen" :foreground "black")
(t :inverse-video t))
- "First group of match."
- :group 'anzu)
+ "First group of match.")
(defface anzu-match-2
'((((class color) (background light))
@@ -133,8 +118,7 @@
(((class color) (background dark))
:background "yellow" :foreground "black")
(t :inverse-video t))
- "Second group of match."
- :group 'anzu)
+ "Second group of match.")
(defface anzu-match-3
'((((class color) (background light))
@@ -142,16 +126,14 @@
(((class color) (background dark))
:background "aquamarine" :foreground "black")
(t :inverse-video t))
- "Third group of match."
- :group 'anzu)
+ "Third group of match.")
(defface anzu-replace-to
'((((class color) (background light))
:foreground "red")
(((class color) (background dark))
:foreground "yellow"))
- "highlight of replace string"
- :group 'anzu)
+ "highlight of replace string")
(defvar anzu--total-matched 0)
(defvar anzu--current-position 0)
@@ -215,7 +197,7 @@
(lambda (word &optional bound noerror count)
(ignore-errors
(migemo-forward word bound noerror count)))
- 're-search-forward))
+ #'re-search-forward))
(case-fold-search (anzu--case-fold-search input)))
(while (and (not finish) (funcall search-func input nil t))
(push (cons (match-beginning 0) (match-end 0)) positions)
@@ -301,14 +283,11 @@
(propertize status 'face 'anzu-mode-line))))
(defun anzu--update-mode-line ()
- (let ((update-func (or anzu-mode-line-update-function
- 'anzu--update-mode-line-default)))
- (funcall update-func anzu--current-position anzu--total-matched)))
+ (funcall anzu-mode-line-update-function anzu--current-position
anzu--total-matched))
;;;###autoload
(define-minor-mode anzu-mode
"minor-mode which display search information in mode-line."
- :group 'anzu
:init-value nil
:global nil
:lighter anzu-mode-lighter
@@ -328,8 +307,7 @@
(anzu-mode +1)))
;;;###autoload
-(define-globalized-minor-mode global-anzu-mode anzu-mode anzu--turn-on
- :group 'anzu)
+(define-globalized-minor-mode global-anzu-mode anzu-mode anzu--turn-on)
(defsubst anzu--query-prompt-base (use-region use-regexp)
(concat "Query replace"
@@ -416,7 +394,7 @@
overlayed))))))
(defun anzu--search-outside-visible (buf input beg end use-regexp)
- (let ((searchfn (if use-regexp 're-search-forward 'search-forward)))
+ (let ((searchfn (if use-regexp #'re-search-forward #'search-forward)))
(when (or (not use-regexp) (anzu--validate-regexp input))
(with-selected-window (get-buffer-window buf)
(goto-char beg)
@@ -729,7 +707,7 @@
(save-excursion
(goto-char beg)
(cl-loop with curbuf = (current-buffer)
- with search-func = (if use-regexp 're-search-forward
'search-forward)
+ with search-func = (if use-regexp #'re-search-forward
#'search-forward)
while (funcall search-func from end t)
do
(progn
@@ -776,10 +754,10 @@
clear-overlay t)
(let ((case-fold-search (not at-cursor)))
(if use-regexp
- (apply 'perform-replace
(anzu--construct-perform-replace-arguments
- from to delimited beg end backward
query))
- (apply 'query-replace (anzu--construct-query-replace-arguments
- from to delimited beg end backward)))))
+ (apply #'perform-replace
(anzu--construct-perform-replace-arguments
+ from to delimited beg end backward
query))
+ (apply #'query-replace (anzu--construct-query-replace-arguments
+ from to delimited beg end backward)))))
(progn
(unless clear-overlay
(anzu--clear-overlays curbuf beg end))
- [nongnu] elpa/anzu f29278e5bd 218/288: Silence byte-compiler, (continued)
- [nongnu] elpa/anzu f29278e5bd 218/288: Silence byte-compiler, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 31f70860ef 220/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 5684b4b601 199/288: Check replaced regexp is valid, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 3e34fb3df5 279/288: update anzu--use-result-cache-p as in PR #93, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 494f1d9d39 195/288: Support highlighting match groups, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 12612a2b4f 202/288: Update document of custom function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 27e3a89622 203/288: Correct misspellings, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b80dc0ca92 210/288: Merge pull request #59 from syohex/buffer-local-status, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu a08ff2f7db 215/288: Wrap migemo-forward with ignore-errors, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu f2aad769c1 227/288: Update copyright year, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu ff54963946 232/288: Merge pull request #67 from syohex/refactoring,
ELPA Syncer <=
- [nongnu] elpa/anzu 116501bf9e 216/288: Merge pull request #62 from syohex/fix-migemo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu a35649e401 017/288: Update document, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 84183d2a79 022/288: update document, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu f4618cd335 023/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu cc427254a0 040/288: Introduce search threshold, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 591b27621c 047/288: Merge pull request #11 from syohex/support-query-replace, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 1fc36f460c 046/288: Implement anzu-query-regexp and anzu-query-regexp, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu cdee5811bb 048/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 28953f86f9 051/288: bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 2bcd549c5a 054/288: Re-factoring: reduce global variables, ELPA Syncer, 2022/01/06