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

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

[nongnu] elpa/evil-goggles ca18c944ed 179/225: Show hint on start/stop r


From: ELPA Syncer
Subject: [nongnu] elpa/evil-goggles ca18c944ed 179/225: Show hint on start/stop record macro
Date: Wed, 12 Jan 2022 08:59:06 -0500 (EST)

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

    Show hint on start/stop record macro
---
 Makefile        |  3 +--
 README.md       |  5 ++++-
 evil-goggles.el | 31 +++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index ace68659d1..4d25017409 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,7 @@
 emacs ?= emacs
 bemacs = $(emacs) -batch -l test/elpa.el
 
-all:
-       compile
+all: compile
 
 update:
        $(emacs) -batch -l test/make-update.el
diff --git a/README.md b/README.md
index 5774a97483..541767c504 100644
--- a/README.md
+++ b/README.md
@@ -122,6 +122,7 @@ evil-goggles-set-marker-face
 evil-goggles-undo-redo-add-face
 evil-goggles-undo-redo-remove-face
 evil-goggles-undo-redo-change-face
+evil-goggles-record-macro-face
 ```
 
 #### Other Customizations
@@ -166,9 +167,10 @@ evil-goggles-undo-redo-change-face
 ;; evil-goggles-enable-set-marker
 ;; evil-goggles-enable-undo
 ;; evil-goggles-enable-redo
+;; evil-goggles-enable-record-macro
 ```
 
-## Recent Significant Changes
+## NEWS - Recent Significant Changes
 
 - [May 28, 2017] Switched to using custom faces per action, deprecated 
`evil-goggles-faces-alist`
 - [May 28, 2017] Switched to using per-action on/off custom variables, 
deprecated `evil-goggles-blacklist`
@@ -178,3 +180,4 @@ evil-goggles-undo-redo-change-face
 - [Sep 17, 2017] Add experimental support for pulsing hints (no longer 
experimental since Dec 02, 2017)
 - [Nov 03, 2017] Add options `evil-goggles-async-duration` and 
`evil-goggles-blocking-duration`
 - [Dec 02, 2017] Pulsing hints is no longer experimental
+- [Feb 05, 2018] Show hint on start/stop macro recording
diff --git a/evil-goggles.el b/evil-goggles.el
index 9671cc800a..4ecc57ddae 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -657,6 +657,33 @@ CHAR POS ADVANCE are the arguments of the original 
function."
           (evil-goggles--hint-on-empty-lines t))
       (evil-goggles--with-async-hint beg end 'evil-goggles-set-marker-face))))
 
+;;; record macro
+
+(evil-goggles--define-switch-and-face
+    evil-goggles-enable-record-macro "If non-nil, enable record macro support"
+    evil-goggles-record-macro-face "Face for record macro action")
+
+(defun evil-goggles--evil-record-macro-advice (orig-fun register)
+  "Around-advice for function `evil-record-macro'.
+
+ORIG-FUN is the original function.
+REGISTER is the argument of the original function."
+  (let ((beg (line-beginning-position))
+        (end (1+ (line-end-position)))
+        (was-defining-kbd-macro defining-kbd-macro)
+        (evil-goggles--hint-on-empty-lines t))
+
+    ;; show hint before starting to record a macro
+    (unless was-defining-kbd-macro
+      (evil-goggles--show-hint beg end 'evil-goggles-record-macro-face))
+
+    (evil-goggles--funcall-preserve-interactive orig-fun register)
+
+    ;; show hint when done defining the macro
+    (when was-defining-kbd-macro
+      (evil-goggles--show-hint beg end 'evil-goggles-record-macro-face))))
+
+
 ;;; ex global
 
 (defun evil-goggles--evil-ex-global-advice (orig-fun beg end pattern command 
&optional invert)
@@ -774,6 +801,9 @@ COUNT BEG &OPTIONAL END TYPE REGISTER are the arguments of 
the original function
     (when evil-goggles-enable-set-marker
       (advice-add 'evil-set-marker :around 
'evil-goggles--evil-set-marker-advice))
 
+    (when evil-goggles-enable-record-macro
+      (advice-add 'evil-record-macro :around 
'evil-goggles--evil-record-macro-advice))
+
     ;; make sure :global and :v don't show the goggles overlay
     (advice-add 'evil-ex-global :around 'evil-goggles--evil-ex-global-advice)
 
@@ -804,6 +834,7 @@ COUNT BEG &OPTIONAL END TYPE REGISTER are the arguments of 
the original function
     (advice-remove 'evil-shift-left 'evil-goggles--evil-shift-advice)
     (advice-remove 'evil-shift-right 'evil-goggles--evil-shift-advice)
     (advice-remove 'evil-set-marker 'evil-goggles--evil-set-marker-advice)
+    (advice-remove 'evil-record-macro 'evil-goggles--evil-record-macro-advice)
 
     (advice-remove 'evil-ex-global 'evil-goggles--evil-ex-global-advice)
 



reply via email to

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