# Minimum Profit Action Reference

     Angel Ortega <angel@triptico.com>

Minimum Profit actions are editor commands that can be directly bound to the menu or a key.

## about

About...

Shows the "About Minimum Profit" information.

## build

Build project... (`f2`)

Invokes the building of a Make project. If the `Makefile` file exists in the working directory, all targets are extracted from it and shown in a list dialog for the user to select one. The selected one will be called as the only argument for the `make` program and its output read. All warnings and errors will be catched and shown in another list dialog to be edited and fixed.

## close

Close (`ctrl-w`)

Closes the active document. If there are unsaved changes, a confirmation dialog is shown.

## close_all

Close all

Closes all open documents.

## complete

Complete... (`ctrl-u`)

Takes the (probably partial) word under the cursor and searches for words in the current document that start with it. If more than one is found, a list dialog is shown to make a selection. The word will be replaced with the selected one.

## complete_symbol

Symbol completion...

Uses a similar approach than the `complete` action, but using the current tags file as the completion list. If no tags file exist in the working directory, the ctags program is invoked to build it.

For other uses of the tags file, see `find_tag`.

## copy_mark

Copy block (`ctrl-c`)

Copies the currently selected block to the clipboard.

## cut_mark

Cut block (`ctrl-x`)

Copies the currently selected block to the clipboard and deletes the block.

## delete

Delete character (`delete`)

Delete the character over the cursor.

## delete_left

Delete character to the left (`backspace`)

Deletes the character to the left of the cursor.

## delete_line

Delete line (`ctrl-y`)

Deletes the line under the cursor.

## document_list

Document list

Shows a dialog with the list of currently open documents. The list cursor will be over the active one and the documents with pending modifications will be prefixed with an asterisk. Selecting a different one will make it become the active.

## encoding

Set charset encoding...

Shows a dialog asking for a string describing the charset encoding that will be used when saving or opening new documents. Valid ones are `UTF-8`, `ISO8859-1`, etc. The acceptable values are system-dependent (but `UTF-8` is always available). If an empty string is entered, the current locale will be used.

## eval

Execute MPSL code... (`escape`)

Shows a dialog asking for a string of MPSL code that will be executed.

## eval_doc

Execute document as MPSL

Executes the active document as MPSL code.

## exec_command

Run system command...

Shows a dialog asking for a system command to execute. If the command is preceded by the pipe symbol (|), the active document will be fed as the standard input of the command; otherwise, the standard output of the command will be inserted in the cursor position.

## exit

Exit (`ctrl-q`)

Closes all documents and exists Minimum Profit.

## find_tag

Search tag... (`ctrl-t`)

Shows a dialog asking for a tag to search. The tags file will be read from the working directory and the tag searched there; all symbols starting with it will be shown in a list dialog. When selecting a tag from that list, the file containing it will be open and the cursor moved to where the tag is. This is a useful way of finding where a function or variable is defined.

If no tags file exist in the working directory, the ctags program is invoked to build it.

For other uses of the tags file, see `complete_symbol`.

## goto

Go to line... (`ctrl-g`)

Shows a dialog asking for a line number. If accepted, the current document cursor will move to that line (if existent).

## grep

Grep (find inside) files...

Shows a dialog asking for a string to be searched, and an optional spec of files to search the string in. If no spec is given, all files in the working directory are scanned. Then, a list dialog box will be shown to pick the wanted instance.

This is a useful way of find where a function or variable is used.

## help

Help on word over cursor (`f1`)

Picks the word under the cursor and asks the underlying system for help about that term.

## insert_line

Insert line (`enter`)

Inserts a new line. If the cursor is in the middle of a line, it's split in two.

## insert_space

Insert space (`space`)

Inserts a space, triggering word wrapping, if active.

## insert_tab

Insert tab (`tab`)

Inserts a tabulator, triggering word wrapping, if active.

## insert_template

Insert template...

Shows a list dialog with the names of the templates for the user to select one, that will be inserted in the cursor position.

## join_paragraph

Join a paragraph in one line (`f6`)

Joins the text from the cursor position to the next empty line as one paragraph.

## line_options

Line options...

Shows a dialog asking for line configuration options, like word wrapping, end of line string, etc.

## load_session

Load session

Loads a session, previously saved by `save_session`.

## mark

Mark beginning/end of block (`f9`)

Marks the beginning or the end of the block.

## menu

Menu (`ctrl-a`)

Calls the menu.

## mouse_drag_mark

Mark using mouse dragging (`mouse-drag`)

This action is called by the underlying driver when the mouse is used to drag over text. It must not be called nor bound to a key.

## move_bof

Beginning of document (`ctrl-home`)

Moves the cursor to the beginning of the document (first line, first column).

## move_bol

Beginning of line (`home`)

Moves the cursor to the beginning of the current line (first column).

## move_down

Line down (`cursor-down`)

Moves the cursor to the next line.

## move_eof

End of document (`ctrl-end`)

Moves the cursor to the last line of the document.

## move_eol

End of line (`end`)

Moves the cursor to the end of the current line.

## move_left

Character left (`cursor-left`)

Moves the cursor one character to the left. If it's in the beginning of a line, moves to the last character of the previous line.

## move_mouse_wheel_down

Mouse wheel down (`mouse-wheel-down`)

Moves the cursor four lines down.

## move_mouse_wheel_up

Mouse wheel up (`mouse-wheel-up`)

Moves the cursor four lines up.

## move_pgdn

Page down (`page-down`)

Moves the cursor a page down.

## move_pgup

Page up (`page-up`)

Moves the cursor a page up.

## move_right

Character right (`cursor-right`)

Moves the cursor one character to the right. If it's over the end of the line, moves to the first character of the next line.

## move_to_mouse_position

Move cursor to mouse click (`mouse_left_button`, `mouse_right_button`, `mouse-middle-button`)

Moves the cursor to where the mouse is. This action is called by the underlying system and must not be directly called nor bound to a key.

## move_up

Line up (`cursor-up`)

Moves the cursor to the previous line.

## move_word_left

Word left (`ctrl-cursor-left`)

Moves the cursor to the beginning of the previous word.

## move_word_right

Word right (`ctrl-cursor-right`)

Moves the cursor to the beginning of the next word.

## new

New

Creates a new unnamed document.

## next

Next (`ctrl-n`)

Select the next document as the active one. The list of documents is circular; if the active one is the last, the first one is selected.

## open

Open... (`ctrl-o`)

Shows a dialog to open a file. Its behaviour and look are system-dependent.

If the document to be opened is password-protected, a dialog asking for the password will also appear.

## open_config_file

Edit configuration file

Opens the user configuration file for editing. It doesn't have to exist.

## open_templates_file

Edit templates file

Opens the templates file for edition. Templates defined here can be later inserted by calling `insert_template`. See the `mp_templates.sample` file included in the documentation for an example of the accepted format.

## paste_mark

Paste block (`ctrl-v`)

Pastes the text in the clipboard into the cursor position.

## play_macro

Play macro (`f7`)

Replays all keystrokes recorded during the previous learning mode, activated by a call to `record_macro`.

## prev

Previous

Select the previous document as the active one. The list of documents is circular; if the active one is the first, the last one is selected.

## record_macro

Record macro (`f10`)

Toggles learning mode. When active, all keystrokes are recorded to further execute them by a call to `play_macro`.

## redo

Redo

Redoes the previously undone operation, if any.

## replace

Replace... (`ctrl-r`)

Shows the search and replace dialog box.

## revert

Revert

Reverts the active document to the state on disk.

## save

Save... (`ctrl-s`)

Saves the active document. If it's unnamed, `save_as` is called instead.

## save_as

Save as...

Shows a dialog asking for a file name to save the current document as. Its behaviour and look are system-dependent.

## save_session

Save session

Saves all documents and its positions as a session to be later loaded by `load_session`.

## seek

Search text... (`ctrl-f`)

Shows the search text dialog.

## seek_next

Search next (`f3`)

Searches the next occurrence of the string entered by the `seek` action.

## seek_next_char

Move to next instance of current char (`ctrl-page-down`)

Searches for the next occurrence of the char under the cursor. This is useful, for instance, to jump to the next paren or brace.

## seek_prev

Search previous (`ctrl-f3`)

Same as `seek_next`, but searching backwards.

## seek_prev_char

Move to previous instance of current char (`ctrl-page-up`)

Searches for the previous occurrence of the char under the cursor. This is useful, for instance, to jump to the previous paren or brace.

## set_password

Password protect...

Shows a dialog asking (twice) for a password to protect the active document with when it's saved. From that moment on, each time the document is tried to open the password will be asked for.

Minimum Profit encrypts documents using a variant of the ARCFOUR algorithm.

## sync

Save modified texts

Saves all texts with pending modifications.

## tab_options

Tab options...

Shows a dialog asking for tabulator configuration options, like tab size, convert to spaces, etc.

## toggle_spellcheck

Toggle spellchecking

toggles spellchecking. When active, misspelled words will be shown underlined.

## undo

Undo (`ctrl-z`)

Undoes the last operation.

## unmark

Unmark block (`f8`)

Unmarks the selected block.

## word_count

Count words

Counts the number of words and lines in the active document.

## word_wrap_paragraph

Word-wrap a paragraph (`f4`)

Rebuilds the text from the cursor position to the following empty line using the wordwrapping setup. Wordwrapping must be set (see `line_options`).

## zoom_in

Bigger font (`f12`)

Selects a bigger font (only for GUIs).

## zoom_out

Smaller font (`f11`)

Selects a smaller font (only for GUIs).

Angel Ortega <angel@triptico.com>