From 2d60566c8787b63b5e4e2958e9ec9f55fbcf9e87 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 1 Dec 2021 06:30:32 +0100 Subject: [PATCH] Use proportional fonts in the Gnus headers by default * lisp/gnus/gnus-art.el (gnus-header): Inherit from `variable-pitch'. (gnus--variable-pitch-p): New helper function. (gnus-article-treat-fold-headers): Fill using pixel filling. --- etc/NEWS | 7 +++++++ lisp/gnus/gnus-art.el | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 52686479ce2..d786d17f21e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -366,6 +366,13 @@ the common "utm_" trackers from URLs. ** Gnus +--- +*** Gnus now uses a variable-pitch font in the headers by default. +To get the monospace font back, you can put something like the +following in your .gnus file: + + (set-face-attribute 'gnus-header nil :inherit 'unspecified) + --- *** New face 'gnus-header'. All other 'gnus-header-*' faces inherit from this face now. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 02f0d50be5d..8b2b7ade294 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -769,7 +769,7 @@ Obsolete; use the face `gnus-signature' for customizations instead." :group 'gnus-article-signature) (defface gnus-header - '((t nil)) + '((t :inherit variable-pitch)) "Base face used for all Gnus header faces. All the other `gnus-header-' faces inherit from this face." :version "29.1" @@ -2212,6 +2212,13 @@ unfolded." (replace-match " " t t)))) (goto-char (point-max))))))) +(defun gnus--variable-pitch-p (face) + (or (eq face 'variable-pitch) + (let ((parent (face-attribute face :inherit))) + (if (eq parent 'unspecified) + nil + (seq-some #'gnus--variable-pitch-p (ensure-list parent)))))) + (defun gnus-article-treat-fold-headers () "Fold message headers." (interactive nil gnus-article-mode gnus-summary-mode) @@ -2219,7 +2226,10 @@ unfolded." (while (not (eobp)) (save-restriction (mail-header-narrow-to-field) - (mail-header-fold-field) + (if (not (gnus--variable-pitch-p (get-text-property (point) 'face))) + (mail-header-fold-field) + (forward-char 1) + (pixel-fill-region (point) (point-max) (pixel-fill-width))) (goto-char (point-max)))))) (defun gnus-treat-smiley () -- 2.39.2