rcirc for all my IRC needs and let it run on my server in a dedicated
Emacs instance hosted in a
tmux session. That process usually runs for many
days or even weeks.
rcirc puts a timestamp in the format
"HH:MM " in front of every
activity (someone writing a message, JOIN/PART/QUIT notifications, etc.).
That's allright when you are closely watching a channel. However, it sometimes
happens that I ask something and eventually leave my tmux session and don't
come back for days. When coming back, I might see I got a response and check
it out but it's hard to impossible to tell when (on which date) that response
has been given.
So I've tried adding the date to
rcirc-time-format in addition to the time.
That works fine but is not satisfactory because it uses up so much vertical
Then I thought that timestamps are pretty much irrelevant when there is a heated discussion ongoing while they are quite interesting when there's not much activity. That brought me to the idea of hacking something together which would suppress printing of timestamps for one minute after an activity so that I have at most one timestamp per minute.
The first thing is that I customized the timestamp format to contain both date and time with a trailing newline so that they are printed on their own line instead preceding the activity text.
(setq rcirc-time-format "%F %H:%M\n")
The actual suppression of timestamps is implemented by the following function.
(defun th/rcirc-suppress-timestamp-1-min (process sender response target text) (let (;; Find the buffer where the activity will be written to. (buffer (rcirc-target-buffer process sender response target text)) ;; Remember the default (customized) timestamp format. (ts (default-value 'rcirc-time-format))) ;; If the current rcirc-time-format is not "" and... (when (and (not (string-empty-p rcirc-time-format)) ;; ... rcirc-omit-mode is disabled or ... (or (null rcirc-omit-mode) ;; ... the current response is not omitted... (not (member response rcirc-omit-responses)))) ;; ... then set rcirc-time-format to the empty string ;; buffer-locally and ... (set-buffer buffer) (setq-local rcirc-time-format "") ;; ... restore the original value after 60 seconds. (run-at-time 60 nil (lambda () (set-buffer buffer) (setq-local rcirc-time-format ts))))))
That function needs to be added to
rcirc-print-functions so that it's invoked
after each insertion of text into an rcirc buffer.
(add-hook 'rcirc-print-functions #'th/rcirc-suppress-timestamp-1-min)
And that's how it looks.
Back to the blog by tags or to the overview of all posts.
Also, you can subscribe to my rss feed.