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

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

[nongnu] elpa/evil-goggles 12cfb80230 104/225: Use separate config, face


From: ELPA Syncer
Subject: [nongnu] elpa/evil-goggles 12cfb80230 104/225: Use separate config, face and advice for nerd-commenter and commentary. Refs #13
Date: Wed, 12 Jan 2022 08:59:00 -0500 (EST)

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

    Use separate config, face and advice for nerd-commenter and commentary. 
Refs #13
---
 README.md       |  5 ++++-
 evil-goggles.el | 22 +++++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 18b76019f1..2d66306df7 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,8 @@ evil-goggles
 #### evil plugins with hint
 
 - surround [evil-surround](https://github.com/timcharper/evil-surround)
-- comment [evil-commentary](https://github.com/linktohack/evil-commentary) and 
[evil-nerd-commenter](https://github.com/redguardtoo/evil-nerd-commenter)
+- commentary [evil-commentary](https://github.com/linktohack/evil-commentary)
+- nerd-commenter 
[evil-nerd-commenter](https://github.com/redguardtoo/evil-nerd-commenter)
 - replace with register 
[evil-ReplaceWithRegister](https://github.com/Dewdrops/evil-ReplaceWithRegister)
 
 ## Customizations
@@ -103,6 +104,7 @@ evil-goggles-paste-face
 evil-goggles-shift-face
 evil-goggles-surround-face
 evil-goggles-commentary-face
+evil-goggles-nerd-commenter-face
 evil-goggles-replace-with-register-face
 evil-goggles-set-marker-face
 evil-goggles-undo-redo-add-face
@@ -133,6 +135,7 @@ evil-goggles-undo-redo-change-face
 ;; evil-goggles-enable-shift
 ;; evil-goggles-enable-surround
 ;; evil-goggles-enable-commentary
+;; evil-goggles-enable-nerd-commenter
 ;; evil-goggles-enable-replace-with-register
 ;; evil-goggles-enable-set-marker
 ;; evil-goggles-enable-undo
diff --git a/evil-goggles.el b/evil-goggles.el
index d6fdd7a4b0..072c23d4be 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -516,6 +516,20 @@ BEG END &OPTIONAL TYPE are the arguments of the original 
function."
   (evil-goggles--with-goggles beg end 'evil-goggles-commentary-face
     (evil-goggles--funcall-preserve-interactive orig-fun beg end type)))
 
+;; nerd-commenter
+
+(evil-goggles--define-switch-and-face
+    evil-goggles-enable-nerd-commenter "If non-nil, enable nerd-commenter 
support"
+    evil-goggles-nerd-commenter-face "Face for nerd-commenter action")
+
+(defun evil-goggles--evil-nerd-commenter-advice (orig-fun beg end &optional 
type)
+  "Around-advice for function `evilnc-comment-operator'.
+
+ORIG-FUN is the original function.
+BEG END &OPTIONAL TYPE are the arguments of the original function."
+  (evil-goggles--with-goggles beg end 'evil-goggles-nerd-commenter-face
+    (evil-goggles--funcall-preserve-interactive orig-fun beg end type)))
+
 ;; replace with register
 
 (evil-goggles--define-switch-and-face
@@ -594,8 +608,10 @@ COUNT BEG &OPTIONAL END TYPE REGISTER are the arguments of 
the original function
       (advice-add 'evil-surround-region :around 
'evil-goggles--evil-surround-region-advice))
 
     (when evil-goggles-enable-commentary
-       (advice-add 'evil-commentary :around 
'evil-goggles--evil-commentary-advice)
-       (advice-add 'evilnc-comment-operator :around 
'evil-goggles--evil-commentary-advice))
+      (advice-add 'evil-commentary :around 
'evil-goggles--evil-commentary-advice))
+
+    (when evil-goggles-enable-nerd-commenter
+      (advice-add 'evilnc-comment-operator :around 
'evil-goggles--evil-nerd-commenter-advice))
 
     (when evil-goggles-enable-replace-with-register
       (advice-add 'evil-replace-with-register :around 
'evil-goggles--evil-replace-with-register-advice)))
@@ -619,7 +635,7 @@ COUNT BEG &OPTIONAL END TYPE REGISTER are the arguments of 
the original function
     ;; evil non-core functions
     (advice-remove 'evil-surround-region 
'evil-goggles--evil-surround-region-advice)
     (advice-remove 'evil-commentary 'evil-goggles--evil-commentary-advice)
-    (advice-remove 'evilnc-comment-operator 
'evil-goggles--evil-commentary-advice)
+    (advice-remove 'evilnc-comment-operator 
'evil-goggles--evil-nerd-commenter-advice)
     (advice-remove 'evil-replace-with-register 
'evil-goggles--evil-replace-with-register-advice))))
 
 (provide 'evil-goggles)



reply via email to

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