I'm using ERC (with ZNC) as my IRC client. I'm joined to quite a few channels and when I run znc-all all my buffers are restored and the logs are replayed. This is all great.

What I find very annoying, however, is that while replaying the logs each channel buffer is popped to the front and I really can't do any other work at that time.

It's even more annoying when I'm reconnecting automatically after being temporarily disconnected. All of a sudden my work is interrupted by these channel buffers that pop to the front while the channel logs are replayed.

How can I tell ERC/ZNC to keep the buffers in the background when replaying chat logs? I don't want Emacs to ever switch buffers unless I explicitly ask it to switch buffers.

  • What about using dedicated window?
    – Nsukami _
    Commented Dec 21, 2014 at 12:41
  • I don't want to dedicate any window to any of the many buffers I have open, just to prevent ERC from popping its own buffers. I have never used dedicated windows, though. Could you expand on how this can be used to stop ERC from popping buffers without having to mark each of the buffers I could possibly visit as dedicated?
    – user2005
    Commented Dec 23, 2014 at 7:02
  • "without having to mark each of the buffers I could possibly visit as dedicated"? No I can't, I was thinking about mark some windows as dedicated & when inside those windows, no other buffer will popup
    – Nsukami _
    Commented Dec 23, 2014 at 9:28
  • I'm not sure I completely understand the question. Is it that the function znc-all sometimes runs automatically and takes you off whatever you're working on? Could you write a different function which runs automatically which doesn't switch the window? Commented Dec 24, 2014 at 16:19
  • I connect to ZNC on my server at the beginning of my session with znc-all. After connecting, all channel buffers are replayed. Emacs switches from buffer to buffer until the logs for each channel have been replayed. This is (barely) acceptable behaviour when the session starts. It's very annoying, however, when the ZNC connection was interrupted and Emacs reconnects automatically (how? I don't know).
    – user2005
    Commented Dec 24, 2014 at 20:00

1 Answer 1

(setq erc-join-buffer 'bury)

erc-join-buffer is a variable defined in `erc.el'.
Its value is bury
Determines how to display a newly created IRC buffer.

The available choices are:

  'window          - in another window,
  'window-noselect - in another window, but don't select that one,
  'frame           - in another frame,
  'bury            - bury it in a new buffer,
  'buffer          - in place of the current buffer,
  any other value  - in place of the current buffer.
  • Thank you, that's exactly what I was looking for and could not find!
    – user2005
    Commented Jan 5, 2015 at 8:41
  • 3
    Won't this also bury query buffers? I'd see that as a problem, I wouldn't see new private conversations!
    – shapr
    Commented Jan 5, 2015 at 20:59
  • 1
    It does also bury query buffers, yes. I use erc-track though, so anytime someone queries me, I see a tiny letter in the modeline and hit my keybinding for erc-track-switch-buffer as soon as my colleague has stopped peeking over my shoulder. After a while I've come to prefer that over having a big window pop up full of private information.
    – unhammer
    Commented Jun 13, 2017 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.