From d008a7e97765c6d6b7324d229ac399317caeac16 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 8 Jun 2018 13:29:06 +0200 Subject: [PATCH] Make ui/fci's automatic color change customizable --- modules/ui/fci/config.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/modules/ui/fci/config.el b/modules/ui/fci/config.el index 5aaf50ef3..424faae2c 100644 --- a/modules/ui/fci/config.el +++ b/modules/ui/fci/config.el @@ -1,12 +1,28 @@ ;;; ui/fci/config.el -*- lexical-binding: t; -*- +(defvar +fci-rule-color-function + (lambda () (face-foreground 'line-number)) + "Color used to draw the fill-column rule. + +Accepts a color string or a function that returns a color. + +Changes to this variable do not take effect until `fci-mode' is restarted.") + + +;; +;; Plugins +;; + (def-package! fill-column-indicator :hook ((text-mode prog-mode conf-mode) . turn-on-fci-mode) :config (defun +fci|set-color () - (setq fci-rule-color (face-foreground 'line-number))) - (add-hook 'doom-load-theme-hook #'+fci|set-color) - (+fci|set-color) + "Automatically change `fci-rule-color' based on `+fci-rule-color-function's +return value. To disable this, either set `+fci-rule-color-function' to nil or +remove `+fci|set-color' from `fci-mode-hook'." + (when (functionp +fci-rule-color-function) + (setq fci-rule-color (funcall +fci-rule-color-function)))) + (add-hook 'fci-mode-hook #'+fci|set-color) (when (featurep! :completion company) (add-hook 'company-completion-started-hook #'+fci|disable-when-company-activates)