]> git.eshelyaron.com Git - emacs.git/commitdiff
Use proportional fonts in the Gnus headers by default
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 1 Dec 2021 05:30:32 +0000 (06:30 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 1 Dec 2021 13:41:42 +0000 (14:41 +0100)
* 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
lisp/gnus/gnus-art.el

index 52686479ce2b2dec5113c65407543c3c8a504895..d786d17f21e3cc157c9fa50c42d7ac248b35f766 100644 (file)
--- 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.
index 02f0d50be5d3d57cbe755e9f2ffe12909fb32d72..8b2b7ade294974771ea4b06bceddd9f646e7285f 100644 (file)
@@ -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 ()