jwiegley / alert

A Growl-like alerts notifier for Emacs
Other
443 stars 67 forks source link

osx-notifier isn't working #38

Open kardapoltsev opened 8 years ago

kardapoltsev commented 8 years ago

I've tried to show alert using sox-notifier and got this error:

Debugger entered--Lisp error: (file-error "Searching for program" "no such file or directory" "osascript -e 'display notification \"test\" with title \".emacs\"'")
  call-process("osascript -e 'display notification \"test\" with title \".emacs\"'")
  apply(call-process "osascript -e 'display notification \"test\" with title \".emacs\"'")
  alert-osx-notifier-notify((:message "test" :title ".emacs" :icon nil :severity normal :category nil :buffer #<buffer .emacs> :mode emacs-lisp-mode :data nil))
  alert-send-notification(#<buffer .emacs> (:message "test" :title ".emacs" :icon nil :severity normal :category nil :buffer #<buffer .emacs> :mode emacs-lisp-mode :data nil) (:title "Notify using native OSX notification" :notifier alert-osx-notifier-notify))
  alert("test")
  eval((alert "test") nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-seep)

I've fixed it with

defun alert-osx-notifier-notify (info)
  (apply #'call-process "osascript" nil nil nil "-e" (list (format "display notification %S with title %S"
                (alert-encode-string (plist-get info :message))
                (alert-encode-string (plist-get info :title)))))
  (alert-message-notify info))

but I'm new to emacs and ELisp and I'm not sure that it's a right way to go. Would you like to get a PR?

bradleybuda commented 8 years ago

I'm seeing the same failure - @kardapoltsev's code seems to fix it. I'm also an emacs noob, but maybe call-process has changed in functionality across emacs versions? I'm on (emacs-version) GNU Emacs 25.1.50.1 (x86_64-apple-darwin15.4.0, NS appkit-1404.41 Version 10.11.4 (Build 15E27e)) of 2016-01-31

torgeir commented 8 years ago

I'm also seeing a similar one. Redefining the defun like suggested does seem to fix it.

alert-osx-notifier-notify: Wrong type argument: listp, "osascript -e 'display notification \"org-plus-contrib :home:\" with title \"org\"'"

jojojames commented 7 years ago

+1 seeing the same thing. Patch seems to work for me.

krydos commented 7 years ago

Hi guys. It is 2017 already and this issue is still exists... @jwiegley will you accept PR with the fix described by @kardapoltsev? Can we send it? thanks.

jwiegley commented 7 years ago

Sure, it's small enough not to need papers.

krydos commented 7 years ago

Thank you. I sent pull request which is actually copy of @kardapoltsev fix described above. Hope he is not mind 😊

Wilfred commented 6 years ago

With #45 merged, can this now be closed?