emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ement 3e4e84d7a9 14/15: Add: (defconst ement-room-varia


From: ELPA Syncer
Subject: [elpa] externals/ement 3e4e84d7a9 14/15: Add: (defconst ement-room-variable-pitch-face)
Date: Tue, 19 Mar 2024 21:57:59 -0400 (EDT)

branch: externals/ement
commit 3e4e84d7a978eebda8c231683a4e19bc87af7e55
Author: Phil Sainty <phil@catalyst.net.nz>
Commit: Adam Porter <adam@alphapapa.net>

    Add: (defconst ement-room-variable-pitch-face)
    
    Minor optimisation; we only need to establish this value once.
---
 ement-room.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/ement-room.el b/ement-room.el
index 570e6ec050..28de04ce24 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -1306,6 +1306,18 @@ spec) without requiring all events to use the same 
margin width."
               'help-echo (format-time-string "%Y-%m-%d %H:%M:%S"
                                              (/ (ement-event-origin-server-ts 
event) 1000))))
 
+(defconst ement-room-variable-pitch-face (or (and (facep 'shr-text) 'shr-text)
+                                             'variable-pitch)
+  "May be used when formatting plain-text messages.
+
+If user option `ement-room-use-variable-pitch' is non-nil, this
+face is applied to plain-text messages for visual consistency
+with HTML messages (which will be rendered by shr.el with
+`shr-use-fonts' enabled).
+
+The `shr-text' face was added in Emacs 29.1.  Prior to that,
+shr.el used the `variable-pitch' face directly.")
+
 (defun ement-room--event-body-face (event room session)
   "Return face definition for EVENT in ROOM on SESSION."
   (ignore room)  ;; Unused for now, but keeping for consistency.
@@ -1345,9 +1357,7 @@ spec) without requiring all events to use the same margin 
width."
                (shr-text-face (when (and ement-room-use-variable-pitch
                                          (not (equal (or format (alist-get 
'format new-content))
                                                      
"org.matrix.custom.html")))
-                                ;; The `shr-text' face was added in Emacs 29.1.
-                                (or (and (facep 'shr-text) 'shr-text)
-                                    'variable-pitch)))
+                                ement-room-variable-pitch-face))
                (body-face (list :inherit (delq nil (list redacted-face 
context-face type-face shr-text-face)))))
     (if prism-color
         (plist-put body-face :foreground prism-color)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]