Skip to content
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

shelling out to "mu find" is brittle and should be replaced #5

Open
stsquad opened this issue Nov 27, 2020 · 4 comments
Open

shelling out to "mu find" is brittle and should be replaced #5

stsquad opened this issue Nov 27, 2020 · 4 comments

Comments

@stsquad
Copy link
Contributor

stsquad commented Nov 27, 2020

I'm finding a bunch of my queries are not updating because of escaping issues when calling (shell-command-to-string) with my default shell (fish). At a minimum it would probably make sense to factor out all the queries to a single common function where we can be sure of getting the escaping right. However going forward we should investigate if @djcb could consider an public API to make queries of the "mu" daemon which already has the database loaded in memory and could probably just count the number of hits for you and respond with that.

@rougier
Copy link
Owner

rougier commented Nov 28, 2020

Using the mu daemon would be much nicer rather than calling mu through shell. I've no real idea on how to do that though.

@agpchil
Copy link

agpchil commented Nov 29, 2020

(Disclaimer: I'm the author of mu4e-maildirs-extension)

I had to use shell commands when I wrote mu4e-maildirs-extension and it gave me lots of troubles.
So I also agree with @stsquad that it is better to avoid it if possible.

AFAIK it is now possible to fetch unread/total counts via the daemon.
I think you need to pass the list of queries to mu4e~proc-ping and after the pong is processed the results are stored in mu4e~server-props variable (see also mu4e~main-bookmarks function for an example).

Hope this helps, although I haven't followed the mu development so I may be wrong.

@stsquad
Copy link
Contributor Author

stsquad commented Nov 29, 2020

I've raised djcb/mu#1845 to see what @djcb might have to say about it.

@rougier
Copy link
Owner

rougier commented Nov 29, 2020

Thanks. Let's wait for an answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants