Created
October 29, 2021 19:20
-
-
Save kbingham/7bffd666a7a20bc974becec90c4872e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[bindings] | |
G = call hooks.getmail(ui) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## https://github.com/pazz/alot/wiki/Contrib-Hooks#getting-new-msg-while-alot-is-running | |
## Addition to communicate and notify stdout by Kieran Bingham | |
## Displays stdout of the fetched mail process, but hangs the UI while waiting for it to complete. | |
def getmail(ui=None): | |
ui.notify("fetching email..") | |
msg=subprocess.Popen("notmuch new".split(),stdout=subprocess.PIPE,stderr=subprocess.PIPE) | |
stdout, stderr = msg.communicate() | |
ui.notify(stdout) |
Though that is both stdout, and stderr
Stdout is just
Syncing from Lore
No new mail.
Synchronise patchwork
Looking at project libcamera (id 1)
Going to look at things post 2021-06-21 03:41:18
Processed 250 libcamera patches...
Processed 500 libcamera patches...
Processed 750 libcamera patches...
Processed 1000 libcamera patches...
Processed 1250 libcamera patches...
Processed 1500 libcamera patches...
Processed 1540 libcamera patches...
Finished processing 1540 libcamera patches!
{}
'notmuch new' calls into other hooks to get my mail through mbsync/lore and synchronise patchwork, as well as handle tagging with afew.
$ cat ~/Mail/.notmuch/hooks/pre-new
#!/bin/sh
# Fetch mail
mbsync -a
# Hooking lore updates
echo "Syncing from Lore"
~/Mail/.notmuch/.lore/hooks/pre-new
$ cat ~/Mail/.notmuch/hooks/post-new
#!/bin/sh
echo "Synchronise patchwork"
pwnm-sync.py
# Resync imap folders
mbsync -a
# Handle tagging
afew --tag --new
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
C: 1/1 B: 13/13 M: +0/0 *0/0 #0/0 S: +0/0 *0/0 #0/0
Syncing from Lore
linux-renesas-soc: initialize (https://lore.kernel.org/linux-renesas-soc)
epoch0: syncing
linux-media: initialize (https://lore.kernel.org/linux-media)
epoch0: syncing
No new mail.
Synchronise patchwork
/home/kbingham/bin/pwnm-sync.py:59: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
config = configparser.SafeConfigParser()
Looking at project libcamera (id 1)
Going to look at things post 2021-06-21 03:41:18
Processed 250 libcamera patches...
Processed 500 libcamera patches...
Processed 750 libcamera patches...
Processed 1000 libcamera patches...
Processed 1250 libcamera patches...
Processed 1500 libcamera patches...
Processed 1540 libcamera patches...
Finished processing 1540 libcamera patches!
{}
C: 1/1 B: 13/13 M: +0/0 *0/0 #0/0 S: +0/0 *0/0 #0/0