Add: Auto-update room list buffer

This commit is contained in:
Adam Porter 2021-07-29 04:35:21 -05:00
parent 6fefd3c075
commit d56c1bb4ec
2 changed files with 19 additions and 1 deletions

View file

@ -64,6 +64,14 @@
;;;; Customization
(defgroup ement-room-list nil
"Options for the room list buffer."
:group 'ement)
(defcustom ement-room-list-auto-update t
"Automatically update the room list buffer."
:type 'boolean)
;;;; Bookmark support
;; Especially useful with Burly: <https://github.com/alphapapa/burly.el>
@ -157,6 +165,15 @@ call `pop-to-buffer'."
;;;; Functions
(defun ement-room-list-auto-update (_session)
"Automatically update the room list buffer.
Does so when variable `ement-room-list-auto-update' is non-nil.
To be called in `ement-sync-callback-hook'."
(when (and ement-room-list-auto-update
(buffer-live-p (get-buffer "*Ement Rooms*")))
(with-current-buffer (get-buffer "*Ement Rooms*")
(revert-buffer))))
(defun ement-room-list--set-entries ()
"Set `tabulated-list-entries'."
;; Reset avatar size in case default font size has changed.

View file

@ -75,7 +75,8 @@
(defvar ement-progress-value nil
"Used to report progress while processing sync events.")
(defvar ement-sync-callback-hook '(ement--update-room-buffers ement--auto-sync)
(defvar ement-sync-callback-hook
'(ement--update-room-buffers ement--auto-sync ement-room-list-auto-update)
"Hook run after `ement--sync-callback'.
Hooks are called with one argument, the session that was
synced.")