mirror of
https://github.com/vale981/ement.el
synced 2025-03-05 09:21:37 -05:00
Tidy: Organization
This commit is contained in:
parent
081502116e
commit
3b5688fd60
1 changed files with 13 additions and 10 deletions
|
@ -1206,6 +1206,19 @@ data slot."
|
||||||
(defvar ement-room-event-fns nil
|
(defvar ement-room-event-fns nil
|
||||||
"Alist mapping event types to functions which process an event of each type in the room's buffer.")
|
"Alist mapping event types to functions which process an event of each type in the room's buffer.")
|
||||||
|
|
||||||
|
(defun ement-room--handle-events (events)
|
||||||
|
"Process EVENTS in current buffer.
|
||||||
|
Calls `ement-progress-update' for each event. Uses handlers
|
||||||
|
defined in `ement-room-event-fns'. The current buffer should be
|
||||||
|
a room's buffer."
|
||||||
|
(cl-loop for event being the elements of events ;; EVENTS may be a list or array.
|
||||||
|
for handler = (alist-get (ement-event-type event) ement-room-event-fns nil nil #'equal)
|
||||||
|
when handler
|
||||||
|
do (funcall handler event)
|
||||||
|
do (ement-progress-update)))
|
||||||
|
|
||||||
|
;;;;;; Event handlers
|
||||||
|
|
||||||
(defmacro ement-room-defevent (type &rest body)
|
(defmacro ement-room-defevent (type &rest body)
|
||||||
"Define an event handling function for events of TYPE.
|
"Define an event handling function for events of TYPE.
|
||||||
Around the BODY, the variable `event' is bound to the event being
|
Around the BODY, the variable `event' is bound to the event being
|
||||||
|
@ -1270,16 +1283,6 @@ function to `ement-room-event-fns', which see."
|
||||||
(ement-room--insert-event event)
|
(ement-room--insert-event event)
|
||||||
(ewoc-set-hf ement-ewoc "" footer)))
|
(ewoc-set-hf ement-ewoc "" footer)))
|
||||||
|
|
||||||
(defun ement-room--handle-events (events)
|
|
||||||
"Process EVENTS in current buffer.
|
|
||||||
Uses handlers defined in `ement-room-event-fns'. The current
|
|
||||||
buffer should be a room's buffer."
|
|
||||||
(cl-loop for event being the elements of events ;; EVENTS may be a list or array.
|
|
||||||
for handler = (alist-get (ement-event-type event) ement-room-event-fns nil nil #'equal)
|
|
||||||
when handler
|
|
||||||
do (funcall handler event)
|
|
||||||
do (ement-progress-update)))
|
|
||||||
|
|
||||||
;;;;; EWOC
|
;;;;; EWOC
|
||||||
|
|
||||||
(defun ement-room--ewoc-next-matching (ewoc node pred)
|
(defun ement-room--ewoc-next-matching (ewoc node pred)
|
||||||
|
|
Loading…
Add table
Reference in a new issue