emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/rcirc-menu 7d9cd61 02/13: rcirc-menu.el: add catching u


From: Stefan Monnier
Subject: [elpa] externals/rcirc-menu 7d9cd61 02/13: rcirc-menu.el: add catching up and updating
Date: Tue, 1 Dec 2020 16:56:11 -0500 (EST)

branch: externals/rcirc-menu
commit 7d9cd61f97d1a8b3a95fd2e440c90d8a379a263a
Author: Alex Schroeder <alex@gnu.org>
Commit: Alex Schroeder <alex@gnu.org>

    rcirc-menu.el: add catching up and updating
    
    c and C will now mark a buffer as read. Changes to the rcirc activity
    string will also update the menu buffer.
---
 rcirc-menu.el | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/rcirc-menu.el b/rcirc-menu.el
index b490f39..6905130 100644
--- a/rcirc-menu.el
+++ b/rcirc-menu.el
@@ -66,6 +66,8 @@
     (define-key map (kbd "M-s a C-s")   'Buffer-menu-isearch-buffers)
     (define-key map (kbd "M-s a M-C-s") 'Buffer-menu-isearch-buffers-regexp)
     (define-key map (kbd "M-s a C-o") 'Buffer-menu-multi-occur)
+    (define-key map "c" 'rcirc-menu-catchup)
+    (define-key map "C" 'rcirc-menu-catchup-all)
 
     (define-key map [mouse-2] 'Buffer-menu-mouse-select)
     (define-key map [follow-link] 'mouse-face)
@@ -78,6 +80,13 @@
       '(menu-item "Refresh" revert-buffer
                 :help "Refresh the *Rcirc Menu* buffer contents"))
     (bindings--define-key menu-map [s0] menu-bar-separator)
+    (bindings--define-key menu-map [cata]
+      '(menu-item "Catch up All" rcirc-menu-catchup-all
+                :help "Mark all buffers as read"))
+    (bindings--define-key menu-map [cat]
+      '(menu-item "Catch up" rcirc-menu-catchup
+                :help "Mark this buffer as read"))
+    (bindings--define-key menu-map [s1] menu-bar-separator)
     (bindings--define-key menu-map [sel]
       '(menu-item "Select Marked" Buffer-menu-select
                 :help "Select this line's buffer; also display buffers marked 
with `>'"))
@@ -217,4 +226,31 @@ elements of ‘tabulated-list-entries’."
                     args))
   (apply '< args))
 
+(defun rcirc-menu-catchup ()
+  "Mark the current buffer as read, i.e. no activity."
+  (interactive)
+  (rcirc-clear-activity (Buffer-menu-buffer t))
+  (run-hooks 'tabulated-list-revert-hook)
+  (tabulated-list-print))
+
+(defun rcirc-menu-catchup-all ()
+  "Mark all the buffers as read, i.e. no activity."
+  (interactive)
+  (dolist (buf (buffer-list))
+    (with-current-buffer buf
+      (when rcirc-activity-types
+       (rcirc-clear-activity buf))))
+  (run-hooks 'tabulated-list-revert-hook)
+  ;; don't move point
+  (tabulated-list-print))
+
+(add-hook 'rcirc-update-activity-string-hook
+         'rcirc-menu-update)
+
+(defun rcirc-menu-update ()
+  "Update the Rcirc Menu buffer, if any."
+  (with-current-buffer (get-buffer-create "*Rcirc Menu*")
+    ;; this will move point
+    (tabulated-list-revert)))
+
 ;;; rcirc-menu.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]