WIP: Call -room---process-events in -room--buffer

This almost seems to work, in that reactions from old timeline
events are displayed when the buffer is made...or not?  It seems to
work in some cases, but not in others, like when retro-loading...

The big issue now is that the reaction events cause blank events to be
inserted into the buffer.  Fixing that will require conditionally
inserting events, which probably means moving message event handling
into the defevent macro, which will require some more refactoring...
This commit is contained in:
Adam Porter 2021-07-21 19:49:47 -05:00
parent 81757536f2
commit dbfec18e45

View file

@ -456,14 +456,18 @@ data slot."
(visual-line-mode 1)
(setf ement-session session
ement-room room)
;; FIXME: Some code is duplicated here and in `ement--update-room-buffers'.
;; Move new events to the main timeline slot first, because some events can
;; refer to other events, and we want them to be found in the timeline slot.
(setf (ement-room-timeline ement-room) (append (ement-room-timeline* ement-room)
(ement-room-timeline ement-room))
(ement-room-timeline* room) nil)
;; We don't use `ement-room--insert-events' to avoid extra
;; calls to `ement-room--insert-ts-headers'.
;; FIXME: Unify these event-insertion calls.
(mapc #'ement-room--insert-event (ement-room-timeline room))
(mapc #'ement-room--insert-event (ement-room-timeline* room))
(ement-room--process-events (ement-room-timeline room))
(ement-room--insert-ts-headers)
;; Move new events to main list.
(setf (ement-room-timeline room) (append (ement-room-timeline* room) (ement-room-timeline room))
(ement-room-timeline* room) nil)
;; Track buffer in room's slot.
(setf (map-elt (ement-room-local ement-room) 'buffer) (current-buffer))
(add-hook 'kill-buffer-hook