[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus 03e3cbc566 05/82: Documented every function/variable
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus 03e3cbc566 05/82: Documented every function/variable |
Date: |
Tue, 6 Sep 2022 04:58:54 -0400 (EDT) |
branch: elpa/focus
commit 03e3cbc566d3fc32a34443f82a2cf366af493f8f
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Documented every function/variable
---
focus-mode.el | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/focus-mode.el b/focus-mode.el
index 7e876d72e6..acdfa605ff 100644
--- a/focus-mode.el
+++ b/focus-mode.el
@@ -1,15 +1,24 @@
(require 'cl-lib)
-(defvar-local focus-pre-overlay nil)
-(defvar-local focus-post-overlay nil)
+(defvar-local focus-pre-overlay nil
+ "The overlay that dims the text prior to the current-point.")
+
+(defvar-local focus-post-overlay nil
+ "The overlay that dims the text past the current-point.")
(defun focus-search-backward (regex)
+ "A wrapper for re-search-backward, where the point does not move,
+and if the search fails, it returns NIL."
(save-excursion (re-search-backward regex nil t)))
(defun focus-search-forward (regex)
+ "A wrapper for re-search-backward, where the point does not move,
+and if the search fails, it returns NIL."
(save-excursion (re-search-forward regex nil t)))
(defun focus-average-colors (color &rest colors)
+ "This function takes one or more colors and returns the average
+of RGB values of the given colors."
(let* ((colors (cons color colors))
(colors (mapcar 'color-name-to-rgb colors))
(len (length colors))
@@ -18,12 +27,18 @@
(apply 'color-rgb-to-hex avg)))
(defun focus-move-focus ()
+ "If `focus-mode' is enabled, this command fires after each
+command, and moves the dimming overlays."
(let* ((pre (or (focus-search-backward "^\n") (point-min)))
(post (or (focus-search-forward "^\n") (point-max))))
(move-overlay focus-pre-overlay (point-min) pre)
(move-overlay focus-post-overlay post (point-max))))
(defun focus-init ()
+ "This function is run when focus-mode is enabled. It sets the
+`focus-pre-overlay' and `focus-post-overlay' to overlays; these
+are invisible until `focus-move-focus' is run. It adds
+focus-move-focus to `post-command-hook'."
(setq focus-pre-overlay (make-overlay (point-min) (point-min))
focus-post-overlay (make-overlay (point-max) (point-max)))
(let ((color (focus-average-colors
@@ -34,6 +49,9 @@
(add-hook 'post-command-hook 'focus-move-focus nil t))
(defun focus-terminate ()
+ "When `focus-mode' is disabled the overlays pointed to by
+`focus-pre-overlay' and `focus-post-overlay' are deleted, and
+`focus-move-focus' is removed from `post-command-hook'."
(progn (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
(remove-hook 'post-command-hook 'focus-move-focus t)))
- [nongnu] branch elpa/focus created (now 704db49988), ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus fbeecfc8ca 08/82: Added README, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 10b44de510 07/82: Docstring update, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6040c744cc 02/82: Made custom search functions that saves excursion, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 4846438e3f 41/82: Merge branch 'read-only', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 60f460b5be 28/82: Simplified installation, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 236c002b57 14/82: Tweaking sizes, trying max-with, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ab42b87799 68/82: Fix buffer-local variables definition, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 9defce6158 10/82: Place the gif's side by side, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 03e3cbc566 05/82: Documented every function/variable,
ELPA Syncer <=
- [nongnu] elpa/focus 497d13d758 32/82: Added functions for jumping between things, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 307df45c69 51/82: Fix #5, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 3013760ef0 12/82: Resizing did not work, retry!, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ff93c948da 26/82: Added defgroup, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6a6da19b00 09/82: Fixed image names, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 741a945866 55/82: Merge branch 'syohex-cl-lib', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus b4fb132314 23/82: Changing modes should not affect Focus mode, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 809697ba52 25/82: Changed paragraph to sections, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 27eda82b95 40/82: Binding for enabling focus-read-only-mode in focus-mode, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus eeb12d8db8 19/82: Added function to generate color based on `focus-dimness', ELPA Syncer, 2022/09/06