Sunday, September 12, 2010

IRC with ERC

erc is an excellent package to access irc from emacs. This includes an
interface to IDO fast buffer selection. I keep the important password
type vars in private.gpg.

  (require 'erc)

erc-prompt-for-nickserv-password nil
erc-autoaway-idle-seconds 600
erc-autoaway-message "Timed out."
erc-auto-discard-away t

; alert when someone highlights you.
(defun my-erc-nick-match (match-type nickuserhost message)
((eq match-type 'current-nick)
(if (eq (string-match (concat (erc-current-nick) ":") message) 0) (rgr/notify message)))))

(add-hook 'erc-text-matched-hook 'my-erc-nick-match)

; auto truncatebuffers
(defvar erc-insert-post-hook)
(add-hook 'erc-insert-post-hook

(defun rgr/start-erc ()
(unless (erc-already-logged-in "" 6668 "rgr") (erc :server "" :nick "rgr" :password bitl-password :port 6668)) ;
(if (not (erc-already-logged-in "" 6667 "rgr"))
(erc :server "" :nick "rgr" :password erc-password :port 6667)
(switch-to-buffer "#emacs"))) )

; /INFO auto logs the eval line for someone to evaluate to take them to the same INFO page you are currently viewing.
(defun erc-cmd-INFO (&rest ignore)
(erc-send-message (format "Evaluate this using C-x C-e with cursor at closing bracket --> %s" (rgr/info-link))))

; IDO switch between irc channels.
(defun rgr/ido-erc-buffer()
(ido-completing-read "Channel:"
(mapcar (lambda (buf)
(when (buffer-live-p buf)
(with-current-buffer buf
(and (eq major-mode 'erc-mode)
(buffer-name buf)))))

(global-set-key (kbd "C-c e") 'rgr/ido-erc-buffer)

No comments:

Post a Comment