[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-goggles 888f064624 130/225: Add docstrings
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-goggles 888f064624 130/225: Add docstrings |
Date: |
Wed, 12 Jan 2022 08:59:02 -0500 (EST) |
branch: elpa/evil-goggles
commit 888f064624a2f96db278177a0b5c7853f9481088
Author: Evgeni Kolev <evgenysw@gmail.com>
Commit: Evgeni Kolev <evgenysw@gmail.com>
Add docstrings
---
evil-goggles.el | 51 +++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/evil-goggles.el b/evil-goggles.el
index b777cc89b5..f64fa3381d 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -43,7 +43,7 @@
"Time in floating seconds that the goggles overlay should last.
This affects the hints which are displayed before the operation, such
-as when deleting. "
+as when deleting."
:type 'number
:group 'evil-goggles)
@@ -77,7 +77,10 @@ can't work with input such as (backgound . \"red\")."
(autoload 'pulse-momentary-highlight-overlay "pulse")
(defun evil-goggles--pulse-overlay (ov background dur)
- "Pulse the overlay OV with the BACKGROUND color."
+ "Pulse the overlay OV with the BACKGROUND color for DUR duration.
+
+This function returns immediately, it doesn't wait for the pulse
+animation to end."
(let* ((pulse-delay 0.03)
(pulse-iterations (round (or dur evil-goggles-duration) pulse-delay)))
(ignore pulse-iterations) ;; silence compile warning Unused lexical
variable
@@ -124,26 +127,43 @@ overlay must not be re-displayed.")
;; don't show overlay when the region has nothing but whitespace
(not (null (string-match-p "[^ \t\n]" (buffer-substring-no-properties
beg end))))))
-(defun evil-goggles--overlay-insert-behind-hook (o afterp beg end &optional
len)
+(defun evil-goggles--overlay-insert-behind-hook (ov afterp beg end &optional
len)
+ "Function which grows/shriks the overlay OV when its text changes.
+
+The OV, AFTERP, BEG, END, LEN arguments are specified by the calling
+convention for the insert-behind-hooks overlay property."
(when afterp
(if (zerop len)
(progn
(setq len (- end beg))
- (move-overlay o (overlay-start o) (+ len (overlay-end o))))
- (move-overlay o (overlay-start o) (- (overlay-end o) len) ))))
+ (move-overlay ov (overlay-start ov) (+ len (overlay-end ov))))
+ (move-overlay ov (overlay-start ov) (- (overlay-end ov) len) ))))
(defmacro evil-goggles--with-after-goggles2 (beg end face dur &rest body)
+ "Show hint from BEG to END with face FACE for DUR seconds.
+
+BODY is executed after the hint is displayed but before it's
+removed. As a result any changes BODY does on the text will be
+visualized by the hint."
(declare (indent 4) (debug t))
`(evil-goggles--with-hint-on ,beg ,end (progn ,@body)
(evil-goggles--show-overlay ,beg ,end ,face (or ,dur
evil-goggles-duration2)
,@body)))
(defun evil-goggles--show-or-pulse-overlay (ov face dur)
+ "Show or pulse overlay OV with face FACE.
+
+DUR is used only when pulsing.
+The overlay is pulsed if variable `evil-goggles-pulse' is t."
(if evil-goggles-pulse
- (evil-goggles--pulse-overlay ov (evil-goggles--face-background face)
dur) ;; pulse the overlay
- (overlay-put ov 'face face))) ;; just put the face on the overlay
+ (evil-goggles--pulse-overlay ov (evil-goggles--face-background face) dur)
+ (overlay-put ov 'face face)))
(defmacro evil-goggles--with-hint-on (beg end body1 &rest body2)
+ "Run one block of code if hint is visible, run the other if not.
+
+If hint is visible, check it's ok to display it from BEG to END. If
+it's not, do BODY1, else BODY2."
(declare (indent 3) (debug t))
`(if (and (not evil-goggles--on) (evil-goggles--show-p ,beg ,end))
(let ((evil-goggles--on t))
@@ -151,11 +171,16 @@ overlay must not be re-displayed.")
,body1))
(defmacro evil-goggles--with-no-hint (&rest body)
+ "Do BODY with hints disabled."
(declare (indent 0) (debug t))
`(let ((evil-goggles--on t))
,@body))
+;; TODO naming - with-pre-hint
(defmacro evil-goggles--with-before-goggles2 (beg end face dur &rest body)
+ "Show hint from BEG to END with face FACE for DUR sec, then do BODY.
+
+BODY is executed after the hint has been removed."
(declare (indent 4) (debug t))
`(evil-goggles--with-hint-on ,beg ,end (progn ,@body)
(if (eq evil-this-type 'block)
@@ -213,12 +238,14 @@ so this package can work with Emacs 24"
(funcall ,fun ,@args)))
(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.
+ "Helper macro defining an on/off var, a face, and duration var.
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."
+FACE-DOC is the docstring for FACE-NAME.
+DUR-NAME is the name of the duration variable.
+DUR-DOC is the docstring for DUR-NAME."
(declare (indent 7) (debug t))
`(progn
(defcustom ,switch-name t
@@ -328,7 +355,7 @@ 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
+ "Duration of hint on undo/redo changing.
This variable must be set before `evil-goggles-mode' is enabled"
:type 'number :group 'evil-goggles)
@@ -394,6 +421,10 @@ This function tries to return a single list, either:
(car processed-list))))
(defun evil-goggles--combine-undo-list (input)
+ "Combine elements in INPUT list.
+
+Each element is expected to be either '(text-added BEG END) or
+'(text-removed BEG END)."
(let* ((last (car input))
(result (list last)))
(dolist (this (cdr input) (nreverse result))
- [nongnu] elpa/evil-goggles 87722a5b46 210/225: Add hint for `D`, (continued)
- [nongnu] elpa/evil-goggles 87722a5b46 210/225: Add hint for `D`, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles d7876e6566 218/225: Drop unnecessary helper macro, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 636b263361 215/225: Make async overlay cleanup more robust, without using pre-command-hook, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 12cfb80230 104/225: Use separate config, face and advice for nerd-commenter and commentary. Refs #13, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 75d124851f 156/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles d4b3d873dc 155/225: Update CI setup to run evil's tests unaltered, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 761abb7b2f 145/225: Hint duration should be configured via three variables, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles f282263af4 120/225: Show visual hint after shift left/right, not before #7, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 2932d91a6c 129/225: Remove deprecated functions, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles d3802c500f 141/225: Rename function with-no-hint => with-disabled-hint, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 888f064624 130/225: Add docstrings,
ELPA Syncer <=
- [nongnu] elpa/evil-goggles 7f30cbd73c 139/225: Fix default values, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 838aacbe33 176/225: evil-goggles--show-p: check for a single char *and* single line, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 5780bcf8cb 186/225: Show hint only when the command is called interactively #18, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 4bfc8df8b3 191/225: Remove deprecated macros, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles bb974e38d2 193/225: Add hints for `J`, `gq` and `=`, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 42051e2cb3 197/225: Keep configuration per command in a variable, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 1c72501a6f 196/225: Reduce configuration options - drop `substitute`, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 2b922512fb 199/225: Refactor, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles dac6c45aa1 214/225: Add hint for `Y', when `evil-want-Y-yank-to-eol' is t, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles bf1be3be24 018/225: Don't show overlay on whitespaces-only regions, ELPA Syncer, 2022/01/12