Skip to content

Instantly share code, notes, and snippets.

@viiru-
Last active November 18, 2023 10:13
Show Gist options
  • Save viiru-/685134a1781816e83df68520a4862599 to your computer and use it in GitHub Desktop.
Save viiru-/685134a1781816e83df68520a4862599 to your computer and use it in GitHub Desktop.
Ement tracking.el integration
(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)
@viiru-
Copy link
Author

viiru- commented Oct 16, 2023

Seems to work exactly the same with the function attached via ement-event-hook. I have updated the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment