Created
May 21, 2010 13:18
-
-
Save pedrodelgallego/408813 to your computer and use it in GitHub Desktop.
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
(add-to-list 'load-path "~/.emacs.d/erc") | |
(require 'erc) | |
;; Only track my nick(s) | |
(defadvice erc-track-find-face (around erc-track-find-face-promote-query activate) | |
(if (erc-query-buffer-p) | |
(setq ad-return-value (intern "erc-current-nick-face")) | |
ad-do-it)) | |
(setq erc-keywords '("Lau" "lau" "ljensen")) | |
(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" | |
"324" "329" "332" "333" "353" "477")) | |
;; Use libnotify | |
(defun clean-message (s) | |
(setq s (replace-regexp-in-string "'" "'" | |
(replace-regexp-in-string "\"" """ | |
(replace-regexp-in-string "&" "&" | |
(replace-regexp-in-string "<" "<" | |
(replace-regexp-in-string ">" ">" s))))))) | |
(defun call-libnotify (matched-type nick msg) | |
(let* ((cmsg (split-string (clean-message msg))) | |
(nick (first (split-string nick "!"))) | |
(msg (mapconcat 'identity (rest cmsg) " "))) | |
(shell-command-to-string | |
(format "notify-send -u critical '%s says:' '%s'" nick msg)))) | |
(add-hook 'erc-text-matched-hook 'call-libnotify) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment