Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

Marking Emacs chat buffers as read (erc, jabber, etc)

I’m an occasional user of some of the Emacs chat clients. Erc and jabber are both powerful packages, and it’s great to be able to use Slack, Gitter, and Google Chat from the cosy comfort of my Emacs frame. If I have one complain, though, it’s that neither of them has a functionality for keeping track of what part of the conversation I’ve already read.

Of course, this is Emacs. And the solution is but a hack away.

(defun endless/mark-read ()
  "Mark buffer as read up to current line."
  (let ((inhibit-read-only t))
     (point-min) (line-beginning-position)
     'face       'font-lock-comment-face)))

(defun endless/bury-buffer ()
  "Bury buffer and maybe close its window."
  (when (cdr (window-list nil 'nomini))

(eval-after-load 'jabber
  '(define-key jabber-chat-mode-map (kbd "<escape>")

(eval-after-load 'erc
  '(define-key erc-mode-map (kbd "<escape>")

Whenever you’re done reading a conversation, just hit Esc. The buffer will be buried, and next time you open it again everything you had read before will be marked in grey.

Tags: erc, keybind, emacs,

comments powered by Disqus