Permalink
Browse files

Use notifications.el rather than notify.el (as it ships with Emacs)

Also have a logo in the notification.
  • Loading branch information...
1 parent 814e4d3 commit ae3e4499d27a1468bdf88ffe0ce15cd7e4bb9f2a @ivan-m ivan-m committed with chrisdone Aug 8, 2012
Showing with 37 additions and 11 deletions.
  1. +21 −11 haskell-process.el
  2. +16 −0 logo.svg
View
@@ -58,7 +58,7 @@
(defcustom haskell-notify-p
nil
- "Notify using notify.el (if loaded)?"
+ "Notify using notifications.el (if loaded)?"
:type 'boolean
:group 'haskell)
@@ -102,6 +102,10 @@ has changed?"
(defvar haskell-process-prompt-regex "\\(^[> ]*> $\\|\n[> ]*> $\\)")
+(defconst haskell-process-logo
+ (file-truename "logo.svg")
+ "Haskell logo for notifications.")
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Specialised commands
@@ -231,7 +235,7 @@ changed. Restarts the process if that is the case."
(let ((process (haskell-process)))
(haskell-process-queue-command
process
- (haskell-command-make
+ (haskell-command-make
(list session process command)
(lambda (state)
(haskell-process-send-string (cadr state)
@@ -293,9 +297,15 @@ changed. Restarts the process if that is the case."
(haskell-interactive-mode-echo session msg)
(haskell-mode-message-line msg)
(when (and haskell-notify-p
- (fboundp 'notify))
- (notify (format "*%s*" (haskell-session-name (car state)))
- msg)))))))))
+ (fboundp 'notifications-notify))
+ (notifications-notify
+ :title (format "*%s*" (haskell-session-name (car state)))
+ :body msg
+ :app-name (ecase haskell-process-type
+ ('ghci "cabal")
+ ('cabal-dev "cabal-dev"))
+ :app-icon haskell-process-logo
+ )))))))))
(defun haskell-process-cabal-live (state buffer)
"Do live updates for Cabal processes."
@@ -378,7 +388,7 @@ changed. Restarts the process if that is the case."
(line (string-to-number (match-string 2 buffer)))
(col (match-string 3 buffer))
(warning (string-match "^Warning: " error-msg))
- (final-msg (format "%s:%s:%s: %s"
+ (final-msg (format "%s:%s:%s: %s"
(haskell-session-strip-dir session file)
line
col
@@ -461,7 +471,7 @@ changed. Restarts the process if that is the case."
(haskell-process-set-process
process
(ecase haskell-process-type
- ('ghci
+ ('ghci
(haskell-process-log (format "Starting inferior GHCi process %s ..."
haskell-process-path-ghci))
(start-process (haskell-session-name session)
@@ -754,7 +764,7 @@ changed. Restarts the process if that is the case."
(when x
(cdr x))))
-(defun haskell-process-set (s key value)
+(defun haskell-process-set (s key value)
"Set the process's `key'."
(delete-if (lambda (prop) (equal (car prop) key)) s)
(setf (cdr s) (cons (cons key value)
@@ -776,7 +786,7 @@ changed. Restarts the process if that is the case."
"Call the command's go function."
(let ((func (haskell-command-get s 'go)))
(when func
- (funcall func
+ (funcall func
(haskell-command-state s)))))
(defun haskell-command-complete (s response)
@@ -791,7 +801,7 @@ changed. Restarts the process if that is the case."
"Trigger the command's live updates callback."
(let ((func (haskell-command-get s 'live)))
(when func
- (funcall func
+ (funcall func
(haskell-command-state s)
response))))
@@ -801,7 +811,7 @@ changed. Restarts the process if that is the case."
(when x
(cdr x))))
-(defun haskell-command-set (s key value)
+(defun haskell-command-set (s key value)
"Set the command's `key'."
(delete-if (lambda (prop) (equal (car prop) key)) s)
(setf (cdr s) (cons (cons key value)
View
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="481.8897pt" height="340.1574pt" viewBox="0 0 481.8897 340.1574" version="1.1">
+<defs>
+<clipPath id="clip1">
+ <path d="M 0 340.15625 L 481.890625 340.15625 L 481.890625 0 L 0 0 L 0 340.15625 Z M 0 340.15625 "/>
+</clipPath>
+</defs>
+<g id="surface0">
+<g clip-path="url(#clip1)" clip-rule="nonzero">
+<path style=" stroke:none;fill-rule: nonzero; fill: rgb(40%,40%,40%); fill-opacity: 1;" d="M 0 340.15625 L 113.386719 170.078125 L 0 0 L 85.039062 0 L 198.425781 170.078125 L 85.039062 340.15625 L 0 340.15625 Z M 0 340.15625 "/>
+<path style=" stroke:none;fill-rule: nonzero; fill: rgb(60%,60%,60%); fill-opacity: 1;" d="M 113.386719 340.15625 L 226.773438 170.078125 L 113.386719 0 L 198.425781 0 L 425.195312 340.15625 L 340.15625 340.15625 L 269.292969 233.859375 L 198.425781 340.15625 L 113.386719 340.15625 Z M 113.386719 340.15625 "/>
+<path style=" stroke:none;fill-rule: nonzero; fill: rgb(40%,40%,40%); fill-opacity: 1;" d="M 387.402344 240.945312 L 349.609375 184.253906 L 481.890625 184.25 L 481.890625 240.945312 L 387.402344 240.945312 Z M 387.402344 240.945312 "/>
+<path style=" stroke:none;fill-rule: nonzero; fill: rgb(40%,40%,40%); fill-opacity: 1;" d="M 330.710938 155.90625 L 292.914062 99.214844 L 481.890625 99.210938 L 481.890625 155.90625 L 330.710938 155.90625 Z M 330.710938 155.90625 "/>
+</g>
+</g>
+</svg>

0 comments on commit ae3e449

Please sign in to comment.