branch: externals/lin commit aa42c9360993753819dd78be7a435f0a2f060fee Author: Nicolas De Jaeghere <nico...@dejaeghe.re> Commit: Nicolas De Jaeghere <nico...@dejaeghe.re>
Support mu4e-headers-mode --- lin.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lin.el b/lin.el index 48f710a8c7..091e729696 100644 --- a/lin.el +++ b/lin.el @@ -99,22 +99,31 @@ 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-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