[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rcirc-menu 0a5a113 05/13: rcirc-menu.el: fontify activi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rcirc-menu 0a5a113 05/13: rcirc-menu.el: fontify activity column |
Date: |
Tue, 1 Dec 2020 16:56:11 -0500 (EST) |
branch: externals/rcirc-menu
commit 0a5a1130ba3ab815afdd1131639c08d5f5ad4d27
Author: Alex Schroeder <alex@gnu.org>
Commit: Alex Schroeder <alex@gnu.org>
rcirc-menu.el: fontify activity column
---
rcirc-menu.el | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/rcirc-menu.el b/rcirc-menu.el
index e875c3e..0d801ed 100644
--- a/rcirc-menu.el
+++ b/rcirc-menu.el
@@ -194,9 +194,7 @@ In Rcirc Menu mode, the following commands are defined:
(or rcirc-target "") ;; "Target"
(with-current-buffer rcirc-server-buffer
rcirc-server-name) ;; "Server"
- (mapconcat (lambda (s) (if s (symbol-name s) "yes"))
- rcirc-activity-types
- ", "))) ;; "Activity"
+ (rcirc-menu-activity))) ;; "Activity"
entries))))
(setq tabulated-list-entries (nreverse entries)))
(tabulated-list-init-header))
@@ -216,16 +214,43 @@ elements of ‘tabulated-list-entries’."
(defun rcirc-menu-sort-activity (&rest args)
"Sort by activity.
ARGS is a list of two elements having the same form as the
-elements of ‘tabulated-list-entries’."
+elements of ‘tabulated-list-entries’. At this point, we only have
+the comma-separated string produced by `rcirc-menu-activity' in
+the vector. The alternative is to simply visit the buffers and
+examine `rcirc-activity-types'."
+ (setq args (mapcar (lambda (v)
+ (let ((buf (car v)))
+ (with-current-buffer buf
+ (cond ((memq 'nick rcirc-activity-types) 1)
+ ((memq 'keyword rcirc-activity-types) 2)
+ (rcirc-activity-types 3)
+ (t 4)))))
+ args))
+ (apply '< args))
+
+(defun rcirc-menu-sort-activity-symbols (&rest args)
+ "Sort by activity symbols.
+ARGS are symbols from `rcirc-activity-types'."
(setq args (mapcar (lambda (v)
- (let ((s (aref (cadr v) 4)))
- (cond ((string-match "nick" s) 1)
- ((string-match "key" s) 2)
- ((string-match "yes" s) 3)
- (t 4))))
+ (cond ((eq v 'nick) 1)
+ ((eq v 'keyword) 2)
+ ((not v) 3)
+ (t 4)))
args))
(apply '< args))
+(defun rcirc-menu-activity ()
+ "Return string describing activity in the current buffer."
+ (mapconcat (lambda (s)
+ (cond ((eq s 'nick)
+ (rcirc-facify "nick" 'rcirc-track-nick))
+ ((eq s 'keyword)
+ (rcirc-facify "keyword" 'rcirc-track-keyword))
+ (t "yes")))
+ (sort (copy-sequence rcirc-activity-types)
+ 'rcirc-menu-sort-activity-symbols)
+ ", "))
+
(defun rcirc-menu-catchup ()
"Mark the current buffer or the marked buffers as read.
This resets their activity."
- [elpa] branch externals/rcirc-menu created (now e25dbac), Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu bd5b548 01/13: Add rcirc-menu, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu 7d9cd61 02/13: rcirc-menu.el: add catching up and updating, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu 4e9c6d1 03/13: rcirc-menu.el: make rcirc-menu-update more resilient, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu f1e0d9f 04/13: rcirc-menu.el: catchup marked buffers, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu 3372cf1 07/13: rcirc-menu.el: explain what T and P are, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu a02d79a 09/13: rcirc-menu: fix tabulated lists everywhere, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu e5cd887 10/13: rcirc-menu: reset activity string when catching up, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu 0a5a113 05/13: rcirc-menu.el: fontify activity column,
Stefan Monnier <=
- [elpa] externals/rcirc-menu 56794b4 06/13: rcirc-menu.el: guess target when rcirc-target is nil, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu add03f4 08/13: * rcirc-menu, rcirc-color: Fix copyright, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu 40eb60c 11/13: rcirc-menu: server buffer activity sorts lower, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu e25dbac 13/13: * .gitignore: New file, Stefan Monnier, 2020/12/01
- [elpa] externals/rcirc-menu 01ce122 12/13: * packages/rcirc-menu/rcirc-menu.el: Fix first line, Stefan Monnier, 2020/12/01