ement.el icon indicating copy to clipboard operation
ement.el copied to clipboard

tracking.el support

Open alphapapa opened this issue 4 years ago • 4 comments

Wibjarm posted this in #ement.el:matrix.org:

So it turns out to be conveniently simple to plug ement into the modeline channel tracking from circe and get my preferred setup of "tag in the modeline on new messages, desktop notification on mentions"

(defun my/ement-notify-track-if-buffer (event room session)
    (when (ement-notify--room-buffer-live-p event room session)
      (tracking-add-buffer (map-elt (ement-room-local room) 'buffer))))

It's literally just adding this to ement-notify-functions

I'm not sure what the best thing to do now is: add this to the readme as a simple example of code users can copy into their config, put it in an ement-tracking.el file that users can load, or put it into ement-notify.el in a way that avoids compile-time, load-time, and run-time warnings.

alphapapa avatar Aug 14 '21 22:08 alphapapa

Any clues on how one might implement this in the current codebase as ement-notify-functions no longer exists since commit 70da19e4c921?

viiru- avatar Jan 29 '23 10:01 viiru-

Here is how I ended up doing this on version 0.5.2:

(cl-defun viiru/ement-notify-track-if-buffer (event room session &key (buffer-name "*Ement Notifications*"))
  (with-demoted-errors "viiru/ement-notify-track-if-buffer: %S"
    (when (ement-notify--room-buffer-live-p event room session)
      (tracking-add-buffer (map-elt (ement-room-local room) 'buffer)))))

(advice-add 'ement-notify--log-to-buffer :after #'viiru/ement-notify-track-if-buffer)

viiru- avatar Feb 02 '23 12:02 viiru-

Where do I get the "tracking-add-buffer" function from? Circe?

Ok, I didn't get it running. I also think, if you should use some foreign tracking library, perhaps use one that is included in vanilla emacs? the one from ERC?

mokrates avatar Sep 15 '23 12:09 mokrates

No, this is based on tracking.el from circe. The current version of my setup is here: https://gist.github.com/viiru-/685134a1781816e83df68520a4862599

I also do a bunch of other stuff to adjust how the room names are shortened and so on (to get closer to what I had under ERC), but those are easy enough to adjust to taste.

viiru- avatar Sep 15 '23 16:09 viiru-