From 85f42c45aa338b8a8c8ef70cd88ff19352246b78 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 25 Jul 2021 14:45:44 -0500 Subject: [PATCH] Fix: (ement-room--format-message) Prism face for %B --- ement-room.el | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ement-room.el b/ement-room.el index d931cdf..bb0b258 100644 --- a/ement-room.el +++ b/ement-room.el @@ -950,8 +950,7 @@ Format defaults to `ement-room-message-format-spec', which see." (ement-user-id (ement-session-user ement-session))) 'ement-room-self-message) ((eq 'both ement-room-prism) - (list :inherit 'default - :foreground (or (ement-user-color sender) + (list :foreground (or (ement-user-color sender) (setf (ement-user-color sender) (ement-room--user-color sender))))) (t 'default)))) @@ -965,23 +964,21 @@ Format defaults to `ement-room-message-format-spec', which see." ;; HACK: Reads `ement-session' from current buffer. (?b (pcase-let* (((cl-struct ement-event content sender) event) - ((map body) content) - (body-face (body-face))) - (add-face-text-property 0 (length body) body-face 'append body) - body)) + ((map body) content)) + (propertize body 'face (body-face)))) (?B (pcase-let* (((cl-struct ement-event content sender) event) ((map body ('format content-format) ('formatted_body formatted-body)) content) - (body-face (body-face)) (body (if (not formatted-body) - body + ;; Copy the string so as not to add face properties to the one in the struct. + (copy-sequence body) (pcase content-format ("org.matrix.custom.html" (save-match-data (ement-room--render-html formatted-body))) (_ (format "[unknown body format: %s] %s" content-format body)))))) - (add-face-text-property 0 (length body) body-face 'append body) + (add-face-text-property 0 (length body) (body-face) 'append body) body)) (?i (ement-event-id event)) (?s (propertize (ement-user-id (ement-event-sender event))