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

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

[nongnu] elpa/evil-goggles c5c49d7965 127/225: Use different duration fo


From: ELPA Syncer
Subject: [nongnu] elpa/evil-goggles c5c49d7965 127/225: Use different duration for before/after hints
Date: Wed, 12 Jan 2022 08:59:02 -0500 (EST)

branch: elpa/evil-goggles
commit c5c49d7965ccdf02ef8474f9eeb3b1d545b832bb
Author: Evgeni Kolev <evgenysw@gmail.com>
Commit: Evgeni Kolev <evgenysw@gmail.com>

    Use different duration for before/after hints
---
 evil-goggles.el | 58 +++++++++++++++++++++++++++++++--------------------------
 1 file changed, 32 insertions(+), 26 deletions(-)

diff --git a/evil-goggles.el b/evil-goggles.el
index 6646a6874b..d110c304b8 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -48,7 +48,7 @@ as when deleting. "
   :group 'evil-goggles)
 
 ;; TODO better name
-(defcustom evil-goggles-duration2 0.800
+(defcustom evil-goggles-duration2 0.400
   "Time in floating seconds that the goggles overlay should last.
 
 This affects the hints which are displayed before the operation"
@@ -206,7 +206,7 @@ displayed while its running."
 (defmacro evil-goggles--with-after-goggles2 (beg end face dur &rest body)
   (declare (indent 4) (debug t))
   `(evil-goggles--with-hint-on ,beg ,end (progn ,@body)
-     (evil-goggles--show-overlay ,beg ,end ,face ,dur
+     (evil-goggles--show-overlay ,beg ,end ,face (or ,dur 
evil-goggles-duration2)
        ,@body)))
 
 (defun evil-goggles--show-or-pulse-overlay (ov face dur)
@@ -230,8 +230,8 @@ displayed while its running."
   (declare (indent 4) (debug t))
   `(evil-goggles--with-hint-on ,beg ,end (progn ,@body)
      (if (eq evil-this-type 'block)
-         (evil-goggles--show-block-overlay ,beg ,end ,face ,dur)
-       (evil-goggles--show-overlay ,beg ,end ,face ,dur))
+         (evil-goggles--show-block-overlay ,beg ,end ,face (or ,dur 
evil-goggles-duration))
+       (evil-goggles--show-overlay ,beg ,end ,face (or ,dur 
evil-goggles-duration)))
      ,@body))
 
 (defmacro evil-goggles--show-overlay (beg end face dur &rest body)
@@ -283,7 +283,7 @@ so this package can work with Emacs 24"
        (evil-goggles--funcall-interactively ,fun ,@args)
      (funcall ,fun ,@args)))
 
-(defmacro evil-goggles--define-switch-face-duration (switch-name switch-doc 
face-name face-doc dur-name dur-value dur-doc)
+(defmacro evil-goggles--define-switch-face-duration (switch-name switch-doc 
face-name face-doc dur-name dur-doc)
   "Syntax sugar for defining a custom on/off variable and a custom face.
 
 SWITCH-NAME is the name of the on/off variable.
@@ -300,7 +300,7 @@ FACE-DOC is the docstring for FACE-NAME."
        '((t (:inherit evil-goggles-default-face)))
        ,face-doc
        :group 'evil-goggles-faces)
-     (defcustom ,dur-name ,dur-value
+     (defcustom ,dur-name nil
        ,(concat dur-doc "\nThis variable must be set before 
`evil-goggles-mode' is enabled")
        :type 'number
        :group 'evil-goggles)))
@@ -336,7 +336,7 @@ FACE-DOC is the docstring for FACE-NAME."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-delete "If non-nil, enable delete support"
     evil-goggles-delete-face "Face for delete action"
-    evil-goggles-delete-duration evil-goggles-duration "Duration of hint when 
deleting")
+    evil-goggles-delete-duration "Duration of hint when deleting")
 
 (defun evil-goggles--evil-delete-advice (orig-fun beg end &optional type 
register yank-handler)
   "Around-advice for function `evil-delete`.
@@ -351,7 +351,7 @@ BEG END &OPTIONAL TYPE REGISTER YANK-HANDLER are the 
arguments of the original f
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-indent "If non-nil, enable indent support"
     evil-goggles-indent-face "Face for indent action"
-    evil-goggles-indent-duration evil-goggles-duration "Duration of hint when 
indenting")
+    evil-goggles-indent-duration "Duration of hint when indenting")
 
 (defun evil-goggles--evil-indent-advice (orig-fun beg end)
   "Around-advice for function `evil-indent'.
@@ -366,7 +366,7 @@ BEG END are the arguments of the original function."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-yank "If non-nil, enable yank support"
     evil-goggles-yank-face "Face for yank action"
-    evil-goggles-yank-duration evil-goggles-duration "Duration of hint when 
yankig")
+    evil-goggles-yank-duration "Duration of hint when yankig")
 
 (defun evil-goggles--evil-yank-advice (orig-fun beg end &optional type 
register yank-handler)
   "Around-advice for function `evil-yank'.
@@ -388,14 +388,20 @@ This variable must be set before `evil-goggles-mode' is 
enabled"
 This variable must be set before `evil-goggles-mode' is enabled"
   :type 'boolean :group 'evil-goggles)
 
-(defcustom evil-goggles-undo-redo-add-duration evil-goggles-duration "Duration 
of hint on undo/redo adding
-This variable must be set before `evil-goggles-mode' is enabled" :type 'number 
:group 'evil-goggles)
+(defcustom evil-goggles-undo-redo-add-duration evil-goggles-duration
+  "Duration of hint on undo/redo adding.
+This variable must be set before `evil-goggles-mode' is enabled"
+  :type 'number :group 'evil-goggles)
 
-(defcustom evil-goggles-undo-redo-remove-duration evil-goggles-duration 
"Duration of hint on undo/redo removing
-This variable must be set before `evil-goggles-mode' is enabled" :type 'number 
:group 'evil-goggles)
+(defcustom evil-goggles-undo-redo-remove-duration evil-goggles-duration
+  "Duration of hint on undo/redo removing.
+This variable must be set before `evil-goggles-mode' is enabled"
+  :type 'number :group 'evil-goggles)
 
-(defcustom evil-goggles-undo-redo-change-duration evil-goggles-duration 
"Duration of hint on undo/redo changing
-This variable must be set before `evil-goggles-mode' is enabled" :type 'number 
:group 'evil-goggles)
+(defcustom evil-goggles-undo-redo-change-duration evil-goggles-duration
+  "Duration of hint on undo/redo changing
+This variable must be set before `evil-goggles-mode' is enabled"
+  :type 'number :group 'evil-goggles)
 
 (defface evil-goggles-undo-redo-add-face
   '((t
@@ -515,7 +521,7 @@ Return a list: either ('text-added beg end) or 
('text-removed beg end)"
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-join "If non-nil, enable join support"
     evil-goggles-join-face "Face for join action"
-    evil-goggles-join-duration evil-goggles-duration "Duration of hint when 
joining")
+    evil-goggles-join-duration "Duration of hint when joining")
 
 (defun evil-goggles--evil-join-advice (orig-fun beg end)
   "Around-advice for function `evil-join'.
@@ -535,7 +541,7 @@ BEG END are the arguments of the original function."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-fill-and-move "If non-nil, enable fill and move 
(reformat) support"
     evil-goggles-fill-and-move-face "Face for fill and move (reformat) action"
-    evil-goggles-fill-and-move-duration evil-goggles-duration "Duration of 
hint when reformating")
+    evil-goggles-fill-and-move-duration "Duration of hint when reformating")
 
 (defun evil-goggles--evil-fill-and-move-advice (orig-fun beg end)
   "Around-advice for function `evil-fill-and-move'.
@@ -550,7 +556,7 @@ BEG END are arguments of the original function."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-paste "If non-nil, enable paste support"
     evil-goggles-paste-face "Face for paste action"
-    evil-goggles-paste-duration evil-goggles-duration "Duration of hint when 
pasting")
+    evil-goggles-paste-duration "Duration of hint when pasting")
 
 (defun evil-goggles--evil-paste-after-advice (orig-fun count &optional 
register yank-handler)
   "Around-advice for function `evil-paste-after'.
@@ -587,7 +593,7 @@ Argument YANK-HANDLER is the yank hanler."
            (beg-corrected (if is-beg-at-eol (1+ beg) beg)))
       (if (evil-goggles--evil-paste-block-p register yank-handler)
           (evil-goggles--show-block-overlay beg-corrected end 
'evil-goggles-paste-face evil-goggles-paste-duration)
-        (evil-goggles--show-overlay beg-corrected end 'evil-goggles-paste-face 
evil-goggles-paste-duration)))))
+        (evil-goggles--show-overlay beg-corrected end 'evil-goggles-paste-face 
(or evil-goggles-paste-duration evil-goggles-duration))))))
 
 (defun evil-goggles--evil-paste-block-p (register yank-handler)
   "Return t if the paste was a vertical block.
@@ -608,7 +614,7 @@ Argument YANK-HANDLER is the yank hanler."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-shift "If non-nil, enable shift left/right support"
     evil-goggles-shift-face "Face for paste action"
-    evil-goggles-shift-duration evil-goggles-duration "Duration of hint when 
shifting")
+    evil-goggles-shift-duration "Duration of hint when shifting")
 
 (defun evil-goggles--evil-shift-advice (orig-fun beg end &optional count 
preserve-empty)
   "Around-advice for function `evil-shift-left` and `evil-shift-right`.
@@ -623,7 +629,7 @@ BEG END &OPTIONAL COUNT PRESERVE-EMPTY are the arguments of 
the original functio
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-set-marker "If non-nil, enable set mark support"
     evil-goggles-set-marker-face "Face for set mark action"
-    evil-goggles-set-marker-duration evil-goggles-duration "Duration of hint 
when setting mark")
+    evil-goggles-set-marker-duration "Duration of hint when setting mark")
 
 (defun evil-goggles--evil-set-marker-advice (orig-fun char &optional pos 
advance)
   "Around-advice for function `evil-set-marker`.
@@ -643,7 +649,7 @@ CHAR POS ADVANCE are the arguments of the original 
function."
             (end (1+ (save-excursion
                        (move-end-of-line nil)
                        (point)))))
-        (evil-goggles--show-overlay beg end 'evil-goggles-set-marker-face 
evil-goggles-set-marker-duration)))))
+        (evil-goggles--show-overlay beg end 'evil-goggles-set-marker-face (or 
evil-goggles-set-marker-duration evil-goggles-duration))))))
 
 ;; ex global
 
@@ -660,7 +666,7 @@ BEG END PATTERN COMMAND &OPTIONAL INVERT are the arguments 
of the original funct
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-surround "If non-nil, enable surround support"
     evil-goggles-surround-face "Face for surround action"
-    evil-goggles-surround-duration evil-goggles-duration "Duration of hint 
when surrounding")
+    evil-goggles-surround-duration "Duration of hint when surrounding")
 
 (defun evil-goggles--evil-surround-region-advice (orig-fun beg end &optional 
type char force-new-line)
   "Around-advice for function `evil-surround-region'.
@@ -675,7 +681,7 @@ BEG END &OPTIONAL TYPE CHAR FORCE-NEW-LINE are the 
arguments of the original fun
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-commentary "If non-nil, enable commentary support"
     evil-goggles-commentary-face "Face for commentary action"
-    evil-goggles-commentary-duration evil-goggles-duration "Duration when 
using commentary")
+    evil-goggles-commentary-duration "Duration when using commentary")
 
 (defun evil-goggles--evil-commentary-advice (orig-fun beg end &optional type)
   "Around-advice for function `evil-commentary'.
@@ -690,7 +696,7 @@ BEG END &OPTIONAL TYPE are the arguments of the original 
function."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-nerd-commenter "If non-nil, enable nerd-commenter 
support"
     evil-goggles-nerd-commenter-face "Face for nerd-commenter action"
-    evil-goggles-nerd-commenter-duration evil-goggles-duration "Duration when 
using nerd-commenter")
+    evil-goggles-nerd-commenter-duration "Duration when using nerd-commenter")
 
 (defun evil-goggles--evil-nerd-commenter-advice (orig-fun beg end &optional 
type)
   "Around-advice for function `evilnc-comment-operator'.
@@ -705,7 +711,7 @@ BEG END &OPTIONAL TYPE are the arguments of the original 
function."
 (evil-goggles--define-switch-face-duration
     evil-goggles-enable-replace-with-register "If non-nil, enable replace with 
register support"
     evil-goggles-replace-with-register-face "Face for replace with register 
action"
-    evil-goggles-replace-with-register-duration evil-goggles-duration 
"Duration when using replace-with-register")
+    evil-goggles-replace-with-register-duration "Duration when using 
replace-with-register")
 
 (defun evil-goggles--evil-replace-with-register-advice (orig-fun count beg 
&optional end type register)
   "Around-advice for function `evil-replace-with-register'.



reply via email to

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