Last active
November 18, 2023 10:13
-
-
Save viiru-/685134a1781816e83df68520a4862599 to your computer and use it in GitHub Desktop.
Ement tracking.el integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cl-defun viiru/ement-notify-track (event room session &key (buffer-name "*Ement Notifications*")) | |
(with-demoted-errors "viiru/ement-notify-track-if-buffer: %S" | |
(when (ement-notify--event-message-p event room session) | |
(let ((buffer (if (ement-notify--room-buffer-live-p event room session) | |
(map-elt (ement-room-local room) 'buffer) | |
(when (ement-notify--room-unread-p event room session) | |
(get-buffer buffer-name)))) | |
(faces (if (ement-notify--room-unread-p event room session) | |
'(ement-room-list-direct) | |
'(default)))) | |
(when buffer | |
(tracking-add-buffer buffer faces)))))) | |
(add-hook 'ement-event-hook #'viiru/ement-notify-track) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems to work exactly the same with the function attached via ement-event-hook. I have updated the gist.