Minimum Profit API
==================

This reference documents version 5.1.3-dev of the MPSL API.

By Source
---------

mp_clipboard.mpsl
~~~~~~~~~~~~~~~~~

 * ./#mp.copy (mp.copy)

mp_core.mpsl
~~~~~~~~~~~~

 * ./#mp.redraw (mp.redraw)

mp_edit.mpsl
~~~~~~~~~~~~

 * ./#mp.break_line (mp.break_line)

mp_search.mpsl
~~~~~~~~~~~~~~

 * ./#mp.search_set_y (mp.search_set_y)

mp_spell.mpsl
~~~~~~~~~~~~~

 * ./#mp.ignore_last_misspell (mp.ignore_last_misspell)
 * ./#mp.is_word_misspelled (mp.is_word_misspelled)
 * ./#mp.ispell (mp.ispell)
 * ./#mp.search_misspelled (mp.search_misspelled)

mp_syntax.mpsl
~~~~~~~~~~~~~~

 * ./#mp.section_list (mp.section_list)

mp_writing.mpsl
~~~~~~~~~~~~~~~

 * ./#mp.repeated_words (mp.repeated_words)

Alphabetical
------------

 * ./#mp.break_line (mp.break_line) - Breaks current line in two (inserts a newline).
 * ./#mp.copy (mp.copy) - Copies to the clipboard
 * ./#mp.ignore_last_misspell (mp.ignore_last_misspell) - Ignores last misspelled word.
 * ./#mp.is_word_misspelled (mp.is_word_misspelled) - Tests if a word is misspelled.
 * ./#mp.ispell (mp.ispell) - Changes spelling highlight.
 * ./#mp.redraw (mp.redraw) - Triggers a redraw on the next cycle.
 * ./#mp.repeated_words (mp.repeated_words) - Finds words starting or ending the same in a range.
 * ./#mp.search_misspelled (mp.search_misspelled) - Searches for the next misspelled word.
 * ./#mp.search_set_y (mp.search_set_y) - Sets the y position after a successful search.
 * ./#mp.section_list (mp.section_list) - Returns the list of sections of a document.


mp.break_line
-------------

Name
~~~~

*mp.break_line* - Breaks current line in two (inserts a newline).

Synopsis
~~~~~~~~

 mp.break_line(doc, col);

Arguments
~~~~~~~~~

 * doc: the document
 * col: column where the newline will be inserted 

Description
~~~~~~~~~~~

Breaks current line in two by inserting a newline character in between.
If _col_ is not NULL, the newline will be inserted in that column; otherwise,
the current x position will be used.


mp.copy
-------

Name
~~~~

*mp.copy* - Copies to the clipboard

Synopsis
~~~~~~~~

 mp.copy(doc);

Arguments
~~~~~~~~~

 * doc: the source of the copy

Description
~~~~~~~~~~~

If _doc_ is a document, it copies to the clipboard the content of the
selected block, if one exists. If _doc_ is an array or scalar, it copies
that data directly into it.


mp.ignore_last_misspell
-----------------------

Name
~~~~

*mp.ignore_last_misspell* - Ignores last misspelled word.

Synopsis
~~~~~~~~

 mp.ignore_last_misspell();

Description
~~~~~~~~~~~

Ignores the last misspelled word found by mp.search_misspelled()
by adding it to a whitelist, so it won't be found again.


mp.is_word_misspelled
---------------------

Name
~~~~

*mp.is_word_misspelled* - Tests if a word is misspelled.

Synopsis
~~~~~~~~

 mp.is_word_misspelled(w);

Arguments
~~~~~~~~~

 * w: the word

Description
~~~~~~~~~~~

Tests if a word is misspelled. Returns a negative value if
there was an error when querying the external spelling program,
1 if the word is misspelled, or 0 if not.


mp.ispell
---------

Name
~~~~

*mp.ispell* - Changes spelling highlight.

Synopsis
~~~~~~~~

 mp.ispell(b);

Arguments
~~~~~~~~~

 * b: boolean value

Description
~~~~~~~~~~~

Changes the status of the highlighting of misspelled words.
If _b_ is 0, it's disabled (default value); if it's 1,
misspelled words will be highlighted using a special
attribute color. If _b_ is -1, the status is toggled.


mp.redraw
---------

Name
~~~~

*mp.redraw* - Triggers a redraw on the next cycle.

Synopsis
~~~~~~~~

 mp.redraw();

Description
~~~~~~~~~~~

Triggers a full document redraw in the next cycle.


mp.repeated_words
-----------------

Name
~~~~

*mp.repeated_words* - Finds words starting or ending the same in a range.

Synopsis
~~~~~~~~

 mp.repeated_words(doc, num_chars, max_dist);

Arguments
~~~~~~~~~

 * doc: the document
 * num_chars: minimum length for the word to be tested
 * max_dist: maximum distance the word must have

Description
~~~~~~~~~~~

Finds words starting or ending the same to a maximum of _num_chars_
and that are less than _max_dist_ words apart. If a pair of these words
is found, 1 is returned, the cursor positioned over the first one
and both highlighted as spelling errors. Otherwise, 0 is returned
and nothing is done.


mp.search_misspelled
--------------------

Name
~~~~

*mp.search_misspelled* - Searches for the next misspelled word.

Synopsis
~~~~~~~~

 mp.search_misspelled(doc);

Arguments
~~~~~~~~~

 * doc: the document to search

Description
~~~~~~~~~~~

Searches the document for the next misspelled word. If no
more misspelled words can be found, returns 0 and does nothing;
otherwise, the cursor is moved just after that word and
returns 1.


mp.search_set_y
---------------

Name
~~~~

*mp.search_set_y* - Sets the y position after a successful search.

Synopsis
~~~~~~~~

 mp.search_set_y(doc, y);

Description
~~~~~~~~~~~

Sets the y position after a successful search, setting the
visual line to that defined in mp.config.move_seek_to_line.


mp.section_list
---------------

Name
~~~~

*mp.section_list* - Returns the list of sections of a document.

Synopsis
~~~~~~~~

 mp.section_list(doc);

Arguments
~~~~~~~~~

 * doc: the document

Description
~~~~~~~~~~~

Applies the `section' array of regular expressions of the
document's syntax definition and returns it as an array of
line and line number pairs.

If the document has no syntax highlight definition, or it has
one without a `section' definition, NULL is returned. Otherwise,
an array of line, line number pairs is returned (it can be
an empty list if the document has no recognizable sections).


----
Angel Ortega - angel@triptico.com - Built with http://triptico.com/software/mp_doccer.html (mp_doccer 1.2.2)
