Subject: bug#46971: 28.0.60; [PATCH] Disable modus-themes font mixing by default (bug#46971)

From: Protesilaos Stavrou <[email-masked]>
Date: Wed, 06 Oct 2021 16:53:31 +0300

Dear maintainers,

This is a bugfix for the emacs-28 branch, prompted by the discussion in
bug#46971.  It changes the default behaviour of the modus-themes to not
inherit the 'fixed-pitch' face in various spacing sensitive faces.  This
now becomes an opt-in feature and its utility is documented in the doc
string of the new user option as well as the manual.

Note that I have already made these changes to the modus-themes repo and
was planning to sync them with the Emacs 'master' branch upon the next
release of the project (maybe in a month from now).

Please let me know if you think this should be applied to emacs-28.

All the best,
Protesilaos

-- 
Protesilaos Stavrou
https://protesilaos.com
From b66924be6d134480b769982c1e6a19cb4e968052 Mon Sep 17 00:00:00 2001
Message-Id: <[email-masked]>
From: Protesilaos Stavrou <[email-masked]>
Date: Wed, 6 Oct 2021 16:40:18 +0300
Subject: [PATCH] Disable modus-themes font mixing by default (bug#46971)

* doc/misc/modus-themes.org (Customization Options): Include new user
option in code sample.
(Option for no font mixing, Option for font mixing): Rewrite the
section on font mixing to explain the new behaviour of not inheriting
the 'fixed-pitch' face by default.  Users must opt-in instead.
(Acknowledgements): Acknowledge name of person who first reported the
problem with the old option.

* etc/themes/modus-themes.el (modus-themes-variable-pitch)
(modus-themes-fixed-pitch): Update doc strings to mention new user
option.
(modus-themes-no-mixed-fonts): Deprecate old user option and replace
it with 'modus-themes-mixed-fonts'.
(modus-themes-mixed-fonts): Add new defcustom.
(modus-themes--fixed-pitch): Change the way inheritance of
'fixed-pitch' is handled, so that it is disabled by default.
(modus-themes-faces): Update one face that needs to inherit
'fixed-pitch' conditionally, so that it does not do it by default.

Fixes bug#46971, which actually was about the modus-themes.
---
 doc/misc/modus-themes.org  | 54 ++++++++++++++++++++------------------
 etc/themes/modus-themes.el | 44 ++++++++++++++++---------------
 2 files changed, 51 insertions(+), 47 deletions(-)

diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org
index 675144d517..9e294d62e9 100644
--- a/doc/misc/modus-themes.org
+++ b/doc/misc/modus-themes.org
@@ -380,7 +380,7 @@ * Customization Options
 #+begin_src emacs-lisp
 (setq modus-themes-italic-constructs t
       modus-themes-bold-constructs nil
-      modus-themes-no-mixed-fonts nil
+      modus-themes-mixed-fonts nil
       modus-themes-subtle-line-numbers nil
       modus-themes-success-deuteranopia t
       modus-themes-tabs-accented t
@@ -629,36 +629,38 @@ ** Option for syntax highlighting
 
 [[#h:977c900d-0d6d-4dbb-82d9-c2aae69543d6][Option for more italic constructs]].
 
-** Option for no font mixing
+** Option for font mixing
 :properties:
-:alt_title: No mixed fonts
+:alt_title: Mixed fonts
 :description: Toggle mixing of font families
 :custom_id: h:115e6c23-ee35-4a16-8cef-e2fcbb08e28b
 :end:
 #+vindex: modus-themes-no-mixed-fonts
 
-Symbol: ~modus-themes-no-mixed-fonts~
+Symbol: ~modus-themes-mixed-fonts~
 
 Possible values:
 
 1. ~nil~ (default)
 2. ~t~
 
-By default, the themes configure some spacing-sensitive faces like Org
+When set to non-nil (~t~), configure some spacing-sensitive faces like Org
 tables and code blocks to always inherit from the ~fixed-pitch~ face.
-This is to ensure that those constructs remain monospaced even when
-users opt for a mode that remaps typeface families, such as the built-in
-{{{kbd(M-x variable-pitch-mode)}}}.  Otherwise the layout would appear
-broken, due to how spacing is done.  To disable this behaviour, set the
-option to ~t~.
+This is to ensure that certain constructs like code blocks and tables
+remain monospaced even when users opt for a mode that remaps typeface
+families, such as the built-in {{{kbd(M-x variable-pitch-mode)}}}.  Otherwise
+the layout would appear broken, due to how spacing is done.
 
-Users may prefer to use another package for handling mixed typeface
-configurations, rather than letting the theme do it, perhaps because a
-purpose-specific package has extra functionality.  Two possible options
-are ~org-variable-pitch~ and ~mixed-pitch~.
+For a consistent experience, user may need to specify the font family of
+the ~fixed-pitch~ face.
 
 [[#h:defcf4fc-8fa8-4c29-b12e-7119582cc929][Font configurations for Org and others]].
 
+Furthermore, users may prefer to use another package for handling mixed
+typeface configurations, rather than letting the theme do it, perhaps
+because a purpose-specific package has extra functionality.  Two
+possible options are ~org-variable-pitch~ and ~mixed-pitch~.
+
 ** Option for links
 :properties:
 :alt_title: Link styles
@@ -4337,18 +4339,18 @@ * Acknowledgements
   Edmondson, Davor Rotim, Divan Santana, Eliraz Kedmi, Emanuele Michele
   Alberto Monterosso, Farasha Euker, Feng Shu, Gautier Ponsinet, Gerry
   Agbobada, Gianluca Recchia, Gustavo Barros, Hörmetjan Yiltiz, Ilja
-  Kocken, Iris Garcia, Jeremy Friesen, Jerry Zhang, John Haman, Joshua
-  O'Connor, Kevin Fleming, Kévin Le Gouguec, Kostadin Ninev, Len Trigg,
-  Manuel Uberti, Mark Burton, Markus Beppler, Mauro Aranda, Michael
-  Goldenberg, Morgan Smith, Murilo Pereira, Nicky van Foreest, Nicolas
-  De Jaeghere, Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu,
-  Philip Kaludercic, Pierre Téchoueyres, Roman Rudakov, Ryan Phillips,
-  Rudolf Adamkovič, Sam Kleinman, Shreyas Ragavan, Simon Pugnet, Tassilo
-  Horn, Thibaut Verron, Thomas Heartman, Trey Merkley, Togan Muftuoglu,
-  Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley.  As well as
-  users: Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik,
-  Moesasji, Nick, TheBlob42, Trey, bepolymathe, doolio, fleimgruber,
-  iSeeU, jixiuf, okamsn, pRot0ta1p.
+  Kocken, Iris Garcia, Jeremy Friesen, Jerry Zhang, Johannes Grødem,
+  John Haman, Joshua O'Connor, Kevin Fleming, Kévin Le Gouguec, Kostadin
+  Ninev, Len Trigg, Manuel Uberti, Mark Burton, Markus Beppler, Mauro
+  Aranda, Michael Goldenberg, Morgan Smith, Murilo Pereira, Nicky van
+  Foreest, Nicolas De Jaeghere, Paul Poloskov, Pengji Zhang, Pete
+  Kazmier, Peter Wu, Philip Kaludercic, Pierre Téchoueyres, Roman
+  Rudakov, Ryan Phillips, Rudolf Adamkovič, Sam Kleinman, Shreyas
+  Ragavan, Simon Pugnet, Tassilo Horn, Thibaut Verron, Thomas Heartman,
+  Trey Merkley, Togan Muftuoglu, Toon Claes, Uri Sharf, Utkarsh Singh,
+  Vincent Foley.  As well as users: Ben, CsBigDataHub1, Emacs Contrib,
+  Eugene, Fourchaux, Fredrik, Moesasji, Nick, TheBlob42, Trey,
+  bepolymathe, doolio, fleimgruber, iSeeU, jixiuf, okamsn, pRot0ta1p.
 
 + Packaging :: Basil L.{{{space()}}} Contovounesios, Eli Zaretskii, Glenn
   Morris, Mauro Aranda, Richard Stallman, Stefan Kangas (core Emacs),
diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el
index 7ab985c077..a0099f4aef 100644
--- a/etc/themes/modus-themes.el
+++ b/etc/themes/modus-themes.el
@@ -5,7 +5,7 @@ ;;; modus-themes.el --- Highly accessible themes (WCAG AAA) -*- lexical-binding:
 ;; Author: Protesilaos Stavrou <[email-masked]>
 ;; URL: https://gitlab.com/protesilaos/modus-themes
 ;; Version: 1.6.0
-;; Last-Modified: <2021-09-29 08:47:03 +0300>
+;; Last-Modified: <2021-10-06 16:25:14 +0300>
 ;; Package-Requires: ((emacs "27.1"))
 ;; Keywords: faces, theme, accessibility
 
@@ -40,7 +40,7 @@ ;;; Commentary:
 ;;     modus-themes-bold-constructs                (boolean)
 ;;     modus-themes-inhibit-reload                 (boolean)
 ;;     modus-themes-italic-constructs              (boolean)
-;;     modus-themes-no-mixed-fonts                 (boolean)
+;;     modus-themes-mixed-fonts                    (boolean)
 ;;     modus-themes-scale-headings                 (boolean)
 ;;     modus-themes-subtle-line-numbers            (boolean)
 ;;     modus-themes-success-deuteranopia           (boolean)
@@ -1475,7 +1475,7 @@ (defface modus-themes-slant nil
 
 (defface modus-themes-variable-pitch nil
   "Generic face for applying a conditional `variable-pitch'.
-This behaves in accordance with `modus-themes-no-mixed-fonts',
+This behaves in accordance with `modus-themes-mixed-fonts',
 `modus-themes-variable-pitch-headings' for all heading levels,
 and `modus-themes-variable-pitch-ui'.
 
@@ -1484,7 +1484,7 @@ (defface modus-themes-variable-pitch nil
 
 (defface modus-themes-fixed-pitch nil
   "Generic face for applying a conditional `fixed-pitch'.
-This behaves in accordance with `modus-themes-no-mixed-fonts'.
+This behaves in accordance with `modus-themes-mixed-fonts'.
 
 The actual styling of the face is done by `modus-themes-faces'."
   :group 'modus-theme-faces)
@@ -1782,24 +1782,26 @@ (defcustom modus-themes-variable-pitch-ui nil
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) UI typeface"))
 
-(defcustom modus-themes-no-mixed-fonts nil
-  "Disable inheritance from `fixed-pitch' in some faces.
-
-This is done by default to allow spacing-sensitive constructs,
-such as Org tables and code blocks, to remain monospaced when
-users opt for something like the command `variable-pitch-mode'.
-The downside with the default is that users need to explicitly
-configure the font family of `fixed-pitch' in order to get a
-consistent experience.  That may be something they do not want to
-do.  Hence this option to disable any kind of technique for
-mixing fonts."
+(define-obsolete-variable-alias
+  'modus-themes-no-mixed-fonts
+  'modus-themes-mixed-fonts "1.6.0 (on 2021-10-06)")
+
+(defcustom modus-themes-mixed-fonts nil
+  "Enable inheritance from `fixed-pitch' in some faces.
+
+This is done to allow spacing-sensitive constructs, such as Org
+tables and code blocks, to remain monospaced when users opt for
+something like the command `variable-pitch-mode'.
+
+Users may need to explicitly configure the font family of
+`fixed-pitch' in order to get a consistent experience."
   :group 'modus-themes
-  :package-version '(modus-themes . "1.0.0")
+  :package-version '(modus-themes . "1.6.0")
   :version "28.1"
   :type 'boolean
   :set #'modus-themes--set-option
   :initialize #'custom-initialize-default
-  :link '(info-link "(modus-themes) No mixed fonts"))
+  :link '(info-link "(modus-themes) Mixed fonts"))
 
 (defconst modus-themes--headings-choice
   '(set :tag "Properties" :greedy t
@@ -3024,7 +3026,7 @@ (defun modus-themes--slant ()
 
 (defun modus-themes--fixed-pitch ()
   "Conditional application of `fixed-pitch' inheritance."
-  (unless modus-themes-no-mixed-fonts
+  (when modus-themes-mixed-fonts
     (list :inherit 'fixed-pitch)))
 
 (defun modus-themes--variable-pitch ()
@@ -6640,9 +6642,9 @@ ;;;;; org
                         :extend t)))
     `(org-column ((,class :background ,bg-alt)))
     `(org-column-title ((,class :inherit bold :underline t :background ,bg-alt)))
-    `(org-date ((,class :inherit ,(if modus-themes-no-mixed-fonts
-                                      'button
-                                    '(button fixed-pitch))
+    `(org-date ((,class :inherit ,(if modus-themes-mixed-fonts
+                                      '(button fixed-pitch)
+                                    'button)
                         ,@(modus-themes--link-color
                            cyan cyan-faint))))
     `(org-date-selected ((,class :inherit bold :foreground ,blue-alt :inverse-video t)))
-- 
2.33.0