[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/anzu 2b88e1fcbc 021/288: Improve for not regexp search com
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/anzu 2b88e1fcbc 021/288: Improve for not regexp search commands |
Date: |
Thu, 6 Jan 2022 03:58:36 -0500 (EST) |
branch: elpa/anzu
commit 2b88e1fcbc6bc8fa6f8a3d6d99d0c0594a758e86
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Improve for not regexp search commands
anzu.el use regexp search for counting match until now.
From now anzu.el treat its input as not regular expression.
If user use non regexp search such as isearch-forward,
---
anzu.el | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/anzu.el b/anzu.el
index 6232b8acb4..069b3dc48d 100644
--- a/anzu.el
+++ b/anzu.el
@@ -61,6 +61,12 @@
:type 'function
:group 'anzu)
+(defcustom anzu-regexp-search-commands '(isearch-forward-regexp
+ isearch-backward-regexp)
+ "Search function which use regexp."
+ :type '(repeat function)
+ :group 'anzu)
+
(defface anzu-mode-line
'((t (:foreground "magenta" :weight bold)))
"face of anzu modeline"
@@ -70,6 +76,7 @@
(defvar anzu--current-posion 0)
(defvar anzu--last-isearch-string nil)
(defvar anzu--cached-positions nil)
+(defvar anzu--last-command nil)
(defun anzu--validate-regexp (regexp)
(condition-case err
@@ -79,6 +86,10 @@
(invalid-regexp nil)))
(defun anzu--search-all-position (str)
+ (unless anzu--last-command
+ (setq anzu--last-command last-command))
+ (unless (memq anzu--last-command anzu-regexp-search-commands)
+ (setq str (regexp-quote str)))
(when (anzu--validate-regexp str)
(save-excursion
(goto-char (point-min))
@@ -127,12 +138,13 @@
(setq mode-line-format (cons '(:eval (anzu--update-mode-line))
mode-line-format))))
-(defsubst anzu--reset-count ()
+(defsubst anzu--reset-status ()
(setq anzu--total-matched 0
- anzu--current-posion 0))
+ anzu--current-posion 0
+ anzu--last-command nil))
(defun anzu--reset-mode-line ()
- (anzu--reset-count)
+ (anzu--reset-status)
(when (and anzu-cons-mode-line-p (anzu--mode-line-not-set-p))
(setq mode-line-format (cdr mode-line-format))))
- [nongnu] elpa/anzu 06f4cf2fe7 037/288: Introduce anzu-minimum-input-length, (continued)
- [nongnu] elpa/anzu 06f4cf2fe7 037/288: Introduce anzu-minimum-input-length, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu e82b3d4236 069/288: Use delimiter regexp at anzu-query-replace-at-cursor, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b211f9a50f 067/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 4f024cd623 081/288: Clear last input cache after isearch command, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 3a7fcf2096 094/288: Merge pull request #14 from syohex/fix-increasing-anzuinfo-issue, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 537b8bfd36 071/288: Add autoload cookie, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 6b01763088 077/288: Improve replace regular expression, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu abd5953eac 018/288: Add Installation section, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 4cfbddbc07 020/288: Reset match count variables in isearch-mode-end-hook, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu de70e2fa4a 031/288: Enable mode unconditionally in examples, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 2b88e1fcbc 021/288: Improve for not regexp search commands,
ELPA Syncer <=
- [nongnu] elpa/anzu 5e6bad85d4 036/288: bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 169cf55674 044/288: Use previous result if regexp validation is failed, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu d256c967f3 052/288: Fix message in mode-line at replace command, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 413bd09ebc 079/288: Fix different behavior from query-replace-regexp, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu b310647932 085/288: Add separator parameter of 'to' string, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 047c5eee99 083/288: add anzu replace command screencast, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 630d663238 087/288: Fix invalid return type, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 9b772435ea 090/288: Support backward replace, ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 81b4eb6e29 093/288: Fix increasing anzu information in mode-line issue(#13), ELPA Syncer, 2022/01/06
- [nongnu] elpa/anzu 1ea6980019 106/288: Bump up version and update Changes, ELPA Syncer, 2022/01/06