_M.textadept.session - Textadept API

# Textadept

- Home |
- Download |
- Lua API |
- Source |
- Language Modules |
- Stats |
- Wiki |
- Mailing List

# _M.textadept.session

Session support for Textadept.

## Fields

### `DEFAULT_SESSION` (string)

The path to the default session file, `_USERHOME`/session, or `_USERHOME`/session_term if `_G.CURSES` is `true`.

### `MAX_RECENT_FILES` (number)

The maximum number of recent files to save to the session. Recent files are stored in `io.recent_files`. The default value is `10`.

### `SAVE_ON_QUIT` (bool)

Save the session when quitting. The session file saved is always `DEFAULT_SESSION`, even if a different session was loaded with `load()`. The default value is `true`, but is disabled when passing the command line switch `-n` or `--nosession` to Textadept.

## Functions

### `load`(filename)

Loads the Textadept session file filename or prompts the user to select one, returning `true` if the session file was opened and read. Textadept restores split views, opened buffers, cursor information, and recent files.

Parameters:

- `filename`: Optional absolute path to the session file to load. If `nil`, the user is prompted for one.

Usage:

- `_M.textadept.session.load(filename)`

Return:

- `true` if the session file was opened and read; `false` otherwise.

See also:

- `DEFAULT_SESSION`

### `save`(filename)

Saves a Textadept session to file filename or a user-selected file. Saves split views, opened buffers, cursor information, and recent files.

Parameters:

- `filename`: Optional absolute path to the session file to save. If `nil`, the user is prompted for one.

Usage:

- `_M.textadept.session.save(filename)`

See also:

- `DEFAULT_SESSION`