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

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

[nongnu] elpa/evil-anzu 886972d87a 12/27: Merge pull request #3 from fbe


From: ELPA Syncer
Subject: [nongnu] elpa/evil-anzu 886972d87a 12/27: Merge pull request #3 from fbergroth/simplify
Date: Thu, 6 Jan 2022 03:59:30 -0500 (EST)

branch: elpa/evil-anzu
commit 886972d87a94c45895a74552642784c100f8056e
Merge: a71bb8aa0f 47624e12ca
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    Merge pull request #3 from fbergroth/simplify
    
    Simplify implementation
---
 README.md    |  7 -----
 evil-anzu.el | 85 ++++++------------------------------------------------------
 2 files changed, 8 insertions(+), 84 deletions(-)

diff --git a/README.md b/README.md
index e4e2a407eb..28043c0014 100644
--- a/README.md
+++ b/README.md
@@ -11,13 +11,6 @@
 
 You can install evil-anzu.el from [MELPA](http://melpa.org) with package.el.
 
-## Configuration
-
-```lisp
-(define-key evil-motion-state-map "n" 'evil-anzu-search-next)
-(define-key evil-motion-state-map "N" 'evil-anzu-search-previous)
-```
-
 [melpa-link]: http://melpa.org/#/evil-anzu
 [melpa-stable-link]: http://melpa.org/#/evil-anzu
 [melpa-badge]: http://melpa.org/packages/evil-anzu-badge.svg
diff --git a/evil-anzu.el b/evil-anzu.el
index 7273949eed..9f3ac9edea 100644
--- a/evil-anzu.el
+++ b/evil-anzu.el
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2015 by Syohei YOSHIDA
 
 ;; Author: Syohei YOSHIDA <syohex@gmail.com>
+;;         Fredrik Bergroth <fbergroth@gmail.com>
 ;; URL: https://github.com/syohex/emacs-evil-anzu
 ;; Version: 0.01
 ;; Package-Requires: ((evil "1.0.0") (anzu "0.46"))
@@ -27,86 +28,16 @@
 (require 'evil)
 (require 'anzu)
 
-(defgroup evil-anzu nil
-  "anzu for evil-mode"
-  :group '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)))
 
-(defvar evil-anzu--displayed nil)
-
-(defconst evil-anzu--search-commands
-  '(evil-anzu-search-next evil-anzu-search-previous))
-
-(defun evil-anzu--update ()
-  (anzu--cons-mode-line 'search)
-  (let ((query (if evil-regexp-search
-                   (car-safe regexp-search-ring)
-                 (car-safe search-ring))))
-    (anzu--update query))
-  (setq evil-anzu--displayed t))
-
-(evil-define-motion evil-anzu-search-next (count)
-  "Repeat the last search."
-  :jump t
-  :type exclusive
-  (dotimes (var (or count 1))
-    (evil-search (if evil-regexp-search
-                     (car-safe regexp-search-ring)
-                   (car-safe search-ring))
-                 isearch-forward evil-regexp-search))
-  (evil-anzu--update))
-
-(evil-define-motion evil-anzu-search-previous (count)
-  "Repeat the last search in the opposite direction."
-  :jump t
-  :type exclusive
-  (dotimes (var (or count 1))
-    (evil-search (if evil-regexp-search
-                     (car-safe regexp-search-ring)
-                   (car-safe search-ring))
-                 (not isearch-forward) evil-regexp-search))
-  (evil-anzu--update))
-
-(defun evil-anzu--pre-command-hook ()
-  (when (and evil-anzu--displayed (not (memq this-command 
evil-anzu--search-commands)))
-    (anzu--reset-mode-line)
-    (setq evil-anzu--displayed nil)))
-
-(defun evil-anzu--reset-mode-line ()
-  (when (and anzu-cons-mode-line-p (anzu--mode-line-not-set-p))
-    (setq mode-line-format (delete anzu--mode-line-format mode-line-format))))
-
-(define-minor-mode evil-anzu-mode
-  "anzu for evil-mode."
-  :group      'evil-anzu
-  :init-value nil
-  :global     nil
-  :lighter    anzu-mode-lighter
-  (if evil-anzu-mode
-      (progn
-        (add-hook 'isearch-update-post-hook 'anzu--update-post-hook nil t)
-        (add-hook 'isearch-mode-hook 'anzu--cons-mode-line-search nil t)
-        (add-hook 'isearch-mode-end-hook 'evil-anzu--reset-mode-line nil t)
-        (add-hook 'pre-command-hook 'evil-anzu--pre-command-hook nil t))
-    (remove-hook 'isearch-update-post-hook 'anzu--update-post-hook t)
-    (remove-hook 'isearch-mode-hook 'anzu--cons-mode-line t)
-    (remove-hook 'isearch-mode-end-hook 'anzu--reset-mode-line t)
-    (remove-hook 'pre-command-hook 'evil-anzu--pre-command-hook t)
+(defadvice evil-flash-hook (after evil-anzu-compat activate)
+  ;; Prevent flickering, only run if timer is not active
+  (unless (memq evil-flash-timer timer-list)
     (anzu--reset-mode-line)))
 
-(defun evil-anzu--turn-on ()
-  (unless (minibufferp)
-    (evil-anzu-mode +1)))
-
-;;;###autoload
-(define-globalized-minor-mode global-evil-anzu-mode evil-anzu-mode 
evil-anzu--turn-on
-  :group 'evil-anzu)
-
-(defadvice evil-flash-hook (after reset-anzu-information activate)
-  (anzu--reset-status))
-
-(defadvice evil-search (before reset-anzu-information activate)
-  (anzu--reset-status))
-
 (provide 'evil-anzu)
 
 ;;; evil-anzu.el ends here



reply via email to

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