Comments (7)
Quick update here: we have a, not to ugly, PR that fixes the issue that exec
functions aren't triggered in the hook.
However the behavior is confusing because the command queue is only triggered after the complete hook is parsed. Fixing this would be a way bigger change.
I suggest something like alias nm='neomutt && sync-script.sh'
as a temporary workaround for the original issue.
from neomutt.
I had a deeper look and the problem doesn't seem to be related to sync-mailbox
. It looks like no exec
command gets executed. With the following shutdown-hook
shutdown-hook "echo 'before'; exec sync-mailbox; echo 'after'"
and some additional logging I get:
[2024-03-18 08:44:11]<1> dlg_index() Got op OP_QUIT (198)
[2024-03-18 08:44:11]<5> mutt_startup_shutdown_hook() shutdown
[2024-03-18 08:44:11]<5> mutt_startup_shutdown_hook() hook: echo 'before'; exec sync-mailbox; echo 'after'
[2024-03-18 08:44:11]<5> parse_rc_buffer() buffer:
[2024-03-18 08:44:11]<1> parse_rc_buffer() NT_COMMAND: echo
[2024-03-18 08:44:11]<M> parse_echo() before
[2024-03-18 08:44:11]<5> msgwin_set_text() MW SET: 6, before
[2024-03-18 08:44:11]<5> msgwin_calc_rows() msgwin_calc_rows() => 1
[2024-03-18 08:44:11]<5> msgwin_recalc() recalc done, request WA_REPAINT
[2024-03-18 08:44:11]<5> msgwin_repaint() msgwin repaint done
[2024-03-18 08:44:11]<5> parse_rc_buffer() rc: 0
[2024-03-18 08:44:11]<N> notify_send() sending: NT_COMMAND/13
[2024-03-18 08:44:11]<N> send() send: 7, 0x12001f800
[2024-03-18 08:44:11]<1> parse_rc_buffer() NT_COMMAND: exec
[2024-03-18 08:44:11]<5> mutt_parse_exec() exec: echo 'before'; exec sync-mailbox; echo 'after'
[2024-03-18 08:44:11]<5> mutt_parse_exec() function: sync-mailbox
[2024-03-18 08:44:11]<5> mutt_push_macro_event() ch: 0 op: 174
[2024-03-18 08:44:11]<5> parse_rc_buffer() rc: 0
[2024-03-18 08:44:11]<N> notify_send() sending: NT_COMMAND/14
[2024-03-18 08:44:11]<N> send() send: 7, 0x12001f800
[2024-03-18 08:44:11]<1> parse_rc_buffer() NT_COMMAND: echo
[2024-03-18 08:44:11]<M> parse_echo() after
[2024-03-18 08:44:11]<5> msgwin_set_text() MW SET: 5, after
Notice how the exec sync-mailbox
gets parsed correct but never executed. It's gets pushed as an "event" in mutt_push_macro_event()
but that's it. I think that is because NeoMutt is no longer in the main loop and nothing is actually handling those events.
I'll see if I can find some changes related to that next.
from neomutt.
In fact it seems that shutdown-hook 'exec sync-mailbox'
is doing exactly nothing.
I'm trying to do something very similar. It doesn't even seem to be a race condition, because when doing
shutdown-hook 'exec sync-mailbox; echo `sleep 5`; echo `script.sh`'
it is still not updated when the script runs.
Btw. neomutt updates mailboxes when it quits. So if you are closing, opening, closing and it works, that is no indication that the hook actually did something.
I'd also greatly appreciate some advice on what's wrong here.
from neomutt.
Hi,
to clarify: the shutdown-hook
is executed right? The problem is that sync-mailbox
doesn't work as expected in it?
My wild guess is that sync-mailbox
works on the current mailbox and by the time the shutdown-hook
is executed there's no "current mailbox" anymore. But we need @flatcap expertise here.
from neomutt.
Ok. I think I did manage to run both commands, by either doing:
shutdown-hook 'exec sync-mailbox `sync-script.sh`'
or
shutdown-hook 'exec sync-mailbox ; echo `sync-script.sh`'
However it still seems to not be working as expected... The sync-script (that is just a call to mbsync) detects no changes, so read emails are not updated, as if sync-mailbox
had not been executed. However, if I run the hook two times, by closing, opening and closing it works, so the command is working but the mailbox is only being saved after the program exits.
How could I fix it?
from neomutt.
In fact it seems that
shutdown-hook 'exec sync-mailbox'
is doing exactly nothing.I'm trying to do something very similar. It doesn't even seem to be a race condition, because when doing
shutdown-hook 'exec sync-mailbox; echo `sleep 5`; echo `script.sh`'
it is still not updated when the script runs.
Btw. neomutt updates mailboxes when it quits. So if you are closing, opening, closing and it works, that is no indication that the hook actually did something.
I'd also greatly appreciate some advice on what's wrong here.
Yes, I also tried using sleep
in my hook to test if it was some race condition, and had the same results.
I ended up rebinding the exit key (q
) to run the sync commands and then quit. It works. But it still seems to be something wrong with the shutdown-hook
.
from neomutt.
to clarify: the
shutdown-hook
is executed right? The problem is thatsync-mailbox
doesn't work as expected in it?
Exactly. If I do something like:
shutdown-hook 'exec sync-mailbox; echo `notify-send test`'
I'm getting the notification. It's just that sync-mailbox
doesn't seem to have an effect.
from neomutt.
Related Issues (20)
- external filters in format strings are not called HOT 8
- Embedding CFLAGS makes neomutt unreproducible HOT 5
- Periodical crashing with segfault 11 on macOS 12.7.1. HOT 1
- Latest release hangs on startup (macOS 12.7.4) HOT 8
- Newline in attribution no longer properly handled HOT 2
- Compose Menu - top bar not updated after attaching files from file browser HOT 3
- Subject with non-printable characters or new line is shown with `?` HOT 30
- `Today` conditional date broken HOT 4
- Lag on half-down/half-up scrolling on macOS HOT 5
- Do we need to handle <stddef.h> specially? HOT 1
- conditional format strings broken in 2024-04-25 HOT 7
- Duplicate gpg keys in key selection menu for message encryption HOT 17
- segfault while opening a mailbox in from the sidebar HOT 2
- Doubts about paranoic defensive programming style HOT 3
- C dialect HOT 2
- tag-prefix doesn't work in attach HOT 5
- Doubts about some `*const` pointers HOT 5
- How to use the notmuch command <modify-labels> to tag emails with tags containing spaces?
- Is it possible to edit the automatic title when forwarding or replying a message? HOT 1
- Progress for postponing a message with remote (IMAP)
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 neomutt.