# _M.textadept.session

Session support for Textadept.

- - -

## Fields

- - -

<a id="DEFAULT_SESSION"></a>
### `DEFAULT_SESSION` (string)

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

  [`_G.CURSES`]: _G.html#CURSES

- - -

<a id="MAX_RECENT_FILES"></a>
### `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`.

  [`io.recent_files`]: io.html#recent_files

- - -

<a id="SAVE_ON_QUIT"></a>
### `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()`](#load).
  The default value is `true`, but is disabled when passing the command line
  switch `-n` or `--nosession` to Textadept.

- - -


## Functions

- - -

<a id="load"></a>
### `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`](#DEFAULT_SESSION)

- - -

<a id="save"></a>
### `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`](#DEFAULT_SESSION)

- - -


