Carl Worth yazmış: > On Fri, 15 Jan 2010 13:16:00 +1300, martin f krafft <madduck@madduck.net> wrote: > > Lua for hooks has the advantage that the hooks can be executed in > > the context of manipulateable objects. On the other hand, hooks in > > the style of run-parts directories are more flexible and accessible, > > and could always be invoked as filters for the manipulateable data. > > Good point. > > One thing that notmuch has in its favor already is that there's a > command-line interface that provides all of the interesting > functionality. So it's already a fairly trivial matter to "hook" things > like "notmuch new" by writing a script in whatever language you prefer > to invoke things like "notmuch search" and "notmuch tag". > > And that's what I'm doing already, (with a shell script), to tag > newly-arrived messages. > > The only part that's really missing here is a directory where scripts > could be dropped in and get automatically invoked. > > What do you think, Ali? Would an approach like that satisfy the things > you had in mind for hooks? > It might, here are some thoughts and questions to help you elaborate: - How will these scripts manipulate data? e.g.: A "tagger" script may get the new mail from stdin and print out the new tags which notmuch will read and apply to the message. A "search-filter" script may get search results from stdin and filter them. Just my initial thoughts. This script approach has both upsides and downsides. I have some experience about this because I wrote a tool called mpdcron¹ which executes hooks based on mpd events. First I thought it would be cool to execute scripts based on events by passing data using environment variables. However this approach didn't give hooks enough power to save state information etc. so I decided to add module support through GModule. I may be going a bit off topic here but what I'm trying to explain is scripts may not give power-users enough options and is practically slower than having Lua, or another scripting language, support. In my humble opinion the former is just a hack while the latter is the proper way to do it. P.S.: As I stated in the beginning you could have elaborated what you meant by script support and I'm just commenting on what I've understood. ¹: http://alip.github.com/mpdcron/ > -Carl -- Regards, Ali Polatel