[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lin ede49730af 2/2: Add user option lin-remap-cureent-l
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lin ede49730af 2/2: Add user option lin-remap-cureent-line-number |
Date: |
Sun, 4 Aug 2024 06:58:24 -0400 (EDT) |
branch: externals/lin
commit ede49730af5f23cee2b784c860dfb3dc90ce67d0
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add user option lin-remap-cureent-line-number
---
README.org | 7 +++++++
lin.el | 24 ++++++++++++++++++------
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index eda5c00068..2906bbc0ae 100644
--- a/README.org
+++ b/README.org
@@ -114,6 +114,13 @@ background attribute. The Lin faces with the
=-override-fg= suffix set
a foreground value which replaces that of the underlying text. Whereas
the others only specify a background attribute.
+[ The ~lin-remap-cureent-line-number~ is part of {{{development-version}}}. ]
+
+#+vindex: lin-remap-cureent-line-number
+The user option ~lin-remap-cureent-line-number~ controls whether to
+apply the Lin style also to the currently highlighted line number.
+Line numbers come from the built-in ~display-line-numbers-mode~.
+
* Installation
:PROPERTIES:
:CUSTOM_ID: h:7b68abd3-a854-4b72-b704-05ca013dfa7f
diff --git a/lin.el b/lin.el
index d2f7a04369..30ae528738 100644
--- a/lin.el
+++ b/lin.el
@@ -145,6 +145,13 @@ updates the face. Users who prefer to use `setq' must run
:package-version '(lin . "0.3.0")
:group 'lin)
+(defcustom lin-remap-cureent-line-number t
+ "When non-nil, apply `lin-face' also to the current line number.
+Line numbers come from the `display-line-numbers-mode'."
+ :type 'boolean
+ :package-version '(lin . "1.1.0")
+ :group 'lin)
+
;;;; Faces
(defgroup lin-faces ()
@@ -299,10 +306,13 @@ updates the face. Users who prefer to use `setq' must run
;;;; Lin setup
-(defvar-local lin--cookie nil
- "Cookie returned by `face-remap-add-relative'.")
+(defvar-local lin--hl-line-cookie nil
+ "Cookie returned by `face-remap-add-relative' for `hl-line' face.")
+
+(defvar-local lin--line-number-current-line-cookie nil
+ "Cookie of `face-remap-add-relative' for `line-number-current-line' face.")
-(defun lin--source-face ()
+(defun lin--hl-line-source-face ()
"Determine the source face: what to remap."
(cond
((derived-mode-p 'mu4e-headers-mode)
@@ -323,10 +333,12 @@ updates the face. Users who prefer to use `setq' must run
:init-value nil
(if lin-mode
(progn
- (setq lin--cookie
- (face-remap-add-relative (lin--source-face) lin-face))
+ (setq lin--hl-line-cookie (face-remap-add-relative
(lin--hl-line-source-face) lin-face))
+ (when lin-remap-cureent-line-number
+ (setq lin--line-number-current-line-cookie (face-remap-add-relative
'line-number-current-line lin-face)))
(hl-line-mode 1))
- (face-remap-remove-relative lin--cookie)
+ (face-remap-remove-relative lin--hl-line-cookie)
+ (face-remap-remove-relative lin--line-number-current-line-cookie)
(hl-line-mode -1)))
;;;###autoload