[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement bb73293540 1/3: Change: use dedicated buffer for
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ement bb73293540 1/3: Change: use dedicated buffer for message rendering, formatting |
Date: |
Sun, 24 Sep 2023 03:58:14 -0400 (EDT) |
branch: externals/ement
commit bb7329354070931fdb16cfeaee4f682ce549ea14
Author: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Commit: Adam Porter <adam@alphapapa.net>
Change: use dedicated buffer for message rendering, formatting
(ement-room--format-message):
(ement-room--render-html):
Prefer single buffer over allocating temp-buffer for each call.
This should be perform better and reduce garbage.
See: #209
---
ement-room.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ement-room.el b/ement-room.el
index a17c4cd87f..56da26672a 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -3375,13 +3375,14 @@ Format defaults to `ement-room-message-format-spec',
which see."
(left-margin-width ement-room-left-margin-width)
(right-margin-width ement-room-right-margin-width))
;; Copied from `format-spec'.
- (with-temp-buffer
+ (with-current-buffer (get-buffer-create " *ement-room--format-message*")
;; Pretend this is a room buffer.
(setf ement-session session
ement-room room)
;; HACK: Setting these buffer-locally in a temp buffer is ugly.
(setq-local ement-room-left-margin-width left-margin-width)
(setq-local ement-room-right-margin-width right-margin-width)
+ (erase-buffer)
(insert format)
(goto-char (point-min))
(while (search-forward "%" nil t)
@@ -3512,7 +3513,8 @@ If FORMATTED-P, return the formatted body content, when
available."
(defun ement-room--render-html (string)
"Return rendered version of HTML STRING.
HTML is rendered to Emacs text using `shr-insert-document'."
- (with-temp-buffer
+ (with-current-buffer (get-buffer-create " *ement-room--render-html*")
+ (erase-buffer)
(insert string)
(save-excursion
;; NOTE: We workaround `shr`'s not indenting the blockquote properly (it