]> git.eshelyaron.com Git - emacs.git/commitdiff
Add mouse properties to activity string
authorPhilip Kaludercic <philipk@posteo.net>
Sun, 13 Jun 2021 19:10:25 +0000 (21:10 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Sun, 13 Jun 2021 22:21:48 +0000 (00:21 +0200)
* rcirc.el (rcirc-activity-string): Allow clicking on string

lisp/net/rcirc.el

index 400facf3440cdc3c9625dbc7215add27519aad3d..9fdbf12cd89ba01f85cb8c46601271ae63e9016e 100644 (file)
@@ -2211,7 +2211,6 @@ activity.  Only run if the buffer is not visible and
 (defvar rcirc-update-activity-string-hook nil
   "Hook run whenever the activity string is updated.")
 
-;; TODO: add mouse properties
 (defun rcirc-update-activity-string ()
   "Update mode-line string."
   (let* ((pair (rcirc-split-activity rcirc-activity))
@@ -2238,12 +2237,17 @@ activity.  Only run if the buffer is not visible and
               (let ((s (substring-no-properties (rcirc-short-buffer-name b))))
                 (with-current-buffer b
                   (dolist (type rcirc-activity-types)
-                    (rcirc-add-face 0 (length s)
-                                    (cl-case type
+                     (rcirc-facify s (cl-case type
                                       (nick 'rcirc-track-nick)
-                                      (keyword 'rcirc-track-keyword))
-                                    s)))
-                s))
+                                      (keyword 'rcirc-track-keyword)))))
+                 (let ((map (make-mode-line-mouse-map
+                             'mouse-1
+                             (lambda ()
+                               (interactive)
+                               (pop-to-buffer b)))))
+                   (propertize s
+                               'mouse-face 'mode-line-highlight
+                               'local-map map))))
             buffers ","))
 
 (defun rcirc-short-buffer-name (buffer)