Lumail - The console email client


Lua primitives: global_mode()

NOTE: Lumail-legacy has been superseded by Lumail 2.x, which has a wholly unified Lua API.

The lumail client is a modal mail-client which means you're always in one of four modes:

maildir

Viewing the list of Maildir folders.

index

Viewing the list of messages contained within your selected folder(s).

message

Viewing a single message.

text

Viewing some static text, whether set by show_text(), or show_file_contents()

The global_mode function will return the current mode, or allow you to change to a new one.

For example:

-- view the mode
msg( "The current mode is " .. global_mode() );

-- change the mode
global_mode( "maildir" );


--
-- Open a folder exclusively.
--
-- This behaves like the traditional "open folder"
-- function in our favourite mail client.
--
function open_folder()
   clear_selected_folders();
   add_selected_folder()
   global_mode( "index" );
   clear();
end

--
-- Call the function we've just defined if RETURN
-- is pressed in maildir-mode
--
keymap['maildir']['\n'] = 'open_folder()'

Availability

This function has been available since version 0.07.

See Also

See also keymap, on_mode_change.