Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use ZNC to connect to IRC, and since ZNC seems to have the unfortunate characteristic of making me create a new "login" for each server I want to connect to (i.e Freenode and Quakenet), when erc starts I have a bunch of buffers all named the same thing.

My erc config looks like:

(defun djcb-erc-start-or-switch ()
  "Connect to ERC, or switch to last active buffer"
  (if (get-buffer "") ;; ERC already active?

    (erc-track-switch-buffer 1) ;; yes: switch to last active
    (when (y-or-n-p "Start ERC? ") ;; no: maybe start ERC
      ;; I use ZNC so I need to hit my server
      (erc :server "" :port 60667 :nick "nick1")
      (erc :server "" :port 60667 :nick "nick2")

How can I get it to start and alias the server buffer names for nick1 to Freenode and nick2 to whateverrandomserver?

share|improve this question
This should be simple, but ERC is heavily magical around the mode line so it's not; I tried hooking erc-mode-hook and renaming the buffer, but there's an automated mode line update that instantly stepped on my change. Best advice I have is to spend some time staring at the definition of erc-update-mode-line-buffer and frowning mightily; it seems like some around-advice that plays with the values in the format spec might work well, but I ran out of time to play with it before I found something that actually does the job. HTH -- – Aaron Miller Nov 13 '13 at 16:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.