Skip to content

Instantly share code, notes, and snippets.

@ivikash
Created October 27, 2011 17:41
Show Gist options
  • Save ivikash/1320252 to your computer and use it in GitHub Desktop.
Save ivikash/1320252 to your computer and use it in GitHub Desktop.
.ercrc.el
;; ERC config
;; Copyright (C) 2011 - Vikash Agrawal
;; Author: Vikash Agrawal <[email protected]>
;; Keywords: local
;; This file is NOT part of GNU Emacs.
;; This is free software; you can redistribute it and/or modify it under
;; the terms of the GNU General Public License as published by the Free
;; Software Foundation; either version 2, or (at your option) any later
;; version.
;; This file is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with Emacs; see the file COPYING, or type `C-h C-c'. If not,
;; write to the Free Software Foundation at this address:
;;; Code
;; Main Settings
(setq erc-nick "vikash"
erc-user-full-name "Vikash Agrawal"
erc-email-userid "[email protected]"
erc-auto-query 'bury
erc-join-buffer 'bury
erc-hide-list '("JOIN" "PART" "QUIT")
erc-log-channels-directory nil)
;; Extra Mode settings
(require 'erc-match)
(setq erc-keywords '("vikash" "Vikash"))
(erc-match-mode)
(erc-scrolltobottom-mode t)
;; Don't track boring activity
(require 'erc-track)
(erc-track-mode t)
(setq erc-track-exclude '("*highlight") ;; ZNC highlight buffer
erc-track-exclude-server-buffer t
erc-track-exclude-types
'("JOIN" "NICK" "PART" "QUIT" "MODE"
"324" "329" "332" "333" "353" "477"))
(require 'erc-ring)
(erc-ring-mode t)
(require 'erc-netsplit)
(erc-netsplit-mode t)
(require 'erc-spelling)
(erc-spelling-mode 1)
(erc-timestamp-mode t)
(setq erc-timestamp-format "[%R]")
;; Kill buffers when disconnected or parted
(setq erc-kill-buffer-on-part t
erc-kill-queries-on-quit t
erc-kill-server-buffer-on-quit t)
;; Truncate buffers to stop some sluggishness
(setq erc-max-buffer-size 20000)
(erc-truncate-mode t)
(defun erc-cmd-CLEAR ()
"Clears the current buffer"
(erc-truncate-buffer-to-size 0))
(defun erc-cmd-CLEARALL ()
"Clears all ERC buffers"
(mapc (lambda (buffer)
(erc-truncate-buffer-to-size 0 (get-buffer buffer)))
(erc-all-buffer-names)))
;; Autojoin
(erc-autojoin-mode t)
(setq erc-autojoin-channels-alist
'((".*gimp.*" "#gnome" "#gnome-love")
(".*mozilla.org" "#firefox" "#introduction")
(".*freenode.net" "#lugmanipal" "#gsoc" "##linux-india" "##c" "#python" "#xcb" "#xorg-devel")))
(defun djcb-erc-start-or-switch ()
"Connect to ERC, or switch to last active buffer"
(interactive)
(if (get-buffer "irc.freenode.net:6667") ;; ERC already active?
(erc-track-switch-buffer 1) ;; yes: switch to last active
(when (y-or-n-p "Start ERC? ") ;; no: maybe start ERC
(erc :server "irc.gimp.org" :port 6667 :nick "vikash")
(erc :server "irc.mozilla.org" :port 6667 :nick "vikash")
(erc :server "irc.freenode.net" :port 6667 :nick "vikash"))))
;; Fill text and try to align it on the same column.
(setq erc-fill-column 150
erc-fill-function 'erc-fill-static
erc-fill-static-center 4)
;; Queries in new buffers, notices in current buffer.
(setq erc-auto-query t
erc-echo-notice-always-hook '(erc-echo-notice-in-active-buffer))
;; ; Logs
(setq erc-log-channels-directory "~/erc/logs/")
(defadvice save-buffers-kill-emacs (before save-logs (arg) activate)
(save-some-buffers t (lambda () (when (eq major-mode 'erc-mode) t))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment