emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/lin 8aa367ec86 13/46: Merge branch 'various' into 'main


From: ELPA Syncer
Subject: [elpa] externals/lin 8aa367ec86 13/46: Merge branch 'various' into 'main'
Date: Thu, 7 Apr 2022 23:57:45 -0400 (EDT)

branch: externals/lin
commit 8aa367ec86b531f31ee89b39e03ec28da3b7e565
Merge: fb32511d20 c3bfd5c300
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Merge branch 'various' into 'main'
    
    Support mu4e, fixes & tweaks
    
    See merge request protesilaos/lin!1
---
 lin.el | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/lin.el b/lin.el
index 34967edb5e..0f3f90a801 100644
--- a/lin.el
+++ b/lin.el
@@ -84,7 +84,7 @@ the `lin-hl-override-fg' is applied."
     (((class color) (min-colors 88) (background dark))
      :background "#103265")
     (t :inherit highlight))
-  "Like `lin-hl', but does not override foreground color.
+  "Like `lin-hl-override-fg', but does not override foreground color.
 Used only when `lin-override-foreground' is nil."
   :group 'lin)
 
@@ -99,22 +99,32 @@ Used only when `lin-override-foreground' is nil."
 Used only when `lin-override-foreground' is non-nil."
   :group 'lin)
 
-(defun lin--face ()
-  "Determine face based on `lin-override-foreground'."
-  (if lin-override-foreground 'lin-hl-override-fg 'lin-hl))
-
-(defvar lin--cookie nil
+(defvar-local lin--cookie nil
   "Cookie returned by `face-remap-add-relative'.")
 
+(defun lin--source-face ()
+  "Determine the source face, what to remap."
+  (cond
+   ((derived-mode-p 'mu4e-headers-mode)
+    'mu4e-header-highlight-face)
+   (t
+    'hl-line)))
+
+(defun lin--dest-face ()
+  "Determine the destination face, what source must remap to.
+This is controlled by `lin-override-foreground', which see."
+  (if lin-override-foreground 'lin-hl-override-fg 'lin-hl))
+
 (define-minor-mode lin-mode
   "Remap `hl-line' face to a local LIN face.
 The overall style is controlled by `lin-override-foreground'."
   :local t
   :init-value nil
-  (let ((face (lin--face)))
-    (if lin-mode
-        (setq lin--cookie (face-remap-add-relative 'hl-line face))
-      (face-remap-remove-relative lin--cookie))))
+  (if lin-mode
+      (setq lin--cookie
+            (face-remap-add-relative (lin--source-face) (lin--dest-face)))
+    (face-remap-remove-relative lin--cookie)))
 
 (provide 'lin)
+
 ;;; lin.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]