Last active
December 12, 2015 10:18
-
-
Save webframp/4757596 to your computer and use it in GitHub Desktop.
Working ERC settings used with IRCRelay. Securely stores password and provides growl notifications for mentions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'erc) | |
(require 'netrc) | |
(setq erc-user-full-name "Sean Escriva" | |
erc-part-reason-various-alist '(("^$" "Leaving")) | |
erc-quit-reason-various-alist '(("^$" "Leaving")) | |
erc-quit-reason 'erc-part-reason-various | |
erc-part-reason 'erc-quit-reason-various) | |
(add-hook 'erc-mode-hook (lambda () (auto-fill-mode 0))) | |
(add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs) | |
;; Track channel activity in mode-line | |
(require 'erc-track) | |
(erc-track-mode t) | |
(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" | |
"324" "329" "332" "333" "353" "477")) | |
(setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK")) ;; stuff to hide! | |
;; ;; autojoin - not needed with ircrelay | |
;; (require 'erc-join) | |
;; (erc-autojoin-mode t) | |
;; (setq erc-autojoin-channels-alist | |
;; '((".*\\.freenode." "#chef" "#chef-hacking") | |
;; (".*\\ircrelay.com") | |
;; ) | |
;; ) | |
;; Highlight some keywords | |
(require 'erc-match) | |
(setq erc-keywords '("\\bSean\\b" "\\bwebframp\\b" "\\bSean Escriva\\b" "\\bsme\\b")) | |
;; enable an input history | |
(require 'erc-ring) | |
(erc-ring-mode t) | |
;; wrap long lines | |
(require 'erc-fill) | |
(erc-fill-mode t) | |
;; detect netsplits | |
(require 'erc-netsplit) | |
(erc-netsplit-mode t) | |
;; spellcheck | |
(erc-spelling-mode t) | |
(require 'erc-hl-nicks) | |
;; Truncate buffers so they don't hog core. | |
(setq erc-max-buffer-size 40000) | |
(defvar erc-insert-post-hook) | |
(add-hook 'erc-insert-post-hook 'erc-truncate-buffer) | |
(setq erc-truncate-buffer-on-save t) | |
;; kill buffers when leaving | |
(setq erc-kill-buffer-on-part t) | |
(erc-scrolltobottom-mode t) | |
;; let's connect | |
(defun irc-connects () | |
"Connect to IRC" | |
(interactive) | |
(when (y-or-n-p "IRC? ") | |
(ircrelay-connect "sme" "webframp_grove" (get-authinfo "irc.ircrelay.com" "6697")) | |
(ircrelay-connect "webframp" "webframp_freenode" (get-authinfo "irc.ircrelay.com" "6697")))) | |
(defun ircrelay-connect (nickname name password) | |
(let ((erc-email-userid name)) | |
(erc-ssl :server "irc.ircrelay.com" :port 6697 :password password | |
:nick nickname :full-name "Sean Escriva"))) | |
(defun get-authinfo (host port) | |
(let* ((netrc (netrc-parse (expand-file-name "~/.authinfo.gpg"))) | |
(hostentry (netrc-machine netrc host port port))) | |
(when hostentry (netrc-get hostentry "password")))) | |
;; growl notify | |
(defvar growlnotify-command (executable-find "growlnotify") "The path to growlnotify") | |
(defun growl (title message) | |
"Shows a message through the growl notification system using | |
`growlnotify-command` as the program." | |
(cl-flet ((encfn (s) (encode-coding-string s (keyboard-coding-system)))) | |
(let* ((process (start-process "growlnotify" nil | |
growlnotify-command | |
(encfn title) | |
"-a" "Emacs" | |
"-n" "Emacs"))) | |
(process-send-string process (encfn message)) | |
(process-send-string process "\n") | |
(process-send-eof process))) | |
t) | |
(defun growl-erc-hook (match-type nick message) | |
"Shows a growl notification, when user's nick was mentioned. If the buffer is currently not visible, makes it sticky." | |
(unless (posix-string-match "^\\** *Users on #" message) | |
(growl | |
(concat "ERC: name mentioned on: " (buffer-name (current-buffer))) | |
message))) | |
(add-hook 'erc-text-matched-hook 'growl-erc-hook) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment