Skip to content

Instantly share code, notes, and snippets.

@bdionne
Created December 3, 2012 18:26
Show Gist options
  • Save bdionne/4196900 to your computer and use it in GitHub Desktop.
Save bdionne/4196900 to your computer and use it in GitHub Desktop.
;; Wrapper for growlnotify
(defun growl-chat (title message &optional sticky)
(interactive "sTitle: \nsGrowl: ")
(shell-command
(format "/usr/local/bin/growlnotify %s -m '%s' --appIcon 'Aquamacs Emacs' %s" title message (if sticky "--sticky" ""))))
;; Sticky notifications
(defun growl-chat-sticky (title message)
(interactive "sTitle: \nsGrowl: ")
(growl-chat title message t))
;; ERC notifications
;; Growl nicknames and highlight words when they are mentioned in IRC.
;; Nickname notifications are sticky
(add-hook 'erc-text-matched-hook
(lambda (match-type nickuserhost message)
(when (and
(boundp 'nick)
(not (string= nick "ChanServ"))
(not (string= nick "services.")))
(cond
((eq match-type 'current-nick)
(growl-chat-sticky (format "%s said %s" nick (erc-current-nick)) message))
((eq match-type 'keyword)
(growl-chat (format "%s mentioned a Keyword" nick) message))
((eq match-type 'nick)
(growl-chat (format "%s says" nick) message))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment