So the work on lumail2 is going well, and already I can see that it is a good idea. The main reason for (re)writing it is to unify a lot of the previous ad-hoc primitives (i.e. lua functions) and to try and push as much of the code into Lua, and out of C++, as possible. This work is already paying off with the introduction of new display-modes and simpler implementation.
View modes are an important part of lumail, because it is a modal mail-client. You're always in one mode:
- Shows you lists of Maildir-folders.
- Shows you lists of messages inside the maildir you selected.
- Shows you a single message.
This is nothing new, but there are two new modes:
- Shows you the attachments associated with the current message.
- Shows you your configuration-settings and trivia.
Each of these modes draws lines of text on the screen, and those lines consist of things that Lua generated. So there is a direct mapping:
With that in mind it is possible to write a function to scroll to the next line containing a pattern like so:
function find() local pattern = Screen:get_line( "Search for:" ) -- Get the global mode. local mode = Config:get("global.mode") -- Use that to get the lines we're currently displaying loadstring( "out = " .. mode .. "_view()" )() -- At this point "out" is a table containing lines that -- the current mode wishes to display. -- .. do searching here. end
Thus the whole thing is dynamic and mode-agnostic.
The other big change is pushing things to lua. So to reply to an email, populating the new message, appending your ~/.signature, is handled by Lua. As is forwarding a message, or composing a new mail.
The downside is that the configuration-file is now almost 1000 lines long, thanks to the many little function definitions, and key-binding setup.
At this rate the first test-release will be out at the weekend, but API documentation, and sample configuration file might make interesting reading until then.
Tags: lumail2 No comments