-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrowl.el
51 lines (39 loc) · 1.59 KB
/
growl.el
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;;; growl.el --- Emacs interface to Growl via growlnotify
;; Copyright (C) 2005 Edward O'Connor
;; Author: Edward O'Connor <[email protected]>
;; Keywords: convenience
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;
;;; Code:
(unless (executable-find "growlnotify")
(error "growl.el requires that you install the `growlnotify' program."))
(defsubst growl-ensure-quoted-string (arg)
(shell-quote-argument
(cond ((null arg) "")
((stringp arg) arg)
(t (format "%s" arg)))))
(defun growl (subject message &optional sticky)
"Notify the user of something via Growl."
(shell-command
(concat "growlnotify -a Emacs -n Emacs"
(if sticky " -s" "")
" " (growl-ensure-quoted-string subject)
(if message
(concat " -m" (growl-ensure-quoted-string message))
""))
(get-buffer-create " *growl output*"))
message)
(provide 'growl)
;;; growl.el ends here