Fix call to notifications-notify on Mac OS where dbus isn't available

On EmacsForMacosx the `notifications-notify` is bound, but fails because it isn't compiled
with dbus support.  This PR adds check for corresponding variables and don't fail.
This commit is contained in:
Alex Ott 2024-09-22 11:18:18 +02:00
parent cc6a66360c
commit 36538d10b7

View File

@ -55,6 +55,7 @@ fallback."
"Notify the user using either the dbus based API or the `growl' one" "Notify the user using either the dbus based API or the `growl' one"
(when (not (eq el-get-notify-type 'message)) (when (not (eq el-get-notify-type 'message))
(unless (and (fboundp 'dbus-register-signal) (unless (and (fboundp 'dbus-register-signal)
(boundp 'dbus-compiled-version)
;; avoid a bug in Emacs 24.0 under darwin ;; avoid a bug in Emacs 24.0 under darwin
(ignore-errors (require 'notifications nil t))) (ignore-errors (require 'notifications nil t)))
;; else try notify.el, there's a recipe for it ;; else try notify.el, there's a recipe for it
@ -67,12 +68,13 @@ fallback."
;; Message only ;; Message only
((equal el-get-notify-type 'message) (error "Use `message' instead")) ((equal el-get-notify-type 'message) (error "Use `message' instead"))
;; Graphical notification ;; Graphical notification
((fboundp 'notifications-notify) (notifications-notify :title title ((and (fboundp 'notifications-notify) (boundp 'dbus-compiled-version))
:app-name "el-get" (notifications-notify :title title
:app-icon (concat :app-name "el-get"
(el-get-package-directory "el-get") :app-icon (concat
"/logo/el-get.png") (el-get-package-directory "el-get")
:body message)) "/logo/el-get.png")
:body message))
((fboundp 'notify) (notify title message)) ((fboundp 'notify) (notify title message))
((fboundp 'el-get-growl) (el-get-growl title message)) ((fboundp 'el-get-growl) (el-get-growl title message))
;; Fallback ;; Fallback