Sending notifications from emacs is something I find useful. In an earlier blog post I talked about how to use Growl to do so. http://justinsboringpage.blogspot.com/2009/09/making-emacs-growl.html
Well now you don't need Growl any longer. There's a neat github project called terminal notifier https://github.com/alloy/terminal-notifier which let's you send notifications from the terminal.
You can install it simply, via Homebrew or Rubygems as follows:
$ [sudo] gem install terminal-notifier
Then you can send notifications using a command like this:
brew install terminal-notifier
terminal-notifier -message "hello"
Finally in order to send the notification from emacs we need to write a little Emacs lisp.
Check out this gist for the code I use:
This lets you send a notification in the future using M-x timed-notification
You are prompted for a time, and the format of that time can be given in a human readable way such as "2 seconds" or "5 minutes" (If you're curious for the allowed options look at the info page in emacs for the function timer-duration )
Then you are prompted for the message "Go to the store", and the message will be sent.
The code is very simple, it simply uses run-at-time to run the terminal command in the future. A useful command is find-executable, which given a name will find that executable in your path and run it. This makes configuring tools like this less effort.
TroubleshootingHey if it doesn't work first time what can you do?
- Check if terminal notify is installed correctly by running at terminal
- If that succeeds and you don't get a message check if you have enabled do not disturb mode
- Otherwise if that succeeds and yet emacs isn't sending messages you likely don't have the executable on the path. M-x customize-variable exec-path