public
Created

ErcGrowl

  • Download Gist
ErcGrowl.el
Emacs Lisp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
(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."
(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 my-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 'my-erc-hook)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.