branch: externals/rcirc-menu commit e5cd88718503dd2d93a281ea62ee3236fdb716ec Author: Alex Schroeder <a...@gnu.org> Commit: Alex Schroeder <a...@gnu.org>
rcirc-menu: reset activity string when catching up The rcirc activity string only gets updated when there is any new activity to record, or the window configuration changes. This is particularly noticeable after doing a catchup all for the rcirc-menu: the activity string in the modeline might remain unchanged for quite a while. This commit calls rcirc-update-activity-string after catching up and makes sure that rcirc-update-activity-string-hook is bound to a value without rcirc-menu-update while doing so, in order to prevent the rcirc-menu-update from calling tabulated-list-revert because we don't like to revert. Reverting moves point and the existing catchup code carefully avoids it by calling tabulated-list-print without the remember-pos argument. --- rcirc-menu.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rcirc-menu.el b/rcirc-menu.el index 4e13f893..e7cf0e3 100644 --- a/rcirc-menu.el +++ b/rcirc-menu.el @@ -5,7 +5,7 @@ ;; Author: Alex Schroeder <a...@gnu.org> ;; Maintainer: Alex Schroeder <a...@gnu.org> ;; Created: 2017-08-10 -;; Version: 1.0 +;; Version: 1.1 ;; Keywords: comm ;; This file is part of GNU Emacs. @@ -268,8 +268,7 @@ This resets their activity." (buffers (or marked-buffers this-buffer))) (dolist (buf buffers) (rcirc-clear-activity buf))) - (run-hooks 'tabulated-list-revert-hook) - (tabulated-list-print)) + (rcirc-menu-catchup-finish)) (defun rcirc-menu-catchup-all () "Mark all the buffers as read, i.e. no activity." @@ -278,8 +277,17 @@ This resets their activity." (with-current-buffer buf (when rcirc-activity-types (rcirc-clear-activity buf)))) + (rcirc-menu-catchup-finish)) + +(defun rcirc-menu-catchup-finish () + "Update buffer and activity string after catching up." + ;; Don't call rcirc-menu-update which reverts the tabulated list. + (let ((rcirc-update-activity-string-hook + (delete 'rcirc-menu-update rcirc-update-activity-string-hook))) + (rcirc-update-activity-string)) + ;; These two are from `tabulated-list-revert' but we don't want to + ;; move point. (run-hooks 'tabulated-list-revert-hook) - ;; don't move point (tabulated-list-print)) (add-hook 'rcirc-update-activity-string-hook