[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-anzu 8c80e184f9 24/27: only activate evil-anzu when a
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-anzu 8c80e184f9 24/27: only activate evil-anzu when anzu-mode is active |
Date: |
Thu, 6 Jan 2022 03:59:32 -0500 (EST) |
branch: elpa/evil-anzu
commit 8c80e184f9905975f92021fd6d79a997b862e9a9
Author: CeleritasCelery <t.macman@gmail.com>
Commit: CeleritasCelery <t.macman@gmail.com>
only activate evil-anzu when anzu-mode is active
---
evil-anzu.el | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/evil-anzu.el b/evil-anzu.el
index 194e918049..da040e4d7d 100644
--- a/evil-anzu.el
+++ b/evil-anzu.el
@@ -28,30 +28,38 @@
(require 'evil)
(require 'anzu)
-(defadvice evil-search (after evil-anzu-compat (string forward &optional
regexp-p start) activate)
- (anzu--cons-mode-line-search)
- (let ((isearch-regexp regexp-p))
- (anzu--update string)))
+(defun evil-anzu-start-search (string forward &optional regexp-p start)
+ (when anzu-mode (anzu--cons-mode-line-search)
+ (let ((isearch-regexp regexp-p))
+ (anzu--update string))))
-(defadvice evil-ex-find-next (after evil-anzu-compat (&optional pattern
direction nowrap) activate)
+(defun evil-anzu-search-next (&optional pattern direction nowrap)
"Make anzu work with the 'evil-search search module.
If PATTERN is not specified the current global pattern
`evil-ex-search-pattern' is used."
- (anzu--cons-mode-line-search)
- (let* ((isearch-regexp t) ; all evil-ex searches are regexp searches
- (current-pattern (or pattern evil-ex-search-pattern))
- (regexp (evil-ex-pattern-regex current-pattern)))
- (save-match-data ; don't let anzu's searching mess up evil
- (anzu--update regexp))))
-
-(defadvice evil-flash-hook (after evil-anzu-compat activate)
+ (when anzu-mode
+ (anzu--cons-mode-line-search)
+ (let* ((isearch-regexp t) ; all evil-ex searches are regexp searches
+ (current-pattern (or pattern evil-ex-search-pattern))
+ (regexp (evil-ex-pattern-regex current-pattern)))
+ (save-match-data ; don't let anzu's searching mess up evil
+ (anzu--update regexp)))))
+
+(defun evil-anzu-prevent-flicker (&optional force)
;; Prevent flickering, only run if timer is not active
- (unless (memq evil-flash-timer timer-list)
- (anzu--reset-mode-line)))
+ (when anzu-mode
+ (unless (memq evil-flash-timer timer-list)
+ (anzu--reset-mode-line))))
-(defadvice evil-ex-delete-hl (after evil-anzu-compat (name) activate)
- (when (eq name 'evil-ex-search)
+(defun evil-anzu-reset (name)
+ (when (and anzu-mode
+ (eq name 'evil-ex-search))
(anzu--reset-mode-line)))
+(advice-add 'evil-search :after #'evil-anzu-start-search)
+(advice-add 'evil-ex-find-next :after #'evil-anzu-search-next)
+(advice-add 'evil-flash-hook :after #'evil-anzu-prevent-flicker)
+(advice-add 'evil-ex-delete-hl :after #'evil-anzu-reset)
+
(provide 'evil-anzu)
;;; evil-anzu.el ends here
- [nongnu] elpa/evil-anzu a71bb8aa0f 09/27: Create Changes, (continued)
- [nongnu] elpa/evil-anzu a71bb8aa0f 09/27: Create Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 35a636341a 10/27: Simplify implementation, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 886972d87a 12/27: Merge pull request #3 from fbergroth/simplify, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 5aa524dd2d 13/27: Bump up version and update Changes, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu faccb0e8c6 15/27: Merge pull request #5 from syohex/add-configuration-example, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 64cc08a354 18/27: Bump version, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 59d466f833 19/27: Correct typo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu d3f6ed4773 27/27: Reformat code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 565f79ae66 22/27: Update copyright year, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 9bca6ca14d 23/27: Update evil repository URL, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-anzu 8c80e184f9 24/27: only activate evil-anzu when anzu-mode is active,
ELPA Syncer <=