alert icon indicating copy to clipboard operation
alert copied to clipboard

osx-notifier isn't working

Open kardapoltsev opened this issue 8 years ago • 7 comments

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?

kardapoltsev avatar May 14 '16 13:05 kardapoltsev

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

bradleybuda avatar Sep 09 '16 18:09 bradleybuda

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"'"

torgeir avatar Oct 22 '16 08:10 torgeir

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

jojojames avatar Nov 27 '16 20:11 jojojames

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.

krydos avatar Jan 06 '17 10:01 krydos

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

jwiegley avatar Jan 06 '17 17:01 jwiegley

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

krydos avatar Jan 06 '17 18:01 krydos

With #45 merged, can this now be closed?

Wilfred avatar Jun 11 '18 13:06 Wilfred