[neomutt-users] Neomutt: now featuring Lua scripting!

Floyd Anderson f.a at 31c0.net
Fri Apr 28 03:31:12 CEST 2017


On Fr, 28 Apr 00:49:40 +0200
Guyzmo <z+mutt+neomutt at m0g.net> wrote:
>My dear neomutters,
>
>Following a few past mails on the topic, now neomutt is embedding a Lua
>runtime that makes it possible to access all of neomutt's 'public' API
>as a Lua API.
Currently I’m using ‘the old dog’ but that sounds really great and might 
be the determining factor to try out ‘the new (Lua) tricks’. TBH, I like 
Mutt but its configuration of dynamically stuff was a real challenge for 
me two years ago. Therefore the idea and decision of using Lua within 
Neomutt some day, thrilled me since I have noticed that.

># Example
>
>which can be used as a muttrc:
>
>```muttrc
># settings
>
>lua mutt.set("visual", "less")
>lua mutt.set("connect_timeout",42)
>lua mutt.set("arrow_cursor", true)
>lua mutt.set("abort_noattach", mutt.QUAD_ASKNO)
>
># commands, the three following ones are strictly equivalent
>
>lua mutt.command.color("quoted", "brightblue", "default")
>lua mutt.call("color", "quoted", "brightblue", "default")
>lua mutt.enter("color quoted brightblue default")
>
># of course the first one is more elegant
>```
I have a question about this. Will it be mandatory to mixing ‘normal’ 
{,Neo}mutt configuration directives with Lua code or can both be placed
in separated files and sourced from there? That probably would prevent 
(new) user from getting confused, I think.

The reason behind this is, as I came to Lua due to my former favourite 
editor SciTE [1], I was glad to separate normal statically (treated as 
default) configuration from Lua scripting and to know which is which by 
using a simple startup script declaration [2].

This way it was also possible to implement a global table (as a normal 
user) which realised a pseudo object-oriented programming syntax within 
additionally Lua scripts due to the require() statement. And using the 
several exposed events from SciTE — that was fun pure.

># Finally
>
>don't hesitate to follow up on this mail, ping me on IRC (zmo on
>#neomutt), open an issue in the bugtracker for ideas, feature requests,
>or when you'll find a bug.
>
>Thank you for reading this mail 🙌
>And have fun with it!
I’m sure I will when I found the way how to compile, install and testing 
Neomutt without influencing my existing ‘old dog’. ;-)
>
>Cheers,
>
>-- 
>zmo
Thanks for working on this.


[1] <http://www.scintilla.org/SciTELua.html>
[2] <http://www.scintilla.org/SciTEDoc.html#property-ext.lua.startup.script>


-- 
Regards,
floyd



More information about the neomutt-users mailing list