[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-goggles ae77a5c6f0 067/225: Replace the boilerplate i
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-goggles ae77a5c6f0 067/225: Replace the boilerplate in evil-goggles-faces.el with a macro |
Date: |
Wed, 12 Jan 2022 08:58:44 -0500 (EST) |
branch: elpa/evil-goggles
commit ae77a5c6f0755d70f56826da378f414fbb49ac9b
Author: Evgeni Kolev <evgenysw@gmail.com>
Commit: Evgeni Kolev <evgenysw@gmail.com>
Replace the boilerplate in evil-goggles-faces.el with a macro
---
evil-goggles-faces.el | 56 -------------------------------
evil-goggles.el | 93 ++++++++++++++++++++++++++++-----------------------
test/make-compile.el | 2 +-
3 files changed, 53 insertions(+), 98 deletions(-)
diff --git a/evil-goggles-faces.el b/evil-goggles-faces.el
deleted file mode 100644
index 12b9ffa121..0000000000
--- a/evil-goggles-faces.el
+++ /dev/null
@@ -1,56 +0,0 @@
-
-;; evil core
-
-(defface evil-goggles-delete-face
- '((t (:inherit region)))
- "Face for delete action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-indent-face
- '((t (:inherit region)))
- "Face for indent action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-yank-face
- '((t (:inherit region)))
- "Face for yank action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-join-face
- '((t (:inherit region)))
- "Face for join action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-fill-and-move-face
- '((t (:inherit region)))
- "Face for fill and move (reformat) action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-paste-face
- '((t (:inherit region)))
- "Face for paste action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-shift-face
- '((t (:inherit region)))
- "Face for paste action"
- :group 'evil-goggles-faces)
-
-;; non-core
-
-(defface evil-goggles-surround-face
- '((t (:inherit region)))
- "Face for surround action"
- :group 'evil-goggles-faces)
-
-(defface evil-goggles-commentary-face
- '((t (:inherit region)))
- "Face for commentary action"
- :group 'evil-goggles-sur)
-
-(defface evil-goggles-replace-with-register-face
- '((t (:inherit region)))
- "Face for replace with register action"
- :group 'evil-goggles-sur)
-
-(provide 'evil-goggles-faces)
diff --git a/evil-goggles.el b/evil-goggles.el
index 455ce1eded..fd1610faae 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -37,7 +37,6 @@
;;; Code:
(require 'evil)
-(require 'evil-goggles-faces)
(defcustom evil-goggles-duration 0.200
"Time if floating seconds that the goggles overlay should last."
@@ -125,14 +124,31 @@ displayed while its running."
(funcall-interactively ,fun ,@args)
(funcall ,fun ,@args)))
+(defmacro evil-goggles--define-switch-and-face (switch-name switch-doc
face-name face-doc)
+ "Syntax sugar for defining a custom on/off variable and a custom face.
+
+SWITCH-NAME is the name of the on/off variable.
+SWITCH-DOC is the docstring for SWITCH-NAME.
+FACE-NAME is the name of the custom face.
+FACE-DOC is the docstring for FACE-NAME."
+ (declare (indent 4) (debug t))
+ `(progn
+ (defcustom ,switch-name t
+ ,switch-doc
+ :type 'boolean
+ :group 'evil-goggles)
+ (defface ,face-name
+ '((t (:inherit region)))
+ ,face-doc
+ :group 'evil-goggles-faces)))
+
;;; core ends here ;;;
;; delete
-(defcustom evil-goggles-enable-delete t
- "If non-nil, enable delete support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-delete "If non-nil, enable delete support"
+ evil-goggles-delete-face "Face for delete action")
(defun evil-goggles--evil-delete-advice (orig-fun beg end &optional type
register yank-handler)
"Around-advice for function `evil-delete`.
@@ -144,10 +160,9 @@ BEG END &OPTIONAL TYPE REGISTER YANK-HANDLER are the
arguments of the original f
;; indent
-(defcustom evil-goggles-enable-indent t
- "If non-nil, enable indent support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-indent "If non-nil, enable indent support"
+ evil-goggles-indent-face "Face for indent action")
(defun evil-goggles--evil-indent-advice (orig-fun beg end)
"Around-advice for function `evil-indent'.
@@ -159,10 +174,9 @@ BEG END are the arguments of the original function."
;; yank
-(defcustom evil-goggles-enable-yank t
- "If non-nil, enable yank support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-yank "If non-nil, enable yank support"
+ evil-goggles-yank-face "Face for yank action")
(defun evil-goggles--evil-yank-advice (orig-fun beg end &optional type
register yank-handler)
"Around-advice for function `evil-yank'.
@@ -174,10 +188,9 @@ BEG END &OPTIONAL TYPE REGISTER YANK-HANDLER are the
arguments of the original f
;; join
-(defcustom evil-goggles-enable-join t
- "If non-nil, enable join support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-join "If non-nil, enable join support"
+ evil-goggles-join-face "Face for join action")
(defun evil-goggles--evil-join-advice (orig-fun beg end)
"Around-advice for function `evil-join'.
@@ -192,10 +205,11 @@ BEG END are the arguments of the original function."
(evil-goggles--funcall-preserve-interactive orig-fun beg end))
(evil-goggles--funcall-preserve-interactive orig-fun beg end))))
-(defcustom evil-goggles-enable-fill-and-move t
- "If non-nil, enable fill and move (reformat) support"
- :type 'boolean
- :group 'evil-goggles)
+;; indent (fill and move)
+
+(evil-goggles--define-switch-and-face
+ 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")
(defun evil-goggles--evil-fill-and-move-advice (orig-fun beg end)
"Around-advice for function `evil-fill-and-move'.
@@ -205,10 +219,11 @@ BEG END are arguments of the original function."
(evil-goggles--with-goggles beg end 'evil-goggles-fill-and-move-face
(evil-goggles--funcall-preserve-interactive orig-fun beg end)))
-(defcustom evil-goggles-enable-paste t
- "If non-nil, enable paste support"
- :type 'boolean
- :group 'evil-goggles)
+;; paste before and after
+
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-paste "If non-nil, enable paste support"
+ evil-goggles-paste-face "Face for paste action")
(defun evil-goggles--evil-paste-after-advice (orig-fun count &optional
register yank-handler)
"Around-advice for function `evil-paste-after'.
@@ -245,10 +260,9 @@ The overlay region is derermined by evil's variable
`evil-last-paste'"
;; shift left & right
-(defcustom evil-goggles-enable-shift t
- "If non-nil, enable shift left/right support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-shift "If non-nil, enable shift left/right support"
+ evil-goggles-shift-face "Face for paste action")
(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`.
@@ -270,10 +284,9 @@ BEG END PATTERN COMMAND &OPTIONAL INVERT are the arguments
of the original funct
;; surround
-(defcustom evil-goggles-enable-surround t
- "If non-nil, enable surround support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-surround "If non-nil, enable surround support"
+ evil-goggles-surround-face "Face for surround action")
(defun evil-goggles--evil-surround-region-advice (orig-fun beg end &optional
type char force-new-line)
"Around-advice for function `evil-surround-region'.
@@ -285,10 +298,9 @@ BEG END &OPTIONAL TYPE CHAR FORCE-NEW-LINE are the
arguments of the original fun
;; commentary
-(defcustom evil-goggles-enable-commentary t
- "If non-nil, enable commentary support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ evil-goggles-enable-commentary "If non-nil, enable commentary support"
+ evil-goggles-commentary-face "Face for commentary action")
(defun evil-goggles--evil-commentary-advice (orig-fun beg end &optional type)
"Around-advice for function `evil-commentary'.
@@ -300,10 +312,9 @@ BEG END &OPTIONAL TYPE are the arguments of the original
function."
;; replace with register
-(defcustom evil-goggles-enable-replace-with-register t
- "If non-nil, enable replace with register support"
- :type 'boolean
- :group 'evil-goggles)
+(evil-goggles--define-switch-and-face
+ 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")
(defun evil-goggles--evil-replace-with-register-advice (orig-fun count beg
&optional end type register)
"Around-advice for function `evil-replace-with-register'.
diff --git a/test/make-compile.el b/test/make-compile.el
index 5ef548e803..ec336d17d0 100644
--- a/test/make-compile.el
+++ b/test/make-compile.el
@@ -1,4 +1,4 @@
-(setq files '("evil-goggles.el" "evil-goggles-faces.el"))
+(setq files '("evil-goggles.el"))
(setq byte-compile--use-old-handlers nil)
(mapc #'byte-compile-file files)
- [nongnu] elpa/evil-goggles 42456816de 015/225: Use macros to preserve "interactivity", (continued)
- [nongnu] elpa/evil-goggles 42456816de 015/225: Use macros to preserve "interactivity", ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles dd76fd3d28 019/225: Make sure the overlay is cleaned-up, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 1014993453 028/225: Add custom variable evil-goggles-blacklist to allow disabling individual functions, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles f29820fe98 029/225: Detect only `evil-inhibit-operator-value` into account, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 9882706667 030/225: Preserve the return value of evil-paste-*, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 253613ce66 039/225: Fix check of evil-last-paste, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 788c73d505 041/225: Make lighter configurable, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 97498ef1ba 050/225: Clarify package should be on Melpa, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles bf6f836609 056/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 10512f5b3b 054/225: Check evil-mode is on with bound-and-true-p, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles ae77a5c6f0 067/225: Replace the boilerplate in evil-goggles-faces.el with a macro,
ELPA Syncer <=
- [nongnu] elpa/evil-goggles 0f6254f548 070/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 902270eea8 084/225: Show a vertical visual hint for vertical text objects., ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 879114abea 085/225: Don't show the overlay when evil-mc is displaying multiple fake cursors, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 0c713e7462 086/225: Add experimental support for undo/redo, off by default, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles fec8dfd7b5 088/225: Simplify undo/redo checks, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles fd85719817 089/225: Improve doc strings, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 0585f4d657 097/225: Try to avoid Travis seg-faults by running emacs in batch mode, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 142e0a9f2b 105/225: Remove unused option, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles ee7fafb858 107/225: Remove debugs, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 5404dcfaf8 106/225: Don't quote inherited faces so face-background works, ELPA Syncer, 2022/01/12