[neomutt-devel] [Feature Request] Inter Process Communication

Charalampos Kardaris ckardaris at outlook.com
Sat Nov 6 13:04:02 CET 2021

Hello Rich,

Thanks for replying.

> What feature(s) would you like?
> - Just `mailto:` handling?
> - Full-automation
> or somewhere in-between ;-)

Ideally we would be able to parse any commands in a form similar to the
command line arguments, as well index and pager commands, if we are
feeling adventurous. For example, we could parse "-e" arguments, "-f"
arguments, etc. 

My productivity scripts would benefit from being able to change to an
arbitrary mailbox in a consistent way for example. My current config
sets macros for folder changing and then I am using scripts to focus the
neomutt instance and fire up the macros with xdotool in order to achieve
what would be a simple "send -f mailbox" for example. Then folder-hooks
would take care of the rest. I don't know if there is another way to do
that (maybe I did not look hard enough), but that is the way I have
found and it currently provides basic functionality to me.

> A big problem with externally automating NeoMutt is its modal nature.
> A function's behaviour will depend on where you are, Index, Pager, etc

I had not thought about that (even though my naive scripts from above
have suffered from it) and it makes sense to take it into account. But I
guess we could reply with useful messages to the client regarding the
mode we are currently into and if the command was successful. 

Another idea that just came up to me, is that a command could be paired
with the intended mode that it should be executed in. If the neomutt
instance is in another mode it should reply accordingly, so that the
client is able to handle that scenario. I have not looked that far into
the code, but I would guess such checks would not be that difficult to

> The monitor code is plugged into the key handling, so it could create an
> event any time NeoMutt's waiting for a keypress.
My naive idea and thought process can be explained as follows:
monitor_poll is currently waiting for key presses and file changes. I am
adding a socket file to that list. I have verified that it works and
details (i.e name, multiple neomutt, instances) should be worked out in
due time.

Currently if a key is pressed, the program flows move to a point (I
haven't yet checked where), it determines if we have mapped the key,
what is the function to execute, do the execution. I would like the code
flow to move to these interesting points after handling the socket data
in some way. 

> The alternative would be to call the polling function from specific
> places like the Index and Pager.

I think this would complicate matters even more, but, again, I am not
really very informed on the internals of the code as of now.

> Pick the feature most important to you.
> Think how NeoMutt should react when in the Index, Pager, Compose, etc
> Then we can come up with a plan of how to implement the feature.
> We can discuss your ideas here, on GitHub (raise an issue),
> or IRC (most active weekdays) #neomutt on irc.libera.chat

Thanks for the advice. I am happy that I have not missed some serious
development effort on this matter and I could really make useful

The current plan is to start implementing these ideas in my free time
and when I have something barely useful, I will probably make a PR on
GitHub, which will serve as a place for further discussion and after
lots of polishing we could together have something user ready. 

In the meantime, if I have any more questions, I will probably use this
mailing list or the IRC chat. Even though I have never actively used the
latter and I don't know how everything works. Searching through chat
history for example is something that I have yet to understand, if it is
supported for each channel. I guess I could learn some things in that
domain as well from my involvement with neomutt development.

-- Charalampos

More information about the neomutt-devel mailing list