Download
(add-hook 'erc-mode-hook 'turn-on-eldoc-mode)
(add-hook 'erc-mode-hook (lambda () (abbrev-mode 1)))
(defface erc-prompt-face '((t (:foreground "yellow" :bold t)))
"ERC prompt.")
(add-to-list 'load-path "/home/alex/src/erc")
(require 'erc-auto)
(autoload 'erc "erc")
(setq erc-modules '(netsplit fill track completion ring button autojoin
smiley services match stamp track page bbdb))
(add-hook 'erc-mode-hook (lambda () (setq truncate-partial-width-windows nil)))
(eval-after-load "erc-button"
'(progn
(add-to-list 'erc-nick-popup-alist '("BBDB" . (bbdb nick nil)))
(add-to-list 'erc-nick-popup-alist
'("EmacsWiki" . (erc-browse-emacswiki nick)))))
(global-set-key (kbd "C-c e") 'switch-to-irc)
(defun switch-to-irc ()
"Switch to an IRC buffer, or run `erc-select'.
When called repeatedly, cycle through the buffers."
(interactive)
(let ((buffers (and (fboundp 'erc-buffer-list)
(erc-buffer-list))))
(when (eq (current-buffer) (car buffers))
(bury-buffer)
(setq buffers (cdr buffers)))
(if buffers
(switch-to-buffer (car buffers))
(erc "localhost" 6667 erc-nick erc-user-full-name t)
(erc "irc.freenode.net" erc-port erc-nick erc-user-full-name t))))
(setq erc-server "irc.freenode.net"
erc-port 6667
erc-nick "kensanata"
erc-user-full-name user-full-name
erc-prompt-for-password nil
erc-auto-query 'window-noselect
erc-log-channels t
erc-pals '("delysid" "johnw" "gbvb" "Lathi" "deego" "liiwi" "resolve" "shapr"
"forcer" "JoiIto" "dsifry" "aadis" "utis" "bojohan" "pgas")
erc-fools nil
erc-ignore-list '("j[a-z]*bot" "shorten")
erc-fool-highlight-type 'all
erc-current-nick-highlight-type 'nick
erc-keywords '("color-theme" "\\bken\\b" "\\bkens\\b"
"\\bkenalex\\b" "\\bkenny\b" "\\balex\\b")
erc-fill-prefix " "
erc-fill-column 90
erc-timestamp-right-column 61
erc-track-showcount t
erc-track-shorten-function nil
erc-timestamp-only-if-changed-flag nil
erc-insert-timestamp-function 'erc-insert-timestamp-left
erc-timestamp-format "%H:%M "
erc-log-channels-directory "/home/alex/.irc"
erc-log-insert-log-on-open nil
erc-generate-log-file-name-function 'erc-generate-log-file-name-with-date
erc-server-history-list '("localhost"
"irc.oftc.net"
"irc.lugs.ch"
"irc.inet.tele.dk"
"Geneva.CH.EU.undernet.org")
erc-text-matched-hook '(erc-log-matches)
erc-encoding-coding-alist (mapcar (lambda (i) (cons i 'latin-1))
'("mama" "hans-peter" "dom" "norbert" "rw"
"JakubUSA" "Sektat" "oli"))
erc-nickserv-passwords '((freenode (("kensanata" . "Habakuck")))))
(defun erc-directed-at-fool-p (msg)
"Check whether MSG is about a fool."
(erc-list-match erc-fools msg))
(add-hook 'erc-insert-pre-hook
(lambda (s)
(when (erc-foolish-content s)
(setq erc-insert-this nil))))
(defcustom erc-foolish-content '("^<.*?> \\?" "^<.*?> , *rr"
"\\*CLICK\\*" "\\*BANG\\*")
"Regular expressions to identify foolish content.
Usually what happens is that you add the bots to
`erc-ignore-list' and the bot commands to this list."
:group 'erc
:type '(repeat regexp))
(defun erc-foolish-content (msg)
"Check whether MSG is foolish."
(erc-list-match erc-foolish-content msg))
(defun erc-cmd-REVERSE (&rest words)
(if words
(erc-send-message (apply 'concat
(reverse (split-string (mapconcat 'identity words " ")
""))))
(let ((limit (- (point) 1000))
(pos (point))
text)
(while (and pos (not (let ((data (get-text-property pos 'erc-parsed)))
(and data (string= (aref data 0) "PRIVMSG")))))
(setq pos (previous-single-property-change pos 'erc-parsed nil limit)))
(if pos
(erc-display-message nil 'notice 'active
(apply 'concat
(reverse (split-string (aref (get-text-property pos
'erc-parsed)
3) ""))))
(erc-display-message nil 'notice 'active "Nothing to reverse")))))
(defun erc-cmd-SPOOK (&rest ignore)
"Send a spooky list of keywords."
(let* ((spook (with-temp-buffer (spook) (buffer-string)))
(output (replace-regexp-in-string "\n" " " spook)))
(erc-send-message output)))
(defun erc-cmd-INFO (&rest ignore)
"Send current info node."
(unless (get-buffer "*info*")
(error "No *info* buffer"))
(let (output)
(with-current-buffer "*info*"
(let* ((file (file-name-nondirectory Info-current-file))
(node Info-current-node))
(setq output (format "(info \"(%s)%s\") <-- hit C-x C-e to evaluate"
file node))))
(erc-send-message output)))
(autoload 'make-doctor-variables "doctor")
(autoload 'doctor-doc "doctor")
(defun erc-cmd-DOCTOR (&rest ignore)
"Get the last message in the channel and doctor it."
(let ((limit (- (point) 1000))
(pos (point))
text)
(while (and pos (not (let ((data (get-text-property pos 'erc-parsed)))
(and data (string= (aref data 0) "PRIVMSG")))))
(setq pos (previous-single-property-change pos 'erc-parsed nil limit)))
(when pos
(setq text (mapcar (lambda (s)
(intern (downcase s)))
(split-string (aref (get-text-property pos 'erc-parsed) 3))))
(erc-send-message
(save-excursion
(if (get-buffer "*ERC Doctor*")
(set-buffer "*ERC Doctor*")
(set-buffer (get-buffer-create "*ERC Doctor*"))
(make-doctor-variables))
(erase-buffer)
(doctor-doc text)
(buffer-string))))))
(defun erc-cmd-SAVE (&rest ignore)
"Save your soul!"
(erc-send-message "i'm using the ONE TRUE EDITOR!!!"))
(defun erc-cmd-KOI (&rest words)
"Send text as koi8."
(if words
(let ((erc-default-coding-system 'koi8))
(erc-send-message (mapconcat 'identity words " ")))
(let ((limit (- (point) 1000))
(pos (point))
text)
(while (and pos (not (let ((data (get-text-property pos 'erc-parsed)))
(and data (string= (aref data 0) "PRIVMSG")))))
(setq pos (previous-single-property-change pos 'erc-parsed nil limit)))
(if pos
(erc-display-message nil 'notice 'active
(decode-coding-string
(string-make-unibyte
(aref (get-text-property pos 'erc-parsed) 3))
'koi8))
(erc-display-message nil 'notice 'active "No text to recode")))))