Created
February 12, 2013 17:57
-
-
Save webframp/4771779 to your computer and use it in GitHub Desktop.
This file contains 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
;; 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