[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus a80b7b6eba 71/82: Add possibility of customizing the
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus a80b7b6eba 71/82: Add possibility of customizing the face of the focused region |
Date: |
Tue, 6 Sep 2022 04:58:59 -0400 (EDT) |
branch: elpa/focus
commit a80b7b6ebaebda7c6cd910cb4f363bc6e58e275d
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Add possibility of customizing the face of the focused region
---
focus.el | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/focus.el b/focus.el
index 64d46617b4..76480aa93d 100644
--- a/focus.el
+++ b/focus.el
@@ -59,12 +59,19 @@ Things that are defined include `symbol', `list', `sexp',
:type '(float)
:group 'focus)
+(defcustom focus-unfocused-face 'font-lock-comment-face
+ "The face that overlays the unfocused area."
+ :type '(face)
+ :group 'focus)
+
+(defcustom focus-focused-face nil
+ "The face that overlays the focused area."
+ :type '(face)
+ :group 'focus)
+
(defvar focus-cursor-type cursor-type
"Used to restore the users `cursor-type'")
-(defvar focus-unfocused-face font-lock-comment-face
- "Overrides the color used for dimmed text.")
-
(defvar-local focus-current-thing nil
"Overrides the choice of thing dictated by `focus-mode-to-thing' if set.")
@@ -74,6 +81,9 @@ Things that are defined include `symbol', `list', `sexp',
(defvar-local focus-pre-overlay nil
"The overlay that dims the text prior to the current-point.")
+(defvar-local focus-mid-overlay nil
+ "The overlay that surrounds the text of the current-point.")
+
(defvar-local focus-post-overlay nil
"The overlay that dims the text past the current-point.")
@@ -105,20 +115,24 @@ command."
(focus-move-overlays (car bounds) (cdr bounds))))))
(defun focus-move-overlays (low high)
- "Move `focus-pre-overlay' and `focus-post-overlay'."
- (move-overlay focus-pre-overlay (point-min) low)
+ "Move `focus-pre-overlay', `focus-mid-overlay' and `focus-post-overlay'."
+ (move-overlay focus-pre-overlay (point-min) low)
+ (move-overlay focus-mid-overlay low high)
(move-overlay focus-post-overlay high (point-max)))
(defun focus-init ()
"This function is run when command `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'."
+It sets the `focus-pre-overlay', `focus-min-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'."
(unless (or focus-pre-overlay focus-post-overlay)
(setq focus-pre-overlay (make-overlay (point-min) (point-min))
+ focus-mid-overlay (make-overlay (point-min) (point-max))
focus-post-overlay (make-overlay (point-max) (point-max))
focus-buffer (current-buffer))
+ (overlay-put focus-mid-overlay 'face focus-focused-face)
(mapc (lambda (o) (overlay-put o 'face focus-unfocused-face))
(list focus-pre-overlay focus-post-overlay))
(add-hook 'post-command-hook 'focus-move-focus nil t)
@@ -127,12 +141,15 @@ adds `focus-move-focus' to `post-command-hook'."
(defun focus-terminate ()
"This function is run when command `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'."
+The overlays pointed to by `focus-pre-overlay',
+`focus-mid-overlay' and `focus-post-overlay' are deleted, and
+`focus-move-focus' is removed from `post-command-hook'."
(when (and focus-pre-overlay focus-post-overlay)
- (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
+ (mapc 'delete-overlay
+ (list focus-pre-overlay focus-mid-overlay focus-post-overlay))
(remove-hook 'post-command-hook 'focus-move-focus t)
- (setq focus-pre-overlay nil
+ (setq focus-pre-overlay nil
+ focus-mid-overlay nil
focus-post-overlay nil)))
(defun focus-goto-thing (bounds)
- [nongnu] elpa/focus 0a6e9624ea 49/82: Allow for changing the current thing interactively, (continued)
- [nongnu] elpa/focus 0a6e9624ea 49/82: Allow for changing the current thing interactively, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 90806dc7ea 18/82: Added custom variable for setting dimness, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 704db49988 82/82: Merge pull request #24 from phikal/master, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus c89d08f510 24/82: Applied purcell's recommendations, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 94ed8ab68b 36/82: Defined variables to help hide the cursor, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus e8c1eb5ce2 16/82: Added short commentary, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 75202c9445 58/82: Version bump, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 8028fc088f 04/82: Improved average color function, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus e9ab37b865 81/82: Improved user option types, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus aa5ea31118 65/82: Fixed package lint warnings., ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus a80b7b6eba 71/82: Add possibility of customizing the face of the focused region,
ELPA Syncer <=
- [nongnu] elpa/focus 1c664fb992 17/82: Added installation section, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus bf5fcff0d0 69/82: Allow setting a color for dimmed text. Fixes #21, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus f310fa1c31 52/82: Split up `focus-move-focus', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 5e483363ac 75/82: New README, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6b9620a73d 44/82: Added section on `focus-read-only-mode' in README, ELPA Syncer, 2022/09/06