Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve support of a scripting language #153

Closed
ghost opened this issue Sep 18, 2016 · 24 comments
Closed

improve support of a scripting language #153

ghost opened this issue Sep 18, 2016 · 24 comments
Assignees
Labels
topic:lua-scripting Lua Scripting type:enhancement Feature Request

Comments

@ghost
Copy link

ghost commented Sep 18, 2016

The main target of this issue is to collect ideas around improving the scripting ability of mutt.

make mutt completely scriptable by a scripting language

It would be great if mutt would allow configuration in a scripting language. I think the main advantages of this point is readability for complex things and making mutt configs more powerful.

  • Mutt does kind of allow functions by using external shell commands/scripts (this way, even perl/lua oneliners are possible, i think.)
  • Neomutt has support for if statements

what is the problem with the existing solutions?

  • if we want to use functions, we need to call bash/perl/whatever, which is not very resource efficient
  • either we have to use one liners, or we have to create a sperate file which contains those external functions. I personally would love to see everything in one file.
  • we have no arrays, no type system (e.g. no integer variables) in mutt.
  • we have glue code like: !zsh -ic FunctionToExecute<enter> which consumes just space without
    poviding information.

Lua

advantages

64-bit Linux, the Lua interpreter built with all standard Lua libraries takes 245K and the Lua library takes 420K.

  • higher order functions maybe can provide elegant solutions to solve complex problems

Python

advantages

  • way more libraries

disadvantages

  • slow

@flatcap worked already on integrating lua

some general ideas

Questions

  • Are there other languages we could use? What about Python, ruby, etc. ?
  • Why is lua currently our best approach?
  • What use cases can you think of?
  • should we directly replace the current muttrc with a lua config? or should we add a option embedding e.g. lua into the current muttrc ?

lets discuss :)

@flatcap flatcap added type:discuss Your views/opinions are requested enhancement labels Sep 18, 2016
@flatcap
Copy link
Member

flatcap commented Sep 20, 2016

Why LUA?

It's a simple language to understand.
It was very easy to integrate into C.

By contrast, Perl required me to define interfaces and create wrappers.
I couldn't find a simple way to do simple things.

What can LUA do?

It's a programming language like all the others: variables, loops, etc.
It comes with libraries to read files, talk to databases, etc.

What does the demo version do?

To be useful for scripting, I decided I needed to be able to:

  • Call a LUA script from C
  • Pass variables from C to LUA
  • Read LUA variables from C
  • Call a C function from LUA

The last item makes the scripting really useful.
We can write wrapper functions, to manipulate emails, and export them -- allowing a simple script to automate mutt.

@pickfire
Copy link
Contributor

@flatcap Yeah, I notice Lua have the speed (almost comparable with C/C++), not sure why everyone choose python. (I use python here but really hoping to use Lua)

python seems nice as most systems have it by default but I hate having 2 different versions of python with their respectives libraries which wasted me around 200MB each.

Not sure about ruby and perl, from what I know, I think they are mostly used to do something related to text and strings.

Fun fact: Neovim port most of the vim scripts to lua https://github.com/neovim/neovim/wiki/FAQ#design

@flatcap
Copy link
Member

flatcap commented Sep 21, 2016

This is a list of everything I could think to script.
There's a lot of overlap / recurring themes.
Some of the ideas are sensible, some not :-)

General

All scripts would be passed:

  • neomutt version string
  • current date

Have access to functions:

  • patch_supported()

Config

Allow script to be embedded in normal Mutt config files, e.g. like PHP:

Pass in:

  • username
  • user's home dir
  • current config file
  • line number
<?lua
    if (MUTT_VERSION > "20160916") then
        mutt_config("set sidebar_visible")
    end
?>

Lua's print() function could be overridden to call mutt_message()

Index

A one-pass processing of the mailbox.
Call the script once for each email.

Add new expandos, %L1, %L2, etc to be filled by the script.

Pass in:

  • Copy of all the fields
  • Current account
  • Current mailbox
  • Current email

Define functions to:

  • Colour:
    • All of the line
    • One field
    • Regex on field, or line
  • Modify a field (‡)
  • Hide / Delete an email (‡)
  • Set the fold level of thread
  • Set score of email
  • Lookup address -- is_alias()
  • Add/remove icon for email
    • Flag GitHub notifications
    • Add coloured stars

Can optionally disable Mutt's colouring

Pager

A one-pass processing of an email.
Call the script once for each line.

Define functions to:

  • Query the headers
  • Colour all, or part, of the line
    • Look for markers like "^diff"
    • Look for a signature: "-- "
    • Heuristics for languages
  • Modify a line (‡)
  • Hide / Delete a line (‡)
  • Insert a new line (‡)
  • Set the fold level

‡ Actions are non-destructive

Sidebar

Sidebar mailbox entries
Define functions to:

  • Colour all, or part, of the line
  • Visibility - hide a mailbox
  • Modify a mailbox name (‡)
  • Change Counts of: flagged, read, total emails (‡)

‡ Actions are non-destructive

e.g.

  • Hide folders with no new mail
  • Emails in "drafts" are always unread

Hooks

These hooks might be useful to override with a script:

  • account-hook
  • close-hook
  • folder-hook
  • reply-hook
  • send-hook
  • timeout-hook

Most useful, would be a new-mail-hook.

Pass it:

  • Account info
  • Mailbox info
  • Email headers
  • Current date
  • Size
  • Number of attachments
  • List of attachments

Allow it a small set of functions:

  • set_flag: read, flagged
  • set_score
  • email: move, copy, delete
  • search body
  • search attachment
  • stop processing

Status Bar

Generate: $status_format, $ts_status_format

Pass info about current:

  • account
  • mailbox
  • email
  • max length

Testing framework

Need to expose:

  • index functions
  • sidebar functions
  • variables

Be able to:

  • call functions
  • send keystrokes
  • get error codes returned from functions
  • save the results

Automation:

  • Run tests on Travis
  • Need public access to test mailboxes

Create a test rig, built from Mutt code, that takes a mailbox and a script.

  • test-rig test.mbox config.lua
  • machine-parseable output

@guyzmo
Copy link
Contributor

guyzmo commented Jan 3, 2017

About the lua integration in the config files, I'd rather prefer to follow vim/neovim's way of adding a mutt command: lua (or maybe something like ex/exec or script) to execute discrete commands:

lua mutt_echomsg("Hello world!")

that would work on a single environment, so that:

lua x, y = hello, world
lua mutt_echomsg(x .. y)

then we could extend using the following UNIX standard syntax pretty easily:

lua << END
mutt_echomsg("Hello world!")
END

because mutt config is not a tag based language, I'd rather see the above syntax instead of suggested:

<?lua
?>

@guyzmo
Copy link
Contributor

guyzmo commented Jan 12, 2017

I have had a little thought on lua integration, and I've read a bit on the neovim approach.

New mutt commands

  • lua: execute a line of command in the rc file or the enter-command contexts
  • luasource: source a lua file

eventually make it possible to introduce a new syntax in neomutt to parse multiline lua scripts inline of an rc file:

lua << END
…
END

API

As a start we could consider having only a couple of APIs

  • mutt_parse_exec which will run any command passed as a string parameter into the current context.
  • mutt_parse_rcline which will run any command passed as a string parameter as a config file line (or enter-command context).

to make it possible to run context-aware commands, extending the API to support arguments and prevent any interactive enquiring will be necessary, cf #294.

Keep the API close to the C code

  • exposing functions and globals using. That would mean exposing all mutt functions and settings from init.h's Commands[] and globals.h variables defined with WHERE, using a mutt_<function_name>() or mutt_<setting_name> symbol.
  • exposing contextualised functions using mutt_<context>_<function_name>() and context dependent settings (if possible) using mutt_<context>_<setting>.

eventually turn it into a nicer lua API using lua itself

we could then have some code to expose a nice OO-like approach to the API using a mutt singleton with a full API exposing the globals and rcline-level functions as methods, and the context aware ones as a mutt.context member.

Something in the idea of lua-client

Add the ability to create new commands and hooks

Finally, the toughest part will be to have mutt integrate lua code from mutt, by adding the ability to register new:

  • commands — either globals ones, or context-dependent ones,
  • settings
  • context hookss — though registery a new command should make it hookable.

guyzmo added a commit to guyzmo/neomutt that referenced this issue Jan 14, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
@guyzmo
Copy link
Contributor

guyzmo commented Jan 14, 2017

I have implemented the first step in this branch:

  • two new commands:
    • :lua to run one line of lua script,
    • :lua-source to load a lua script file
  • two mutt API methods exposed in lua:
    • mutt.message() and
    • mutt.error()

as a next step exposing existing init.h functions in lua.

@somini
Copy link
Contributor

somini commented Jan 14, 2017

This is the branch: https://github.com/guyzmo/neomutt/tree/feature/lua-scripting, not the one in the neomutt organization.

I tested this and got mutt.error to work. What's the mutt.print signature?

I also tested the lua-source with this script:

print(1+2)

And mutt entered pager mode, even though the terminal borked and I had to <C-l> it.
Great work, @guyzmo

@guyzmo
Copy link
Contributor

guyzmo commented Jan 14, 2017

Oops, my bad, it's print.message() updating my former post.

Here's a few examples:

:lua mutt.message("Hello World!")
→ Hello World!
:lua mutt.error("Fubar!")
→ Fubar!
:lua print("Get out!") → Get out! (on real stdout)

Basically if you set in your muttrc:

color error brightred default
color message brightcyan default

error messages will be in red, and the others in cyan.

@guyzmo
Copy link
Contributor

guyzmo commented Jan 15, 2017

just added the mutt.call() API, so that you can do:

:lua out = mutt.call("set visual")
:lua mutt.message(out)
→ visual=vim
:lua out = mutt.call("set visual="nvim"")
:set visual
→ visual=nvim

😎

@somini
Copy link
Contributor

somini commented Jan 16, 2017

I can confirm this, it works!

@guyzmo
Copy link
Contributor

guyzmo commented Jan 16, 2017

updates to the API:

former mutt.call is now mutt.enter (which is the : binding to enter-command in mutt):

mutt.enter("color quoted brightblue default")

and new mutt.call API is as follows:

mutt.call("color", "quoted", "brightblue", "default")

but it is also exposed as straight lua methods:

mutt.command.color("quoted", "brightblue", "default")

the set API now supports all internal types, cf this gist:

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)
lua mutt.set("alias_file", "~/muttrc")
lua mutt.set("mbox_type", "Maildir")
lua mutt.set("sort", "date")
lua mutt.set("mask", "!^\\\\.[^.]")
lua mutt.set("to_chars", "+TCFL")
lua mutt.set("from", "fubar@example.org")

and it will throw exceptions at you if you do it wrong!

@guyzmo
Copy link
Contributor

guyzmo commented Jan 16, 2017

Added support for myvars.

lua mutt.set("my_fubar", "Zaphod Beeblebrox")

@guyzmo
Copy link
Contributor

guyzmo commented Jan 16, 2017

Added -B parameter for batch mode (so you don't get the ncurses UI up when running a script, so far it's really useful for testings).

It's exiting before the part sending mails in main.c so I don't think it's optimal.

@guyzmo
Copy link
Contributor

guyzmo commented Jan 16, 2017

I'm pretty much done with the first part of the implementation.

Please review the code, test the features, break it, and come back commenting and cristicising it!
I'm all ears

🤗

@ghost ghost added the topic:lua-scripting Lua Scripting label Jan 21, 2017
@somini
Copy link
Contributor

somini commented Jan 21, 2017

So, I spent the afternoon playing around with this. Once we can integrate hooks into executing LUA code, the sky is the limit!

Some context first.

I use mutt with various accounts, so instead of manually managing the "mailboxes" for new accounts, I put them in a hierarchy and wrote a Python script to create the mailboxes command for me. It's ugly, but it works for my setup. Here's the hierarchy

  • Work
    • Group1
      • Employer1
        • INBOX
        • ...
      • Employer2
        • INBOX
        • ...
  • Personal
    • GroupA
      • AccountA1
        • INBOX
        • ...
      • AccountA2
        • INBOX
        • ...

This lets me call my mutt wrapper mutt-profile Work that sets the "folder" to that path and I only get work emails in that window. Notmuch works automagically, since the ".notmuch" folders are separate. Avoids finding personal emails in work-related searches.

The Python script receives a profile and creates the mutt "mailboxes" command. Here it is: https://gist.github.com/somini/84c5d624d0f14784e60da3817530ab48

I converted it to LUA (minus some improvements) and it works perfectly. Since I use the mutt bindings, it can be much improved and doesn't suffer from string escaping bugs. Here: https://gist.github.com/somini/c13f73d60d3a550ffa69314048daa2ec

@somini
Copy link
Contributor

somini commented Jan 21, 2017

I do have a bug report, if I set mutt.set("sidebar_visible", "yes") in a script, the variable is on but the sidebar is not visible.

@flatcap
Copy link
Member

flatcap commented Jan 21, 2017

mutt.set("sidebar_visible", "yes") in a script, the variable is on but the sidebar is not visible.

The options in init.h have various refresh flags.
When $sidebar_visible is changed it needs to trigger a redraw.

@ghost
Copy link
Author

ghost commented Jan 22, 2017

Regarding the PR from @guyzmo :

in general nice work :) I don't use mutt much, but i think it would provide some great readability advantages when we can replace our conditional features with lua. What do you think about that?

@guyzmo
Copy link
Contributor

guyzmo commented Jan 22, 2017

@somini indeed, the mutt_option_set() function is not caring for redrawings and resorting. That will need to be added.

@guyzmo
Copy link
Contributor

guyzmo commented Jan 22, 2017

@toogley yes, I believe that the if construct or the conditional formats could be replaced by lua stuff, in a similar fashion to the hooks implementation. But we'd need to be careful not to offload too much to lua at risks of slowing mutt down! Especially when running a callback once for each mail (for each displayed mail, it should be fine, though).

flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 11, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 19, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Feb 19, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Feb 19, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Feb 19, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Feb 19, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit that referenced this issue Feb 19, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit that referenced this issue Feb 19, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 20, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 20, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 20, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 25, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit to guyzmo/neomutt that referenced this issue Feb 25, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit that referenced this issue Feb 25, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit that referenced this issue Feb 25, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Feb 25, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Feb 26, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Mar 1, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Mar 1, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit that referenced this issue Mar 1, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit that referenced this issue Mar 1, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
guyzmo added a commit to guyzmo/neomutt that referenced this issue Mar 1, 2017
* adds the following to Mutt's API:
 * `:lua` to execute a line of Lua
 * `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
 * `mutt.message()` To write a message on Mutt's command line
 * `mutt.error()` To write an error message on Mutt's command line
 * `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
 * `mutt.get()` get a variable from Mutt
 * `mutt.set()` sets a variable from Mutt (with type enforcement)
 * `mutt.call()` calls a command available in mutt, with arguments
 * `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
 * proper error handling of the Lua interpreter
 * exposed mutt_option_set and mutt_option_get from init

fixes: neomutt#153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
flatcap pushed a commit that referenced this issue Mar 11, 2017
* adding two commands:
 - lua: to parse a line of lua code
 - lua-source: to load and parse a lua file
* binding two mutt functions in lua:
 - mutt_message and
 - mutt_error

cf #153

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
@ghost ghost assigned flatcap Mar 11, 2017
@ghost ghost removed the status:in-progress label Mar 11, 2017
@guyzmo
Copy link
Contributor

guyzmo commented Mar 13, 2017

hurra 🙌👍♥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:lua-scripting Lua Scripting type:enhancement Feature Request
Projects
None yet
Development

No branches or pull requests

4 participants