emacs-diffs
[Top][All Lists]
Advanced

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

feature/rcirc-update e17cc75 3/8: Add mouse properties to activity strin


From: Philip Kaludercic
Subject: feature/rcirc-update e17cc75 3/8: Add mouse properties to activity string
Date: Tue, 15 Jun 2021 12:46:41 -0400 (EDT)

branch: feature/rcirc-update
commit e17cc751baa17f142fbc41710bf645f6fdc64a80
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Add mouse properties to activity string
    
    * rcirc.el (rcirc-activity-string): Allow clicking on string
---
 lisp/net/rcirc.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 400facf..9fdbf12 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -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)



reply via email to

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