-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add org-notify option to org-layer #14396
Add org-notify option to org-layer #14396
Conversation
10dbf31
to
cd76344
Compare
org-notify was last updated in 2012. There's a risk of incompatibility with future Emacs version. A more recent package is org-alert https://github.com/spegoraro/org-alert, which was last updated 3 years ago. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising. I still found some smaller issues and questions you should check before this can be merged.
@lebensterben can you give a short overview about the difference between org-notify and org-alarm? To be honest I would prefer the one being better maintained to be honest.
@@ -588,6 +590,19 @@ Headline^^ Visit entry^^ Filter^^ Da | |||
(kbd "M-SPC") 'spacemacs/org-agenda-transient-state/body | |||
(kbd "s-M-SPC") 'spacemacs/org-agenda-transient-state/body))) | |||
|
|||
(defun org/init-org-notify () | |||
(use-package org-notify | |||
:config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we lazy load the package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, we could lazy load it. I first loaded it :after
org-agenda, but then I figured that users would like the notification daemon to start at Spacemacs startup. But the org-notify-start
function is autoloadable so yes, we could lazy load it (althoguh it would still start at startup if users choose to start the daemon at startup).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure, the config code is only executed when the package is loaded, so if you call org-notifiy-start in there and lazyload the autoloading on that function will not trigger it. Instead you would need to load the server in the init part, if requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it should be moved too :init then also 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, it looks like org-notify-start
is not autoloadable (I just mistakingly remembered to have seen it). So I think we should keep it as it is now. Do you think I should create a PR for making it autoloadable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can declare it autoloadable in use-package directly using the :commands
tag. Still an up-stream PR would be nice for the rest of the emacs world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah great! I did not know that feature yet
@lebensterben Thanks for checking the PR. Actually I see that I have not been clear in the PR message, but I meant that we could easily make So I am quite confident that org-notify is the best option. There is quite some confusion about notifications in the community (which for me personally was mainly caused by the existence of the alert package. So let me start with the main culprit. It took me actually a long research to finally get to this, what should be, most straightforward solution of using org-notify. I have checked out, and inspected many packages:
But all these packages have flaws. Org-alert and org-wild-notifier use org-alert, which might appear to be better but as I explained above, it is not. Additionally they use complicated ways to retrieve the correct headlines (e.g. scheduled and deadlines). Also [org-alert] has a very limited notification system of only checking and showing notifications periodically (see here.
the appt.el package, I have checked out also, because the first two packages did not satisfy. But indeed this package I would say uses old and deprecated ways. So finally about the incompatability risk, it seems that org-notify actually has the lowest risk of becoming incompatible. It might be true that |
Let me elaborate a little more.
But regarding the |
Thanks for the very detailed explanation @dalanicolai. I agree with you lets start with this package, if features are missing we could still do PRs on upstream. Maybe we can contribute to solving this entire emacs notification confusion by focusing on the package with the cleanest code and extend it where necessary. |
b814d28
to
abd2f60
Compare
@dalanicolai One minor issue, the link in you commit is not the original org-notify. |
This seems to be actively maintained. https://code.orgmode.org/bzg/org-mode/src/master/contrib/lisp/org-notify.el |
abd2f60
to
5ad53e3
Compare
Only to notice that emacs function
|
https://www.gnu.org/software/emacs/manual/html_node/elisp/Desktop-Notifications.html |
I have checked here on Ubuntu 20.10 with gnome 3.38.3 and also on Fedora 33 with KDE plasma 5.20.5. On both systems notifications seem to work fine, except that the sound does not play even if the :sound-file keyword is included. On Ubuntu I tried with Emacs from the default Ubuntu repo, and it worked alright (except for playing the sound, but the notifications were still working even when the :sound-file keyword was included). Anyway, seems like it has been build with D-Bus support. |
@ lebensterben I install emacs27 with this ppa
|
I don't use gnome now so I cannot reproduce this. |
I just report this bug to gnome-shell, hope this will be solved there issue |
@wztdream Well I noticed that in Gnome 3.38 the notifications do get added to the notifications list (in the clock dropdown menu), therefore I said they were working alright. But actually I agree with you that it does not work alright, because it should indeed show pop-ups and play sounds also. So it is great that you created the gnome-shell bug report! |
Okay guys, after using
So now, I am wondering... should we just replace the org-notify package, or should we make both packages available? |
using dash is plus for me. But not using org-elemnt API is quite disappointing. Why giving up the benefit of dealing with AST.... |
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
@lebensterben Well I guess, the org-agenda uses the |
As you can see I have created another PR for the org-wild-notifier package. It replaces this PR. And just for sake of documentation. There exists the org-timed-alerts package now also. |
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
I think you should add the one you actually use. So at least that one will have a maintainer. If someone is interested in the other notification packages, he can add it later. |
@lebensterben Yes I have created the PR for the org-wild-notifier package. That will be the one I am using for the upcoming period. |
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
Closing this PR in favor of PR #14418 |
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR should be a better replacement for #14396. See the last comment of that PR for motivation.
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR should be a better replacement for syl20bnr#14396. See the last comment of that PR for motivation.
This PR adds notifications via org-notify as an option to the org layer. Org-notify uses the Emacs notifications package, which works great with desktop notification systems that communicate via the dbus. Also, it should work well on Windows. I don't know about Mac, but it would be very easy to add some
org-notify-action-alert
function to the org-notify package (a simple copy of theorg-notify-action-message
with `message replaced by alert).