Skip to content

Instantly share code, notes, and snippets.

@pnkfelix
Created April 19, 2013 14:53
Show Gist options
  • Save pnkfelix/5420850 to your computer and use it in GitHub Desktop.
Save pnkfelix/5420850 to your computer and use it in GitHub Desktop.
Make emacs say when compilations are finished.
(defun terminal-notify (msg &optional title subtitle group)
"Sends a message to the Mac OS X message center"
(let ((infile nil)
(buffer "*terminal-notifier*")
(display t))
(apply 'call-process
"terminal-notifier" infile buffer display
"-message" msg
(append (if title (list "-title" title) nil)
(if subtitle (list "-subtitle" subtitle) nil)
(if group (list "-group" group) nil))
)))
(defun say-when-compilation-finished (buffer string)
"Sends a compile-done message to Mac OS X message center."
; (terminal-notify string "Compile finished" buffer)
(terminal-notify string "Compile finished" (buffer-name buffer)))
(add-to-list 'compilation-finish-functions 'say-when-compilation-finished)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment