diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/dashboard-config.el | 3 | ||||
| -rw-r--r-- | modules/mail-config.el | 6 | ||||
| -rw-r--r-- | modules/system-lib.el | 23 |
3 files changed, 31 insertions, 1 deletions
diff --git a/modules/dashboard-config.el b/modules/dashboard-config.el index b92162932..38510e801 100644 --- a/modules/dashboard-config.el +++ b/modules/dashboard-config.el @@ -17,6 +17,7 @@ ;;; Code: +(require 'system-lib) ;; cj/exclude-from-global-font-lock (eval-when-compile (require 'undead-buffers)) (declare-function cj/make-buffer-undead "undead-buffers" (string)) (autoload 'cj/make-buffer-undead "undead-buffers" nil t) @@ -168,7 +169,7 @@ system-defaults) are preserved rather than overwritten." ;; running the banner and headings fall back to the default face. Excluding ;; dashboard-mode lets those text-property faces survive. (Item and navigator ;; colors ride a `dashboard-items-face' overlay, which font-lock leaves alone.) -(setq font-lock-global-modes '(not dashboard-mode)) +(cj/exclude-from-global-font-lock 'dashboard-mode) (use-package dashboard :demand t diff --git a/modules/mail-config.el b/modules/mail-config.el index dfc0c4e0c..1ec41f213 100644 --- a/modules/mail-config.el +++ b/modules/mail-config.el @@ -161,6 +161,12 @@ Prompts user for the action when executing." (display-buffer-reuse-window display-buffer-same-window) (inhibit-same-window . nil))) +;; Keep global font-lock out of the mu4e buffers. mu4e paints header lines, the +;; main menu, and view headers with manual `face' text properties; global +;; font-lock strips them (the same failure the dashboard hit), leaving the +;; buffers unthemed. Excluding these modes keeps mu4e's faces. +(cj/exclude-from-global-font-lock 'mu4e-headers-mode 'mu4e-main-mode 'mu4e-view-mode) + (use-package mu4e :ensure nil ;; mu4e gets installed by installing 'mu' via the system package manager :load-path "/usr/share/emacs/site-lisp/mu4e/" diff --git a/modules/system-lib.el b/modules/system-lib.el index 9e25be5b7..ed98a476e 100644 --- a/modules/system-lib.el +++ b/modules/system-lib.el @@ -141,5 +141,28 @@ long-form answer, keeping a stray RET or space from confirming." (let ((use-short-answers nil)) (yes-or-no-p prompt))) +(defun cj/--font-lock-global-modes-excluding (current mode) + "Return CURRENT `font-lock-global-modes' with MODE added to the exclusion. +CURRENT has one of three shapes: t (font-lock on in all modes), a +\(not M...) exclusion list, or an (M...) inclusion list. Pure: returns +the new value and mutates nothing." + (cond + ((eq current t) (list 'not mode)) + ((and (consp current) (eq (car current) 'not)) + (if (memq mode (cdr current)) current + (cons 'not (cons mode (cdr current))))) + ((consp current) (delq mode (copy-sequence current))) + (t current))) + +(defun cj/exclude-from-global-font-lock (&rest modes) + "Exclude MODES from `global-font-lock-mode'. +Some major modes (dashboard, mu4e) paint their buffers with manual `face' +text properties; global font-lock then strips those, leaving the buffer +unthemed. Excluding the mode keeps its faces. Additive, so each caller +contributes its own modes regardless of load order." + (dolist (mode modes) + (setq font-lock-global-modes + (cj/--font-lock-global-modes-excluding font-lock-global-modes mode)))) + (provide 'system-lib) ;;; system-lib.el ends here |
