branch: externals/ement commit 3563d9447d56025353375958c6a986359adba662 Author: Adam Porter <a...@alphapapa.net> Commit: Adam Porter <a...@alphapapa.net>
Change/Fix: (ement-room-mode) Disable use of window-scroll-functions Disabling this because of some weird behavior. It seems like a race condition exists in which the window-scroll-functions are called, causing the read receipt to get sent, followed by the read-receipt being updated, causing the window-scroll-functions to be called again before the updated receipt is displayed in the buffer, which can cause an infinite loop, which can even exhaust the Lisp stack and cause Emacs to freeze (without 100% CPU usage). At least, that's the best explanation I have so far--it's very weird. Until it's solved, we'll have to do without sending read receipts. Maybe window-scroll-functions isn't suitable for this, even though it seems ideal in theory. Maybe instead we should use a simple idle timer that iterates over windows, or something like that. --- README.org | 5 +++-- ement-room.el | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 50be3eff6a..7b4b1fc987 100644 --- a/README.org +++ b/README.org @@ -273,8 +273,9 @@ Note that, while ~matrix-client~ remains usable, and probably will for some time ** 0.1.3-pre *Fixed* -+ Read receipt-sending function was called too many times when scrolling. -+ Send read receipts even when the last receipt is outside the range of retrieved events. +# + Read receipt-sending function was called too many times when scrolling. +# + Send read receipts even when the last receipt is outside the range of retrieved events. ++ Temporarily disable sending of read receipts due to an unusual bug that could cause Emacs to become unresponsive. (The feature will be re-enabled in a future release.) ** 0.1.2 diff --git a/ement-room.el b/ement-room.el index 96af010f33..2227953d52 100644 --- a/ement-room.el +++ b/ement-room.el @@ -1942,8 +1942,19 @@ and erases the buffer." browse-url-handlers))) (setq-local completion-at-point-functions '(ement-room--complete-members-at-point ement-room--complete-rooms-at-point)) - (setq-local window-scroll-functions - (cons 'ement-room-start-read-receipt-timer window-scroll-functions)) + ;; FIXME: Disabling this because of some weird behavior. It seems like a race condition + ;; exists in which the window-scroll-functions are called, causing the read receipt to + ;; get sent, followed by the read-receipt being updated, causing the + ;; window-scroll-functions to be called again before the updated receipt is displayed in + ;; the buffer, which can cause an infinite loop, which can even exhaust the Lisp stack + ;; and cause Emacs to freeze (without 100% CPU usage). At least, that's the best + ;; explanation I have so far--it's very weird. Until it's solved, we'll have to do + ;; without sending read receipts. Maybe window-scroll-functions isn't suitable for + ;; this, even though it seems ideal in theory. Maybe instead we should use a simple + ;; idle timer that iterates over windows, or something like that. + + ;; (setq-local window-scroll-functions + ;; (cons 'ement-room-start-read-receipt-timer window-scroll-functions)) (setq-local dnd-protocol-alist (append '(("^file:///" . ement-room-dnd-upload-file) ("^file:" . ement-room-dnd-upload-file)) dnd-protocol-alist)))