branch: externals/modus-operandi-theme commit feaef70a558ad732f3cb35e060fc018af0d9b39a Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Refine ORG-MODE faces for mixed font workflows Several faces will now use a monospaced font even when the user opts for a proportionately-spaced family as their main typeface. The previous settings would "break" the layout when the user enabled something like (variable-pitch-mode). Now things work as expected. Note though that depending on the user's font settings, some adjustments may be necessary (though these are outside the scope of the themes). Example: (set-face-attribute 'variable-pitch nil :family "Source Sans Pro" :height 110) (set-face-attribute 'fixed-pitch nil :family "Source Code Pro" :height 110) This set of changes was recommended in issue 40: https://gitlab.com/protesilaos/modus-themes/-/issues/40 --- README.org | 30 ++++++++++++++++++++++++++++++ modus-operandi-theme.el | 16 +++++++++------- modus-vivendi-theme.el | 16 +++++++++------- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/README.org b/README.org index ae34777..0a31c36 100644 --- a/README.org +++ b/README.org @@ -466,6 +466,36 @@ package which offers live colour previews. This is how I configure it: (setq rainbow-x-colors nil)) #+end_src +** Optional minimum extra configurations for mixed fonts + :PROPERTIES: + :CUSTOM_ID: h:ea30ff0e-3bb6-4801-baf1-d49169d94cd5 + :END: + +The themes are designed to cope well with mixed font settings. +Currently this applies to Org mode (courtesy of [[https://gitlab.com/protesilaos/modus-themes/-/issues/40][Ben in issue 40]]). + +In practice it means that some parts of an Org buffer will use a +monospaced font even when the user opts for a proportionately-spaced +typeface as their default (such as by enabling =(variable-pitch-mode)=). +This is to ensure that code blocks and other relevant elements use the +appropriate type settings and are positioned correctly. + +To specify the font families and their respective height, you could do +something like: + +#+begin_src emacs-lisp +(set-face-attribute 'variable-pitch nil :family "Source Sans Pro" :height 110) +(set-face-attribute 'fixed-pitch nil :family "Source Code Pro" :height 110) +#+end_src + +In this example, you are defining the attributes of the =variable-pitch= +face (proportional) and of =fixed-pitch= (monospace), which are then +inherited by other faces at the theme level. + +If any Org power user is reading this section, I encourage you to +recommend some other /minimal/ tweaks and customisations that could +improve the user experience. + * Face coverage :PROPERTIES: :CUSTOM_ID: h:944a3bdf-f545-40a0-a26c-b2cec8b2b316 diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el index f9cd957..b320f16 100644 --- a/modus-operandi-theme.el +++ b/modus-operandi-theme.el @@ -2457,11 +2457,12 @@ Also bind `class' to ((class color) (min-colors 89))." :foreground ,fg-special-mild ,@(modus-operandi-theme-scale modus-operandi-theme-scale-3))))) `(org-archived ((,class (:background ,bg-alt :foreground ,fg-alt)))) - `(org-block ((,class (,@(modus-operandi-theme-org-src-block bg-dim bg-main) :foreground ,fg-main)))) + `(org-block ((,class (,@(modus-operandi-theme-org-src-block bg-dim bg-main) + :inherit fixed-pitch :foreground ,fg-main)))) `(org-block-begin-line ((,class (,@(and (>= emacs-major-version 27) modus-operandi-theme-distinct-org-blocks '(:extend t)) - :background ,bg-alt :foreground ,fg-special-mild)))) + :inherit fixed-pitch :background ,bg-alt :foreground ,fg-special-mild)))) `(org-block-end-line ((,class (:inherit org-block-begin-line)))) `(org-checkbox ((,class (:weight bold)))) `(org-checkbox-statistics-done ((,class (:foreground ,green @@ -2471,14 +2472,14 @@ Also bind `class' to ((class color) (min-colors 89))." ,@(modus-operandi-theme-heading-block yellow-nuanced-bg yellow-nuanced))))) `(org-clock-overlay ((,class (:inherit modus-theme-special-cold)))) - `(org-code ((,class (:foreground ,magenta)))) + `(org-code ((,class (:inherit fixed-pitch :foreground ,magenta)))) `(org-column ((,class (:background ,bg-alt)))) `(org-column-title ((,class (:underline t :background ,bg-alt :weight bold)))) `(org-date ((,class (:foreground ,blue-nuanced)))) `(org-date-selected ((,class (:inherit modus-theme-intense-cyan :weight bold)))) `(org-default ((,class (:background ,bg-main :foreground ,fg-main)))) `(org-document-info ((,class (:foreground ,fg-special-cold)))) - `(org-document-title ((,class (:foreground ,fg-special-cold :weight bold)))) + `(org-document-info-keyword ((,class (:inherit fixed-pitch :foreground ,fg-alt)))) `(org-document-title ((,class (,@(modus-operandi-theme-scale modus-operandi-theme-scale-5) :foreground ,fg-special-cold :weight bold)))) `(org-done ((,class (,@(modus-operandi-theme-org-todo-block green-nuanced-bg green-nuanced green))))) @@ -2498,6 +2499,7 @@ Also bind `class' to ((class color) (min-colors 89))." ,@(modus-operandi-theme-heading-block green-nuanced-bg green-nuanced))))) `(org-hide ((,class (:foreground ,bg-main)))) + `(org-indent ((,class (:inherit (fixed-pitch org-hide))))) `(org-latex-and-related ((,class (:foreground ,magenta-refine-fg)))) `(org-level-1 ((,class (:inherit ,modus-theme-variable-pitch :weight bold ,@(modus-operandi-theme-heading-foreground fg-main magenta-alt-other) @@ -2530,7 +2532,7 @@ Also bind `class' to ((class color) (min-colors 89))." `(org-link ((,class (:inherit link)))) `(org-list-dt ((,class (:weight bold)))) `(org-macro ((,class (:inherit org-latex-and-related)))) - `(org-meta-line ((,class (:foreground ,fg-alt :slant ,modus-theme-slant)))) + `(org-meta-line ((,class (:inherit fixed-pitch :foreground ,fg-alt :slant ,modus-theme-slant)))) `(org-mode-line-clock ((,class (:background ,bg-main :foreground ,fg-main)))) `(org-mode-line-clock-overrun ((,class (:inherit modus-theme-active-red)))) `(org-priority ((,class (,@(modus-operandi-theme-org-todo-block blue-nuanced-bg blue-nuanced magenta) @@ -2542,7 +2544,7 @@ Also bind `class' to ((class color) (min-colors 89))." `(org-scheduled-today ((,class (:foreground ,yellow-alt-other)))) `(org-sexp-date ((,class (:inherit org-date)))) `(org-special-keyword ((,class (,@(modus-operandi-theme-org-todo-block cyan-nuanced-bg cyan-nuanced cyan-alt))))) - `(org-table ((,class (:foreground ,fg-special-cold)))) + `(org-table ((,class (:inherit fixed-pitch :foreground ,fg-special-cold)))) `(org-tag ((,class (:foreground ,magenta-nuanced :weight normal)))) `(org-tag-group ((,class (:foreground ,cyan-nuanced :weight bold)))) `(org-target ((,class (:underline t)))) @@ -2551,7 +2553,7 @@ Also bind `class' to ((class color) (min-colors 89))." ,@(modus-operandi-theme-heading-foreground magenta-alt-other red-alt-other))))) `(org-upcoming-deadline ((,class (:foreground ,red-alt-other)))) `(org-upcoming-distant-deadline ((,class (:foreground ,red-nuanced)))) - `(org-verbatim ((,class (:background ,bg-alt :foreground ,fg-special-calm)))) + `(org-verbatim ((,class (:inherit fixed-pitch :background ,bg-alt :foreground ,fg-special-calm)))) `(org-verse ((,class (:inherit org-quote)))) `(org-warning ((,class (:foreground ,blue-intense)))) ;;;; org-journal diff --git a/modus-vivendi-theme.el b/modus-vivendi-theme.el index 2d370ea..ccaf838 100644 --- a/modus-vivendi-theme.el +++ b/modus-vivendi-theme.el @@ -2457,11 +2457,12 @@ Also bind `class' to ((class color) (min-colors 89))." :foreground ,fg-special-mild ,@(modus-vivendi-theme-scale modus-vivendi-theme-scale-3))))) `(org-archived ((,class (:background ,bg-alt :foreground ,fg-alt)))) - `(org-block ((,class (,@(modus-vivendi-theme-org-src-block bg-dim bg-main) :foreground ,fg-main)))) + `(org-block ((,class (,@(modus-vivendi-theme-org-src-block bg-dim bg-main) + :inherit fixed-pitch :foreground ,fg-main)))) `(org-block-begin-line ((,class (,@(and (>= emacs-major-version 27) modus-vivendi-theme-distinct-org-blocks '(:extend t)) - :background ,bg-alt :foreground ,fg-special-mild)))) + :inherit fixed-pitch :background ,bg-alt :foreground ,fg-special-mild)))) `(org-block-end-line ((,class (:inherit org-block-begin-line)))) `(org-checkbox ((,class (:weight bold)))) `(org-checkbox-statistics-done ((,class (:foreground ,green @@ -2471,14 +2472,14 @@ Also bind `class' to ((class color) (min-colors 89))." ,@(modus-vivendi-theme-heading-block yellow-nuanced-bg yellow-nuanced))))) `(org-clock-overlay ((,class (:inherit modus-theme-special-cold)))) - `(org-code ((,class (:foreground ,magenta)))) + `(org-code ((,class (:inherit fixed-pitch :foreground ,magenta)))) `(org-column ((,class (:background ,bg-alt)))) `(org-column-title ((,class (:underline t :background ,bg-alt :weight bold)))) `(org-date ((,class (:foreground ,blue-nuanced)))) `(org-date-selected ((,class (:inherit modus-theme-intense-cyan :weight bold)))) `(org-default ((,class (:background ,bg-main :foreground ,fg-main)))) `(org-document-info ((,class (:foreground ,fg-special-cold)))) - `(org-document-title ((,class (:foreground ,fg-special-cold :weight bold)))) + `(org-document-info-keyword ((,class (:inherit fixed-pitch :foreground ,fg-alt)))) `(org-document-title ((,class (,@(modus-vivendi-theme-scale modus-vivendi-theme-scale-5) :foreground ,fg-special-cold :weight bold)))) `(org-done ((,class (,@(modus-vivendi-theme-org-todo-block green-nuanced-bg green-nuanced green))))) @@ -2498,6 +2499,7 @@ Also bind `class' to ((class color) (min-colors 89))." ,@(modus-vivendi-theme-heading-block green-nuanced-bg green-nuanced))))) `(org-hide ((,class (:foreground ,bg-main)))) + `(org-indent ((,class (:inherit (fixed-pitch org-hide))))) `(org-latex-and-related ((,class (:foreground ,magenta-refine-fg)))) `(org-level-1 ((,class (:inherit ,modus-theme-variable-pitch :weight bold ,@(modus-vivendi-theme-heading-foreground fg-main magenta-alt-other) @@ -2530,7 +2532,7 @@ Also bind `class' to ((class color) (min-colors 89))." `(org-link ((,class (:inherit link)))) `(org-list-dt ((,class (:weight bold)))) `(org-macro ((,class (:inherit org-latex-and-related)))) - `(org-meta-line ((,class (:foreground ,fg-alt :slant ,modus-theme-slant)))) + `(org-meta-line ((,class (:inherit fixed-pitch :foreground ,fg-alt :slant ,modus-theme-slant)))) `(org-mode-line-clock ((,class (:background ,bg-main :foreground ,fg-main)))) `(org-mode-line-clock-overrun ((,class (:inherit modus-theme-active-red)))) `(org-priority ((,class (,@(modus-vivendi-theme-org-todo-block blue-nuanced-bg blue-nuanced magenta) @@ -2542,7 +2544,7 @@ Also bind `class' to ((class color) (min-colors 89))." `(org-scheduled-today ((,class (:foreground ,yellow-alt-other)))) `(org-sexp-date ((,class (:inherit org-date)))) `(org-special-keyword ((,class (,@(modus-vivendi-theme-org-todo-block cyan-nuanced-bg cyan-nuanced cyan-alt))))) - `(org-table ((,class (:foreground ,fg-special-cold)))) + `(org-table ((,class (:inherit fixed-pitch :foreground ,fg-special-cold)))) `(org-tag ((,class (:foreground ,magenta-nuanced :weight normal)))) `(org-tag-group ((,class (:foreground ,cyan-nuanced :weight bold)))) `(org-target ((,class (:underline t)))) @@ -2551,7 +2553,7 @@ Also bind `class' to ((class color) (min-colors 89))." ,@(modus-vivendi-theme-heading-foreground magenta-alt-other red-alt-other))))) `(org-upcoming-deadline ((,class (:foreground ,red-alt-other)))) `(org-upcoming-distant-deadline ((,class (:foreground ,red-nuanced)))) - `(org-verbatim ((,class (:background ,bg-alt :foreground ,fg-special-calm)))) + `(org-verbatim ((,class (:inherit fixed-pitch :background ,bg-alt :foreground ,fg-special-calm)))) `(org-verse ((,class (:inherit org-quote)))) `(org-warning ((,class (:foreground ,blue-intense)))) ;;;; org-journal