[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2d60566 2/3: Use proportional fonts in the Gnus headers by defaul
From: |
Lars Ingebrigtsen |
Subject: |
master 2d60566 2/3: Use proportional fonts in the Gnus headers by default |
Date: |
Wed, 1 Dec 2021 08:42:43 -0500 (EST) |
branch: master
commit 2d60566c8787b63b5e4e2958e9ec9f55fbcf9e87
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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 5268647..d786d17 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -367,6 +367,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 02f0d50..8b2b7ad 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 ()