Skip to content

Commit ae3e449

Browse files
ivan-mchrisdone
authored andcommitted
Use notifications.el rather than notify.el (as it ships with Emacs)
Also have a logo in the notification.
1 parent 814e4d3 commit ae3e449

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

haskell-process.el

+21-11
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
(defcustom haskell-notify-p
6060
nil
61-
"Notify using notify.el (if loaded)?"
61+
"Notify using notifications.el (if loaded)?"
6262
:type 'boolean
6363
:group 'haskell)
6464

@@ -102,6 +102,10 @@ has changed?"
102102

103103
(defvar haskell-process-prompt-regex "\\(^[> ]*> $\\|\n[> ]*> $\\)")
104104

105+
(defconst haskell-process-logo
106+
(file-truename "logo.svg")
107+
"Haskell logo for notifications.")
108+
105109
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106110
;; Specialised commands
107111

@@ -231,7 +235,7 @@ changed. Restarts the process if that is the case."
231235
(let ((process (haskell-process)))
232236
(haskell-process-queue-command
233237
process
234-
(haskell-command-make
238+
(haskell-command-make
235239
(list session process command)
236240
(lambda (state)
237241
(haskell-process-send-string (cadr state)
@@ -293,9 +297,15 @@ changed. Restarts the process if that is the case."
293297
(haskell-interactive-mode-echo session msg)
294298
(haskell-mode-message-line msg)
295299
(when (and haskell-notify-p
296-
(fboundp 'notify))
297-
(notify (format "*%s*" (haskell-session-name (car state)))
298-
msg)))))))))
300+
(fboundp 'notifications-notify))
301+
(notifications-notify
302+
:title (format "*%s*" (haskell-session-name (car state)))
303+
:body msg
304+
:app-name (ecase haskell-process-type
305+
('ghci "cabal")
306+
('cabal-dev "cabal-dev"))
307+
:app-icon haskell-process-logo
308+
)))))))))
299309

300310
(defun haskell-process-cabal-live (state buffer)
301311
"Do live updates for Cabal processes."
@@ -378,7 +388,7 @@ changed. Restarts the process if that is the case."
378388
(line (string-to-number (match-string 2 buffer)))
379389
(col (match-string 3 buffer))
380390
(warning (string-match "^Warning: " error-msg))
381-
(final-msg (format "%s:%s:%s: %s"
391+
(final-msg (format "%s:%s:%s: %s"
382392
(haskell-session-strip-dir session file)
383393
line
384394
col
@@ -461,7 +471,7 @@ changed. Restarts the process if that is the case."
461471
(haskell-process-set-process
462472
process
463473
(ecase haskell-process-type
464-
('ghci
474+
('ghci
465475
(haskell-process-log (format "Starting inferior GHCi process %s ..."
466476
haskell-process-path-ghci))
467477
(start-process (haskell-session-name session)
@@ -754,7 +764,7 @@ changed. Restarts the process if that is the case."
754764
(when x
755765
(cdr x))))
756766

757-
(defun haskell-process-set (s key value)
767+
(defun haskell-process-set (s key value)
758768
"Set the process's `key'."
759769
(delete-if (lambda (prop) (equal (car prop) key)) s)
760770
(setf (cdr s) (cons (cons key value)
@@ -776,7 +786,7 @@ changed. Restarts the process if that is the case."
776786
"Call the command's go function."
777787
(let ((func (haskell-command-get s 'go)))
778788
(when func
779-
(funcall func
789+
(funcall func
780790
(haskell-command-state s)))))
781791

782792
(defun haskell-command-complete (s response)
@@ -791,7 +801,7 @@ changed. Restarts the process if that is the case."
791801
"Trigger the command's live updates callback."
792802
(let ((func (haskell-command-get s 'live)))
793803
(when func
794-
(funcall func
804+
(funcall func
795805
(haskell-command-state s)
796806
response))))
797807

@@ -801,7 +811,7 @@ changed. Restarts the process if that is the case."
801811
(when x
802812
(cdr x))))
803813

804-
(defun haskell-command-set (s key value)
814+
(defun haskell-command-set (s key value)
805815
"Set the command's `key'."
806816
(delete-if (lambda (prop) (equal (car prop) key)) s)
807817
(setf (cdr s) (cons (cons key value)

logo.svg

+16
Loading

0 commit comments

Comments
 (0)