emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-show-notification of org-clock.el broken on MS Windows
@ 2020-01-24  9:08 Tim Schumacher
  2020-01-26  8:12 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Schumacher @ 2020-01-24  9:08 UTC (permalink / raw)
  To: emacs-orgmode

Hi folks,

I have a snippet that clocks me in, if I set the TOOD-keyword of an item to
started. So some time after working on that item on and off, I got a stack trace
and it would not change the keyword to started. The error was, that emacs was
not compiled with dbus support and I thought, hell yeah, I'm on MS Windows, I
don't have dbus here. So I looked at the stack trace and found
org-clock-notify-once-if-expired which wants to show a notification if I took
longer than I estimated. Than digging deeper I found org-show-notification which
is where the actual error happens. It checks if the function
notifications-notify exists and then tries to use it. On my system the function
is available, but does not work because I don't have dbus support.

In my opinion these two actionable items should be done:

* The function org-show-notification should be more robust. It should not fail
  if it can't fire a notification for whatever reason.
* On MS Windows the function w32-notification-notify should be used.

Maybe someone has a quick fix, if not I can try my non existant elisp foo and hack
together a patch tomorrow, but please be gentle with me.

Thanks for your time and great effort into org-mode!

Tim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-show-notification of org-clock.el broken on MS Windows
  2020-01-24  9:08 org-show-notification of org-clock.el broken on MS Windows Tim Schumacher
@ 2020-01-26  8:12 ` Bastien
  2020-01-26 11:19   ` Tim Schumacher
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2020-01-26  8:12 UTC (permalink / raw)
  To: Tim Schumacher; +Cc: emacs-orgmode

Hi Tim,

> * The function org-show-notification should be more robust. It should not fail
>   if it can't fire a notification for whatever reason.

Please send a patch if needed for this.

> * On MS Windows the function w32-notification-notify should be used.

I just fixed this one:
https://code.orgmode.org/bzg/org-mode/commit/8dd2984a

> Maybe someone has a quick fix, if not I can try my non existant elisp foo and hack
> together a patch tomorrow, but please be gentle with me.

We will, for sure :)

Thanks for raising this issue,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-show-notification of org-clock.el broken on MS Windows
  2020-01-26  8:12 ` Bastien
@ 2020-01-26 11:19   ` Tim Schumacher
  2020-01-26 16:37     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Schumacher @ 2020-01-26 11:19 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

Hi Bastien,

On Sun, 26 Jan 2020 10:12:40 +0100,
Bastien wrote:

> > * The function org-show-notification should be more robust. It should not fail
> >   if it can't fire a notification for whatever reason.
>
> Please send a patch if needed for this.

I tried my best, check the attachedd patch.

> > * On MS Windows the function w32-notification-notify should be used.
>
> I just fixed this one:
> https://code.orgmode.org/bzg/org-mode/commit/8dd2984a

This actualy does not work, because the notification will be closed instantly
and it will never appear.

I'm currently in the process of writing a patch[1] to change that. The problem
is, that emacs give the notification a static id and if there is a notification
from your application with the same id windows wont spawn another notification,
because you can update the notification. My plan is, to genrate a GUID and use
that as its id, so that you can have multiple notifications and don't have to
close the notification. But this does not work yet, since my C skills are not as
good as it used to be.

Thanks for your work!

Tim


[1]
https://github.com/emacs-mirror/emacs/compare/master...enko:feature/notification-guid


[-- Attachment #2: 0001-org-clock.el-Check-if-dbus-is-available-for-notifica.patch --]
[-- Type: application/octet-stream, Size: 873 bytes --]

From dfcec69c7f9f89cbb34ed3f07cd5362961d80c53 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <tim@datenknoten.me>
Date: Sun, 26 Jan 2020 12:14:26 +0100
Subject: [PATCH] org-clock.el: Check if dbus is available for
 notifications-notify

---
 lisp/org-clock.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 7fb97f021..157d55509 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -813,7 +813,7 @@ use libnotify if available, or fall back on a message."
 	((stringp org-show-notification-handler)
 	 (start-process "emacs-timer-notification" nil
 			org-show-notification-handler notification))
-	((fboundp 'notifications-notify)
+	((and (fboundp 'dbus-compiled-version) (fboundp 'notifications-notify))
 	 (notifications-notify
 	  :title "Org mode message"
 	  :body notification
-- 
2.24.0.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: org-show-notification of org-clock.el broken on MS Windows
  2020-01-26 11:19   ` Tim Schumacher
@ 2020-01-26 16:37     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2020-01-26 16:37 UTC (permalink / raw)
  To: Tim Schumacher; +Cc: emacs-orgmode

Hi Tim,

thanks for the detailed information and the patch.

I've pushed a change on the master branch that should make
notifications usable on W32 systems.

Can you test and see if it works for you?

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-26 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-24  9:08 org-show-notification of org-clock.el broken on MS Windows Tim Schumacher
2020-01-26  8:12 ` Bastien
2020-01-26 11:19   ` Tim Schumacher
2020-01-26 16:37     ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).