diff --git a/ement-room-list.el b/ement-room-list.el index d8eb160..ee3b447 100644 --- a/ement-room-list.el +++ b/ement-room-list.el @@ -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: @@ -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. diff --git a/ement.el b/ement.el index d5f9ad2..53394e3 100644 --- a/ement.el +++ b/ement.el @@ -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.")