[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus e691113e4b 03/82: Moved init/termination to separate
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus e691113e4b 03/82: Moved init/termination to separate functions |
Date: |
Tue, 6 Sep 2022 04:58:53 -0400 (EDT) |
branch: elpa/focus
commit e691113e4b3fd2447bbb5f680d0717b13a2a07e5
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Moved init/termination to separate functions
---
focus-mode.el | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/focus-mode.el b/focus-mode.el
index 963b6f4b75..47d6825e4c 100644
--- a/focus-mode.el
+++ b/focus-mode.el
@@ -21,18 +21,22 @@
(move-overlay focus-pre-overlay (point-min) pre)
(move-overlay focus-post-overlay post (point-max))))
+(defun focus-init ()
+ (setq focus-pre-overlay (make-overlay (point-min) (point-min))
+ focus-post-overlay (make-overlay (point-max) (point-max)))
+ (let ((color (focus-average-colors
+ (face-attribute 'default :foreground)
+ (face-attribute 'default :background))))
+ (mapc (lambda (o) (overlay-put o 'face (cons 'foreground-color color)))
+ (list focus-pre-overlay focus-post-overlay)))
+ (add-hook 'post-command-hook 'focus-move-focus nil t))
+
+(defun focus-terminate ()
+ (progn (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
+ (remove-hook 'post-command-hook 'focus-move-focus t)))
+
;;;###autoload
(define-minor-mode focus-mode
"Dim the font color text in surrounding paragraphs."
:init-value nil
- (if (not focus-mode)
- (progn (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
- (remove-hook 'post-command-hook 'focus-move-focus t))
- (setq focus-pre-overlay (make-overlay (point-min) (point-min))
- focus-post-overlay (make-overlay (point-max) (point-max)))
- (let ((color (focus-average-colors
- (face-attribute 'default :foreground)
- (face-attribute 'default :background))))
- (mapc (lambda (o) (overlay-put o 'face (cons 'foreground-color color)))
- (list focus-pre-overlay focus-post-overlay)))
- (add-hook 'post-command-hook 'focus-move-focus nil t)))
+ (if focus-mode (focus-init) (focus-terminate)))
- [nongnu] elpa/focus 809697ba52 25/82: Changed paragraph to sections, (continued)
- [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
- [nongnu] elpa/focus 500bab4833 13/82: Yet another try, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 3fafdc7947 62/82: Allow explicitly setting derived modes in focus-mode-to-thing, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 9a5cf4f972 77/82: Formatting, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 663205443c 21/82: Forgot to rename variables everywhere, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 4d31363bf9 54/82: Use cl-lib function instead of cl.el, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus af9fbfd9cb 06/82: Changed name and added header, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 02cec3494d 01/82: Initial commit, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus e691113e4b 03/82: Moved init/termination to separate functions,
ELPA Syncer <=
- [nongnu] elpa/focus 284a1240ce 33/82: Cleaned up doc in `focus-average-colors', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 58a91b29aa 34/82: Split focus-bounds into two functions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ac711fe13a 35/82: Whitespace cleanup, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 35f3cf5d52 20/82: Use things as defined in thingatpt as bounds, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 871f3c60ce 48/82: Fixed matching parenthesis, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus fe94e0de69 43/82: Split activation/deactivation into functions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 2fbf024c53 79/82: Fix bug introduced in d5631db, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6add57b887 59/82: Fix indentation, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 563a3bd188 47/82: Updated README, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus d1bd81ee4d 39/82: Added focus-read-only-mode, ELPA Syncer, 2022/09/06