[notmuch] Thoughts on notmuch and Lua
Carl Worth
cworth at cworth.org
Thu Jan 14 15:00:11 PST 2010
On Thu, 14 Jan 2010 10:47:13 +0200, Ali Polatel <alip at exherbo.org> wrote:
> Before trying to implement anything I decided to send a mail to the list
> to ask people's opinion.
Hi Ali, welcome to notmuch!
I appreciate you soliciting opinions, but I hope that my answer won't
discourage you. By all means, please feel free to experiment!
> What's the problem?
> ===================
> Notmuch isn't very configurable.
I'll grant that. And as can be seen in TODO and in code comments, we
definitely want to fix that.
> 1. Configuration file:
> The configuration file can be a Lua script that allows more dynamic
> configuration. Here's an example:
>
> # notmuch configuration file:
> config = {}
> config.dbpath = "/path/to/maildir"
> config.exclude = function (maildir)
> return not string.match(maildir, ".*Trash.*")
> end
> ...
That doesn't look very compelling to me.
I'd much rather have:
[database]
path=/home/cworth/mail
maildir_exclude=.*Trash.*
with the exact same functionality.
Granted, having a full programming language in the configuration file
makes thing much more dynamic, but it also makes it much harder for the
user to read, edit, and ensure the syntax is correct.
> 2. Hooks:
> This is a feature I really miss having switched from sup.
> There can be many hooks, a hook that formats search output,
> a hook that is called before adding messages to the database which may
> be used to add initial tags depending on headers etc.
I understand that some people really like their hooks. They let users
invent all kinds of interesting, custom functionality.
But I think hooks also have problems. Sometimes the most interesting
functionality has to be pieced together by every user going to a wiki
page and finding the "standard" hooks. I'd much rather avoid that by
getting the most useful functionality into the program in the first
place.
Hooks also impose a particular amount of maintenance burden on the
software. And they are often implemented in a way that makes them very
hard to be discovered.
I wrote a message to the sup mailing list describing some of these
issues. The context there was a patch I wrote adding a configuration
option, (and the sup maintainer preferring it be added as a patch
instead):
id:1254417826-sup-6584 at yoom.home.cworth.org
Subject: Re: [sup-talk] [PATCH] Add new :crypto_default configuration option.
I did find out later that the sup hooks were more self-documenting than
I had understood. (There was a sup command-line option that printed
documentation for all available hooks.) Something like that is
definitely a requirement for providing hooks.
So I'm not entirely opposed to the idea of adding hooks to notmuch, but
I'll definitely need to be convinced that any particular functionality
can't be better integrated without the hook.
> Why Lua?
> ========
> Lua has many advantages over other scripting languages when it comes to
> integration with a C program. It has a very clean and easy C API, the
> overhead of running Lua scripts is not noticable among other things.
I've definitely heard lots of good things about "lua embedability". So
if we do decide to provide hooks, then lua would seem like a logical
option to look at first. I've never looked at it closely myself though.
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100114/de7d8874/attachment.pgp>
More information about the notmuch
mailing list