[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ef-themes 92724735e8: Add ef-themes-mixed-fonts user op
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ef-themes 92724735e8: Add ef-themes-mixed-fonts user option |
Date: |
Mon, 22 Aug 2022 00:57:36 -0400 (EDT) |
branch: externals/ef-themes
commit 92724735e8d7c23e5675e4725867814786497f82
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add ef-themes-mixed-fonts user option
My original plan was to not implement such an option and instead direct
users to other packages such as 'mixed-pitch'. However, doing this at
the theme level feels more natural and gives us greater control over
what actually needs to be rendered in 'fixed-pitch'.
Furthermore, adding such an option does not really make the themes
harder to maintain as it does not affect colour combinations.
---
README.org | 31 ++++++++++++++++++++++++++++
ef-themes.el | 66 +++++++++++++++++++++++++++++++++++++++++++-----------------
2 files changed, 78 insertions(+), 19 deletions(-)
diff --git a/README.org b/README.org
index 952babff1d..9111a9ca4f 100644
--- a/README.org
+++ b/README.org
@@ -207,6 +207,37 @@ command.
This is in addition to the other ways of loading a theme, either with
minibuffer completion or at random
([[#h:58345e8c-2bec-459c-872c-a85a29e9fe97][Commands to load an Ef theme]]).
+** Enable mixed fonts
+:PROPERTIES:
+:CUSTOM_ID: h:621d3bb9-5967-4f97-b253-7470bba9168c
+:END:
+
+[ Part of {{{development-version}}} ]
+
+#+vindex: ef-themes-mixed-fonts
+The user option ~ef-themes-mixed-fonts~ controls whether strictly
+spacing-sensitive constructs inherit from ~fixed-pitch~ (a monospaced
+font family).
+
+By default (a nil value for this user option) no face inherits from
+~fixed-pitch~: they all use the default font family, regardless of
+whether it is monospaced or not.
+
+When ~ef-themes-mixed-fonts~ is set to a non-nil value, faces such as
+Org tables, inline code, code blocks, and the like, are rendered in a
+monospaced font at all times. The user can thus set their default font
+family to a proportionately spaced font without worrying about breaking
+the alignment of relevant elements, or if they simply prefer the
+aesthetics of mixed mono and proportionately spaced font families.
+
+A temporary switch to a proportionately spaced font (known in Emacs as
+~variable-pitch~) can be enabled in the current buffer with the
+activation of the built-in ~variable-pitch-mode~.
+
+To get consistent typography, the user may need to edit the font family
+of the ~fixed-pitch~ face. The =fontaine= package on GNU ELPA (by
+Protesilaos) can be helpful in that regard.
+
** Option for headings
:PROPERTIES:
:CUSTOM_ID: h:a7a02817-e324-43e9-a7d8-fde024530af6
diff --git a/ef-themes.el b/ef-themes.el
index ee12959810..edfb91e1a9 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -209,8 +209,30 @@ will retain the original aesthetic for that level. For
example:
:value-type ,ef-themes--headings-choice)
:link '(info-link "(ef-themes) Option for headings"))
+(defcustom ef-themes-mixed-fonts nil
+ "Non-nil to 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 a
+proportionately spaced font as their default or when they use
+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 with their
+typography (also check the `fontaine' package on GNU ELPA (by
+Protesilaos))."
+ :group 'ef-themes
+ :package-version '(ef-themes . "0.4.0")
+ :type 'boolean
+ :link '(info-link "(ef-themes) Enable mixed fonts"))
+
;;; Helpers for user options
+(defun ef-themes--fixed-pitch ()
+ "Conditional application of `fixed-pitch' inheritance."
+ (when ef-themes-mixed-fonts
+ (list :inherit 'fixed-pitch)))
+
(defun ef-themes--key-cdr (key alist)
"Get cdr of KEY in ALIST."
(cdr (assoc key alist)))
@@ -455,9 +477,15 @@ Helper function for `ef-themes-preview-colors'."
:package-version '(ef-themes . "0.3.0")
:group 'ef-themes-faces)
+(defface ef-themes-fixed-pitch nil
+ "Face for `fixed-pitch' if `ef-themes-mixed-fonts' is non-nil."
+ :package-version '(ef-themes . "0.4.0")
+ :group 'ef-themes-faces)
+
(defconst ef-themes-faces
'(
;;;; internal faces
+ `(ef-themes-fixed-pitch ((,c ,@(ef-themes--fixed-pitch))))
`(ef-themes-heading-0 ((,c ,@(ef-themes--heading 0) :foreground
,rainbow-0)))
`(ef-themes-heading-1 ((,c ,@(ef-themes--heading 1) :foreground
,rainbow-1)))
`(ef-themes-heading-2 ((,c ,@(ef-themes--heading 2) :foreground
,rainbow-2)))
@@ -467,7 +495,7 @@ Helper function for `ef-themes-preview-colors'."
`(ef-themes-heading-6 ((,c ,@(ef-themes--heading 6) :foreground
,rainbow-6)))
`(ef-themes-heading-7 ((,c ,@(ef-themes--heading 7) :foreground
,rainbow-7)))
`(ef-themes-heading-8 ((,c ,@(ef-themes--heading 8) :foreground
,rainbow-8)))
- `(ef-themes-key-binding ((,c :inherit bold :foreground ,keybind)))
+ `(ef-themes-key-binding ((,c :inherit (bold ef-themes-fixed-pitch)
:foreground ,keybind)))
;;;; all basic faces
`(default ((,c :background ,bg-main :foreground ,fg-main)))
`(cursor ((,c :background ,cursor)))
@@ -816,7 +844,7 @@ Helper function for `ef-themes-preview-colors'."
`(gnus-header-newsgroups ((,c :inherit message-header-newsgroups)))
`(gnus-header-subject ((,c :inherit message-header-subject)))
;;;; info
- `(Info-quoted ((,c :foreground ,accent-0))) ; the capitalization is
canonical
+ `(Info-quoted ((,c :inherit ef-themes-fixed-pitch :foreground ,accent-0)))
; the capitalization is canonical
`(info-header-node ((,c :inherit (shadow bold))))
`(info-index-match ((,c :inherit match)))
`(info-menu-header ((,c :inherit bold)))
@@ -965,7 +993,7 @@ Helper function for `ef-themes-preview-colors'."
;;;; markdown-mode
`(markdown-blockquote-face ((,c :inherit font-lock-doc-face)))
`(markdown-bold-face ((,c :inherit bold)))
- `(markdown-code-face ((,c :background ,bg-inactive :extend t)))
+ `(markdown-code-face ((,c :inherit ef-themes-fixed-pitch :background
,bg-inactive :extend t)))
`(markdown-gfm-checkbox-face ((,c :foreground ,warning)))
`(markdown-header-face (( )))
`(markdown-header-face-1 ((,c :inherit ef-themes-heading-1)))
@@ -975,9 +1003,9 @@ Helper function for `ef-themes-preview-colors'."
`(markdown-header-face-5 ((,c :inherit ef-themes-heading-5)))
`(markdown-header-face-6 ((,c :inherit ef-themes-heading-6)))
`(markdown-highlighting-face ((,c :background ,bg-info :foreground ,info)))
- `(markdown-inline-code-face ((,c :foreground ,accent-1))) ; same as
`org-code'
+ `(markdown-inline-code-face ((,c :inherit ef-themes-fixed-pitch
:foreground ,accent-1))) ; same as `org-code'
`(markdown-italic-face ((,c :inherit italic)))
- `(markdown-language-keyword-face ((,c :background ,bg-dim)))
+ `(markdown-language-keyword-face ((,c :inherit ef-themes-fixed-pitch
:background ,bg-dim)))
`(markdown-line-break-face ((,c :inherit nobreak-space)))
`(markdown-link-face ((,c :inherit link)))
`(markdown-markup-face ((,c :inherit shadow)))
@@ -985,7 +1013,7 @@ Helper function for `ef-themes-preview-colors'."
`(markdown-metadata-value-face ((,c :foreground ,string)))
`(markdown-missing-link-face ((,c :inherit warning)))
`(markdown-pre-face ((,c :inherit markdown-code-face)))
- `(markdown-table-face ((,c :foreground ,fg-alt))) ; same as `org-table'
+ `(markdown-table-face ((,c :inherit ef-themes-fixed-pitch :foreground
,fg-alt))) ; same as `org-table'
`(markdown-url-face ((,c :foreground ,fg-alt)))
;;;; messages
`(message-cited-text-1 ((,c :foreground ,mail-0)))
@@ -1103,27 +1131,27 @@ Helper function for `ef-themes-preview-colors'."
`(org-agenda-structure-filter ((,c :inherit (warning
org-agenda-structure))))
`(org-agenda-structure-secondary ((,c :foreground ,rainbow-1)))
`(org-archived ((,c :background ,bg-alt :foreground ,fg-alt)))
- `(org-block ((,c :background ,bg-inactive :extend t)))
- `(org-block-begin-line ((,c :inherit shadow :background ,bg-dim :extend
t)))
+ `(org-block ((,c :inherit ef-themes-fixed-pitch :background ,bg-inactive
:extend t)))
+ `(org-block-begin-line ((,c :inherit (shadow ef-themes-fixed-pitch)
:background ,bg-dim :extend t)))
`(org-block-end-line ((,c :inherit org-block-begin-line)))
`(org-checkbox ((,c :foreground ,warning)))
`(org-checkbox-statistics-done ((,c :inherit org-done)))
`(org-checkbox-statistics-todo ((,c :inherit org-todo)))
`(org-clock-overlay ((,c :background ,bg-alt :foreground ,red-cooler)))
- `(org-code ((,c :foreground ,accent-1)))
+ `(org-code ((,c :inherit ef-themes-fixed-pitch :foreground ,accent-1)))
`(org-column ((,c :inherit default :background ,bg-alt)))
`(org-column-title ((,c :inherit (bold default) :underline t :background
,bg-alt)))
- `(org-date ((,c :foreground ,date)))
+ `(org-date ((,c :inherit ef-themes-fixed-pitch :foreground ,date)))
`(org-date-selected ((,c :foreground ,date :inverse-video t)))
`(org-dispatcher-highlight ((,c :inherit warning :background ,bg-warning)))
`(org-document-info ((,c :foreground ,rainbow-1)))
`(org-document-info-keyword ((,c :inherit shadow)))
`(org-document-title ((,c :inherit ef-themes-heading-0)))
`(org-done ((,c :foreground ,info)))
- `(org-drawer ((,c :inherit shadow)))
+ `(org-drawer ((,c :inherit (shadow ef-themes-fixed-pitch))))
`(org-ellipsis (( ))) ; inherits from the heading's color
`(org-footnote ((,c :inherit link)))
- `(org-formula ((,c :foreground ,fnname)))
+ `(org-formula ((,c :inherit ef-themes-fixed-pitch :foreground ,fnname)))
`(org-headline-done ((,c :inherit org-done)))
`(org-headline-todo ((,c :inherit org-todo)))
`(org-hide ((,c :foreground ,bg-main)))
@@ -1140,19 +1168,19 @@ Helper function for `ef-themes-preview-colors'."
`(org-level-8 ((,c :inherit ef-themes-heading-8)))
`(org-link ((,c :inherit link)))
`(org-list-dt ((,c :inherit bold)))
- `(org-macro ((,c :foreground ,accent-2)))
- `(org-meta-line ((,c :inherit shadow)))
+ `(org-macro ((,c :inherit ef-themes-fixed-pitch :foreground ,accent-2)))
+ `(org-meta-line ((,c :inherit (shadow ef-themes-fixed-pitch))))
`(org-mode-line-clock (( )))
`(org-mode-line-clock-overrun ((,c :inherit bold :foreground ,err)))
`(org-priority ((,c :foreground ,magenta)))
- `(org-property-value ((,c :foreground ,fg-alt)))
+ `(org-property-value ((,c :inherit ef-themes-fixed-pitch :foreground
,fg-alt)))
`(org-quote ((,c :inherit org-block)))
`(org-scheduled ((,c :foreground ,warning)))
`(org-scheduled-previously ((,c :inherit org-scheduled)))
`(org-scheduled-today ((,c :inherit (bold org-scheduled))))
`(org-sexp-date ((,c :foreground ,date)))
- `(org-special-keyword ((,c :inherit shadow)))
- `(org-table ((,c :foreground ,fg-alt)))
+ `(org-special-keyword ((,c :inherit (shadow ef-themes-fixed-pitch))))
+ `(org-table ((,c :inherit ef-themes-fixed-pitch :foreground ,fg-alt)))
`(org-table-header ((,c :inherit (bold org-table))))
`(org-tag ((,c :foreground ,fg-alt)))
`(org-tag-group ((,c :inherit (bold org-tag))))
@@ -1161,7 +1189,7 @@ Helper function for `ef-themes-preview-colors'."
`(org-todo ((,c :foreground ,err)))
`(org-upcoming-deadline ((,c :foreground ,warning)))
`(org-upcoming-distant-deadline ((,c :inherit org-upcoming-deadline)))
- `(org-verbatim ((,c :foreground ,accent-0)))
+ `(org-verbatim ((,c :inherit ef-themes-fixed-pitch :foreground ,accent-0)))
`(org-verse ((,c :inherit org-block)))
`(org-warning ((,c :inherit warning)))
;;;; org-habit
@@ -1260,7 +1288,7 @@ Helper function for `ef-themes-preview-colors'."
`(show-paren-match-expression ((,c :background ,bg-alt)))
`(show-paren-mismatch ((,c :background ,bg-red :foreground ,fg-intense)))
;;;; shr
- `(shr-code ((,c :foreground ,accent-1))) ; same as `org-code'
+ `(shr-code ((,c :inherit ef-themes-fixed-pitch :foreground ,accent-1))) ;
same as `org-code'
`(shr-h1 ((,c :inherit ef-themes-heading-1)))
`(shr-h2 ((,c :inherit ef-themes-heading-2)))
`(shr-h3 ((,c :inherit ef-themes-heading-3)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/ef-themes 92724735e8: Add ef-themes-mixed-fonts user option,
ELPA Syncer <=