branch: externals/lin commit 13aa36b6c763755d8f7df66497b7f22dae1256aa Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Use custom setter for lin-face user option This practically means that the following changes the face without having to restart the mode manually: (customize-set-variable 'lin-face 'lin-yellow) --- lin.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lin.el b/lin.el index 1e09816628..e9608a3184 100644 --- a/lin.el +++ b/lin.el @@ -160,6 +160,10 @@ background attribute." (face :tag "Cyan style that also overrides the underlying foreground" lin-cyan-override-fg) (face :tag "macOS style that also overrides the underlying foreground" lin-mac-override-fg) (face :tag "Other face (must have a background)")) + :initialize #'custom-initialize-default + :set (lambda (symbol value) + (set-default symbol value) + (mapc #'lin--mode-restart (buffer-list))) :group 'lin) ;;;; Faces @@ -341,6 +345,12 @@ With optional non-nil REVERSE argument, remove those hooks." (dolist (hook lin-mode-hooks) (add-hook hook #'lin-mode)))) +(defun lin--mode-restart (buffer) + "Return non-nil if `lin-mode' is enabled in BUFFER." + (with-current-buffer buffer + (when lin-mode + (lin-mode 1)))) + (provide 'lin) ;;; lin.el ends here