Comments (29)
@hongphong177 I missed one spot that's not using proper function. I updated the docs, but only change is that utils
on line 12 becomes require('orgmode.utils')
.
from orgmode.
it's worked thanks a lot @kristijanhusak
from orgmode.
@kristijanhusak yes indeed it does work sorry for noise
from orgmode.
I moved to lazy.nvim
and use your partial orgmode
cron
file now. I can confirm that with your latest changes, everything works perfectly:
- if an error occurs, I get notified of this now
- the error itself doesn't occur anymore because you fixed the source of that
Furthermore, I also tested it with my previous approach and can confirm that even then (i.e. not using the partial config), it works. Thanks a lot!! :)
from orgmode.
I just try notification and get this error message
below is my setting:
notifications = {
enabled = true,
cron_enabled = false,
repeater_reminder_time = {1, 5, 10},
deadline_warning_reminder_time = {1, 5, 10},
reminder_time = {1, 5, 10},
deadline_reminder = true,
scheduled_reminder = true,
notifier = function(tasks)
local result = {}
for _, task in ipairs(tasks) do
utils.concat(result, {
string.format('# %s (%s)', task.category, task.humanized_duration),
string.format('%s %s %s', string.rep('*', task.level), task.todo, task.title),
string.format('%s: <%s>', task.type, task.time:to_string())
})
end
if not vim.tbl_isempty(result) then
require('orgmode.notifications.notification_popup'):new({ content = result })
end
end,
}
from orgmode.
I use these every day (rather than cron
I've setup a systemd
timer) and they work flawlessly.
from orgmode.
I've been using this with just the neovim notification and it works well! Especially with nvim-notify
from orgmode.
I tried it using the optimal way the service returned an error (I used systemd timer)
if I used my config it'll return this
this is my config:
notifications = {
enabled = true,
cron_enabled = true,
repeater_reminder_time = {0, 1, 5},
deadline_warning_reminder_time = {0, 1, 5, 15, 30, 60},
reminder_time = 10,
deadline_reminder = true,
scheduled_reminder = true,
notifier = function(tasks)
local result = {}
for _, task in ipairs(tasks) do
require('orgmode.utils').concat(result, {
string.format('# %s (%s)', task.category, task.humanized_duration),
string.format('%s %s %s', string.rep('*', task.level), task.todo, task.title),
string.format('%s: <%s>', task.type, task.time:to_string())
})
end
if not vim.tbl_isempty(result) then
require('orgmode.notifications.notification_popup'):new({ content = result })
end
end,
cron_notifier = function(tasks)
for _, task in ipairs(tasks) do
local title = string.format('%s (%s)', task.category, task.humanized_duration)
local subtitle = string.format('%s %s %s', string.rep('*', task.level), task.todo, task.title)
local date = string.format('%s: %s', task.type, task.time:to_string())
if vim.fn.executable('notify-send') == 1 then
vim.loop.spawn('notify-send', { args = { string.format('%s\n%s\n%s', title, subtitle, date) }})
end
end
end
},
from orgmode.
@excalios seems like you generally have something loaded incorrectly, because I see some indent line errors.
what does it happen if you do this:
ni --noplugin --headless -c "echo 'test' | qa"
from orgmode.
@kristijanhusak Thanks for the reply I ran the command and got this result:
from orgmode.
@excalios is your config working properly when you run it through regular neovim session?
from orgmode.
@kristijanhusak Seems to be working fine except the notifications? I'm unsure on how to test it
from orgmode.
@excalios set up a TODO that will happen in a bit more than 10 minutes. Open up Neovim and wait until exactly 10 minutes before the task deadline time, and it should show you a notification inside Neovim in top right corner.
from orgmode.
I managed to get it working-ish.
I upgraded my neovim apparently it was quite old version. Managed to run it with no error on this command
/usr/bin/nvim --headless --noplugin -c 'lua require("orgmode").cron(require("excalios.orgconf"))'
I moved the systemd timer from system dir to user dir. Apparently when it's on system it couldn't find the orgmode but on user it was able to find it. I didn't change the config from there.
But, the notification doesn't always popup sometimes it does more time it doesn't. I checked the handle and the pid it was able to create the process no problem. But, the notification just doesn't popup somehow. I tried adding another empty spawn it popped up more often but not always. Adding a spawn with a command in it made it to always popup but I don't like this approach. Might just be my setup thanks for the help though
from orgmode.
If we just add a SCHEDULED
entry, do we need to do something to make it in effect?
from orgmode.
@Tokubara you should be getting both scheduled and deadline notifications.
from orgmode.
I'm only getting notifications for SCHEDULED (and possibly DEADLINE, didn't test), but not for plain timestamps. Is this on purpose?
In general I'm wondering whether I'm using plain timestamps properly, since there were a few other bugs with this in the past (and some issues I'll file soon). I'm using orgmode also as a calendar, and when I have a meeting scheduled, I make a headline entry with the meeting name and a plain timestamp to indicate the time. Is this not how org should be used?
from orgmode.
I'd say orgmode should be used how it fits your needs. I also use plain timestamps on things I just want on my agenda, like you do. This is what orgmode says about it. The difference, as far as the agenda is concerned (and I am aware of), is that scheduled items will continue to show up on the current day, until you set them to DONE archive them.
from orgmode.
All right, thanks for clarifying! :)
So I suppose it should be a bug then that headlines with just a plain timestamp don't shop up in the notifications. Should I file an issue?
from orgmode.
Not sure if bug or missing feature. Emacs orgmode also does not seem to have notifications built in. Feel free to open an issue 👍
from orgmode.
I can't make this feature to function at all i have a scheduled entry in a org file like this:
* Events
** Send notification now
SCHEDULED: <2023-12-02 Sat 21:45>
running following command manually from command line I'm not getting any notification
/usr/bin/nvim --headless --noplugin -c 'lua require("orgmode").cron()'
notify-send
is installed anything am i missing?
from orgmode.
@mortezadadgar what are your reminder settings? If you set reminder time to 10
it will show you the notification only if you run it exactly 10 minutes before the scheduled datetime. So for given todo, to see a notification, you need to run it at 2023-12-02 Sat 21:35, considering you are using correct configuration for corn, and a default reminder time which is 10
.
from orgmode.
I've had cron
notifications set up since a long time by now, and I haven't changed anything. However, the notifications recently stopped working. What's more, I have tons of stuck nvim processes that fill up my RAM.
I suspect that there's an error in one of my org files, which trips up the treesitter
parser and leads to an error in the orgmode plugin. When I run the command in crontab
manually, I get
$ DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /home/maltimore/programs/nvim --headless --noplugin -c 'lua require("orgmode").cron()'
Error executing vim.schedule lua callback: ...er/start/orgmode.nvim.git/lua/orgmode/files/headline.lua:307: attempt to index a nil value
stack traceback:
...er/start/orgmode.nvim.git/lua/orgmode/files/headline.lua:307: in function 'method'
...packer/start/orgmode.nvim.git/lua/orgmode/utils/init.lua:570: in function 'get_todo'
...er/start/orgmode.nvim.git/lua/orgmode/files/headline.lua:328: in function 'is_done'
...packer/start/orgmode.nvim.git/lua/orgmode/files/file.lua:455: in function <...packer/start/orgmode.nvim.git/lua/orgmode/files/file.lua:453>
vim/shared.lua: in function 'method'
...packer/start/orgmode.nvim.git/lua/orgmode/utils/init.lua:570: in function 'get_opened_unfinished_headlines'
...tart/orgmode.nvim.git/lua/orgmode/notifications/init.lua:95: in function 'get_tasks'
...tart/orgmode.nvim.git/lua/orgmode/notifications/init.lua:65: in function 'cron'
.../pack/packer/start/orgmode.nvim.git/lua/orgmode/init.lua:221: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
If my suspicion that there's an error in one of my orgfiles is correct, it would be great if orgmode could report the org file and line where the error occurs. And, ideally, report this as a notification.
from orgmode.
@Maltimore Removing --noplugin
should make it work. This would load all the plugins though, but it should work.
I use a separate file where I load everything that's necessary for a cron and use it like this:
* * * * * DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /home/kristijan/.local/share/bob/nvim-bin/nvim -u NONE --headless --noplugin -c 'lua require("partials.orgmode_cron")'
I can't recall how this managed to work with --noplugin
since there is a dependency on nvim-treesitter
.
Let me know if removing --noplugin
works for you.
from orgmode.
Unfortunately, removing --noplugin
does not work, I get the same error as before.
from orgmode.
Can you try using my file I provided and see if that helps? What package manager are you using?
from orgmode.
I'm using packer for now. I wanted to migrate to lazy
anyways, so I guess I'll do that now/soon and then use your partial lazy
-based config and report back!
from orgmode.
it would be great if orgmode could report the org file and line where the error occurs. And, ideally, report this as a notification.
I had these issues myself so I'll see to add some way to notify the user that something is failing
from orgmode.
@Maltimore I pushed some changes (4c7b539) that should properly exit and report errors via system notifier.
Also the error you got is something that can really happen (even though I didn't manage to reproduce it), so I also addressed that. Let me know if it works now.
from orgmode.
Related Issues (20)
- Application of colorscheme breaks todo keyword highlighting HOT 3
- uuidgen does not exist on Windows HOT 2
- Windwos path with Colon (:) (ex: E:\repoes\README.md) can't open
- Error (freezes nvim) when opening file with code block name in different case (e.g. "Python", "JSON", "R"): `no such language: R` HOT 1
- Context is lost when archiving headline with level >1 HOT 2
- Make Virtual Indentation (indent mode) support `set wrap` HOT 2
- Improve documentation workflow. HOT 9
- Repeating API calls to get_entries cause stackoverflow at some time HOT 6
- * TODO Display checkbox progress (as virtual text) [2/4] HOT 1
- Date arithmetic does calculate correctly +/- 1 month
- Advanced search regex
- Cursor position after "Move subtree" doesn't allow for convenient repetition HOT 1
- How to change highlighting of folded lines? HOT 6
- Refiling ignores preamble export options HOT 2
- Give an option to change keybinding in calendar popup HOT 4
- Support for org-shiftmetaleft, org-outdent-item and org-shiftmetaright, org-indent-item HOT 5
- Cannot follow an in-file link to a headline with colon in title HOT 1
- (Re-)load agenda file(s)
- org-next-visible-heading goes to invisible headings HOT 4
- org_meta_return doesnt jump below heading content
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orgmode.