Syntax highlighting
My favorite editor (jed) can be configured a great bunch. Each adaptation is called a 'mode'. The syntax
highlighter for the C programming language is called the 'c_mode' and it is defined in the file 'cmode.sl'. Use
locate to locate where that file is on your machine.
On the right you see a C source file in the jed editor. The C syntax is highlighted. Of course, for C this is
a necessity, a prime factor, otherwise you cannot make the simplest of sources. Still, it comes in handy at
times. So now the goal is to construct something similar for Modula-2.
I have been looking in this matter for some days now and the docmentation seems shattered over many files. So
my first target is to make one page (this page) that contains as much data as will fit. And that's a lot!
S lang
| function syntax |
description |
|---|---|
| _get_point Int_Type _get_point () |
The _get_point function returns the current character offset fro the beginning of the line |
| _set_point _set_point (Int_Type nth) |
The _set_point function moves the current editing position to the nth character of the current line |
| backward_paragraph Void backward_paragraph () |
This function moves the current editing point backward past the current paragraph to the line that is a paragraph separator. Such a line is determined by the S-Lang hook is_paragraph_separator. This hook can be modified on a buffer by buffer basis by using the function set_buffer_hook. |
| bob Void bob () |
The function bob is used to move the current editing point to the beginning of the buffer. The function bobp may be used to determine if the editing point is at the beginning of the buffer or not |
| bol Void bol() |
This function moves the current editing point to the beginning of the current line. The function bolp may be used to see if one is already at the beginning of a line |
| bskip_chars Void bskip_chars (String str) |
This function may be used to skip past all characters defined by the string str. See skip_chars for the definition of str |
| bskip_non_word_chars Void bskip_word_chars () |
This function moves the current editing point backward past all non-word characters until a word character is encountered. Characters that make up a word are set by the define_word function. |
| bskip_word_chars Void bskip_word_chars () |
This function moves the current editing point backward past all word characters until a non-word character is encountered. Characters that make up a word are set by the define_word function. |
| down Integer down (Integer n) |
The down function is used to move the editing point down a number of lines specified by the integer n. It
returns the number of lines actually moved. The number returned will be less than n only if the last line
of the buffer has been reached. The editing point will be left at the beginning of the line if it succeeds
in going down more than one line. Example: The function
define trim_buffer
{
bob ();
do
{
eol (); trim ();
}
while (down (1));
}
removes excess whitespace from the end of every line in the buffer.
|
| eob Void eob () |
The eob function is used to move the current point to the end of the buffer. The function eobp may be used to see if the current position is at the end of the buffer |
| eol Void eol() |
Moves the current position to the end of the current line. The function eolp may be used to see if one is at the end of a line or not |
| forward_paragraph Void forward_paragraph () |
This function moves the current editing point forward past the end of the current paragraph. Paragraph delimiters are defined through either a buffer hook or via the hook is_paragraph_separator |
| goto_column Void goto_column (Integer n) |
This function moves the current editing point to the column specified by the parameter n. It will insert a combination of spaces and tabs if necessary to achieve the goal. Note: The actual character number offset from the beginning of the line depends upon tab settings and the visual expansion of other control characters. |
| goto_column_best_try Integer goto_column_best_try (Integer c) |
This function is like goto_column except that it will not insert whitespace. This means that it may fail to achieve the column number specified by the argument c. It returns the current column number |
| goto_line Void goto_line (Integer n) |
The goto_line function may be used to move to a specific line number specified by the parameter n. Note: The actual column that the editing point will be left in is indeterminate. |
| left Integer left (Integer n) |
left moves the editing point backward n characters and returns the number actually moved. The number returned will be less than n only if the top of the buffer is reached. |
| right Integer right (Integer n) |
This function moves the editing position forward forward n characters. It returns the number of characters actually moved. The number returned will be smaller than n if the end of the buffer is reached. |
| skip_chars Void skip_chars (String s) |
This function may be used to move the editing point forward past all characters in string s which contains
the chars to skip, or a range of characters. A character range is denoted by two charcters separated by a
hyphen. If the first character of the string s is a '^' character, then the list of characters actually
denotes the complement of the set of characters to be skipped. To explicitly include the hyphen character
in the list, it must be either the first or the second character of the string, depending upon whether or
not the '^' character is present. So for example,
skip_chars ("- \t0-9ai-o_");
will skip the hyphen, space, tab, numerals 0 to 9, the letter a, the letters i to o, and underscore. An
example which illustrates the complement of a range is
skip_chars("^A-Za-z");
which skips all characters except the letters. Note: The backslash character may be used to escape only the
first character in the string. That is, "\\^" is to be used to skip over ^ characters.
|
| skip_non_word_chars Void skip_non_word_chars () |
This function moves the current editing point forward past all non-word characters until a word character is encountered. Characters that make up a word are set by the define_word function |
| skip_white Void skip_white () |
The skip_white function moves the current point forward until it reaches a non-whitespace character or the end of the current line, whichever happens first. In this context, whitespace is considered to be any combination of space and tab characters. To skip newline characters as well, the function skip_chars may be used. |
| skip_word_chars Void skip_word_chars () |
This function moves the current editing point forward across all characters that constitute a word until a non-word character is encountered. Characters that make up a word are set by the define_word function. |
| up Integer up (Integer n) |
This function moves the current point up n lines and returns the number of lines actually moved. The number returned will be less than n only if the top of the buffer is reached. |
| USE_TABS Int_Type USE_TABS |
If USE_TABS is non-zero, the editor may use tab characters when creating whitespace. If the value of this variable is zero, no tabs will be used. |
| WRAP Int_Type WRAP |
The WRAP variable determines the column number at which wrapping will occur. When entering text, if the current point goes beyond this column, the text will automatically wrap to the next line. This will only happen for those buffers for which the wrap flag is set. |
| WRAP_INDENTS Int_Type WRAP_INDENTS |
If this variable is non-zero, after a line is wrapped, the new line will start at the same indentation as the current one. On the other hand, if the value of WRAP_INDENTS is zero, the new line will begin in the first column. |
| del Void del () |
The del function deletes the character at the current editing position. If the position is at the end of the buffer, nothing happens. If the deletion occurs at the end of a line, the next line will be joined with the current one. |
| del_region Void del_region () |
This function deletes the region defined by the mark and the current editing point. For example,
define delete_this_line ()
{
bol (); push_mark (); eol ();
del_region ();
}
defines a function that deletes all characters on the current line from the beginning of the line until the
end of the line. It does not delete the line itself.
|
| erase_buffer erase_buffer () |
The erase_buffer function erases all text from the current buffer. However, it does not delete the buffer
itself.
Note: This function destroys all undo information associated with the buffer making it impossible to undo the result of this function |
| indent_line Void indent_line () |
The indent_line line function indents the current line in a manner which depends upon the current buffer. The actual function that gets called is set via a prior call the set_buffer_hook to set the indent hook. The default value is to indent the line to the indentation level of the previous line. |
| insbuf Void insbuf (String buf) |
This function may be used to insert the contents of a buffer specified by the name buf into the current buffer. The editing position is advanced to the end of the insertion. |
| insert Void insert (String str) |
Inserts string str into buffer at the current position. The editing point is moved to the end of the of the string that was inserted. |
|
insert_file_region
Integer insert_file_region (String file, String beg, String end) |
This function may be used to insert a region specified by the strings beg and end of the file with name
file into the current buffer. The file is scanned line by line until a line that begins with the string
given by beg is encountered. Then, that line and all successive lines up to the one that starts with the
string specified by end is inserted into the buffer. The line beginning with the value of end is not
inserted although the one beginning with beg is. The function returns the number of lines inserted or -1
upon failure to open the file.
Note that a zero length beg corresponds to the first line and that a zero length end corresponds to the last line. |
| insert_from_kill_array Void insert_from_kill_array (Integer n) |
This function inserts the contents of the nth element, specified by n, of an internal array of character
strings.
Note: This function is not available on 16 bit systems. |
| trim Void trim () |
The trim function removes all whitespace around the current editing point. In this context, whitespace is considered to be any combination of tab and space characters. In particular, it does not include the newline character. This means that the trim function will not delete across lines |
| whitespace whitespace (Integer n) |
The whitespace function inserts white space of length n into the current buffer using a combination of spaces and tabs. The actual combination of spaces and tabs used depends upon the buffer local variable TAB. In particular, if TAB is zero, no tab characters will be used for the expansion. |
| CASE_SEARCH Int_Type CASE_SEARCH |
If the value of CASE_SEARCH is non-zero, text searches will be case-sensitive, otherwise case-insensitive searches will be performed. |
| bfind Integer bfind (String str) |
bfind searches backward from the current position to the beginning of the line for the string str. If a match is found, the length of str is returned and the current point is moved to the start of the match. If no match is found, zero is returned. Note: This function respects the setting of the CASE_SEARCH variable. |
| bfind_char Integer fsearch_char (Integer ch) |
This function searches backward on the current line for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| bol_bsearch Integer bol_bsearch (str) |
bol_bsearch searches backward from the current point until the beginning of the buffer for the occurrences
of the string str at the beginning of a line. If a match is found, the length of str is returned and the
current point is moved to the start of the match. If no match is found, zero is returned.
Note: bol_bsearch is much faster than using re_bsearch to perform a search that matches the beginning of a line. |
| bol_bsearch_char Integer bol_fsearch_char (Integer ch) |
This function searches backward for a character ch at the beginning of a line. If it is found, 1 is returned; otherwise 0 is returned. |
| bol_fsearch Integer bol_fsearch (str) |
bol_fsearch searches forward from the current point until the end of the buffer for occurrences of the string str at the beginning of a line. If a match is found, the length of str is returned and the current point is moved to the start of the match. If no match is found, zero is returned. Note: bol_fsearch is much faster than using re_fsearch to perform a search that matches the beginning of a line. |
| bol_fsearch_char Integer bol_fsearch_char (Integer ch) |
This function searches forward for a character ch at the beginning of a line. If it is found, 1 is returned; otherwise 0 is returned. |
| bsearch Integer bsearch (String str) |
The bsearch function searches backward from the current position for the string str. If str is found, this function will return the length of str and move the current position to the beginning of the matched text. If a match is not found, zero will be returned and the position will not change. It respects the value of the variable CASE_SEARCH. |
| bsearch_char Integer fsearch_char (Integer ch) |
This function searches backward for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| ffind Integer ffind (String s) |
ffind searches forward from the current position to the end of the line for the string str. If a match is found, the length of str is returned and the current point is moved to the start of the match. If no match is found, zero is returned. Note: This function respects the setting of the CASE_SEARCH variable. To perform a search that includes multiple lines, use the fsearch function. |
| ffind_char Integer fsearch_char (Integer ch) |
This function searches forwardward on the current line for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| find_matching_delimiter Integer find_matching_delimiter (Integer ch) |
This function scans either forward or backward looking for the delimiter that matches the character
specified by ch. The actual direction depends upon the syntax of the character ch. The matching delimiter
pair must be declared as such by a prior call to define_syntax. This function returns one of the following
values:
|
| fsearch Integer fsearch (String str) |
This function may be used to search forward in buffer looking for the string str. If not found, this
functions returns zero. However, if found, the length of the string is returned and the current point is
moved to the to the start of the match. It respects the setting of the variable CASE_SEARCH. If the string
that one is searching for is known to be at the beginning of a line, the function bol_fsearch should be
used instead.
Note: This function cannot find a match that crosses lines |
| fsearch_char Integer fsearch_char (Integer ch) |
This function searches forward for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| looking_at Integer looking_at (String s) |
This function returns non-zero if the characters immediately following the current editing point match the string specified by s. Whether the match is case-sensitive or not depends upon the value of the variable CASE_SEARCH. The function returns zero if there is no match. |
| re_bsearch Integer re_bsearch(String pattern) |
Search backward for regular expression pattern. This function returns the 1 + length of the string matched. If no match is found, it returns 0. |
| re_fsearch Integer re_fsearch(String pattern) |
Search forward for regular expression pattern. This function returns the 1 + length of the string matched. If no match is found, it returns 0. |
| regexp_nth_match String regexp_nth_match (Integer n) |
This function returns the nth sub-expression matched by the last regular expression search. If the parameter n is zero, the entire match is returned. Note: The value returned by this function is meaningful only if the editing point has not been moved since the match. |
| replace Void replace(String old, String new) |
This function may be used to replace all occurances of the string old with the string, new, from current editing point to the end of the buffer. The editing point is returned to the initial location. That is, this function does not move the editing point. |
| replace_chars Void replace_chars (Integer n, String new) |
This function may be used to replace the next n characters at the editing position by the string new. After the replacement, the editing point will be moved to the end of the inserted string. The length of the replacement string new is returned. |
| replace_match Integer replace_match(String s, Integer how) |
This function replaces text previously matched with re_fsearch or re_bsearch at the current editing point with string s. If how is zero, s is a specially formatted string of the form described below. If how is non-zero, s is regarded as a simple string and is used literally. If the replacement fails, this function returns zero otherwise, it returns non-zero |
|
search_file
Integer search_file (String filename, String re, Integer nmax) |
This function may be used to search for strings in a disk file matching the regular expression re. The first argument filename specifies which file to search. The last argument nmax specifies how many matches to return. Each line that is matched is pushed onto the S-Lang stack. The number of matches (limited by nmax) is returned. If the file contains no matches, zero is returned. |
| ADD_NEWLINE Int_Type ADD_NEWLINE |
If the value of ADD_NEWLINE is non-zero and the buffer if the buffer does not end with a newline character, a newline character will be silently added to the end of a buffer when the buffer is written out to a file. |
| MAX_HITS Int_Type MAX_HITS |
The value of the MAX_HITS variable specifies how many `hits'' a buffer can take before it is autosaved. A hit is defined as a single key sequence that could modify the buffer. |
| TAB Int_Type TAB |
The TAB variable specifies the tab setting for the current buffer. |
| autosave Void autosave () |
The autosave function saves the current buffer in an auto save file if the buffer has been marked for the auto save operation. |
| autosaveall Void autosaveall () |
This function is like autosave except that it causes all files marked for the auto save operation to be auto-saved. |
| buffer_list Integer buffer_list () |
This function returns an integer indicating the number of buffers and leaves the names of the buffers on
the stack. For example, the following function displays the names of all buffers attached to files:
define show_buffers ()
{
variable b, str = "", file;
loop (buffer_list ())
{
b = ();
setbuf (b);
(file,,,) = getbuf_info ();
if (strlen (file)) str = strcat (str, strcat (" ", b));
}
message (str);
}
|
| buffer_visible Integer buffer_visible (String buf) |
This function is used to determine whether or not a buffer with name specified by the string buf is in a
window or not. More explicitly, it returns the number of windows containing buf. This means that if buf
does not occupy a window, it returns zero. For Example,
define find_buffer_in_window (buf)
{
!if (buffer_visible (buf)) return 0;
pop2buf (buf);
return 1;
}
is a function that moves to the window containing buf if buf is in a window.
|
| bufferp Integer bufferp (String buf) |
This function is used to see if a buffer exists or not. If a buffer with name buf exists, it returns a non-zero value. If it does not exist, it returns zero. |
| bury_buffer Void bury_buffer (String name) |
The bury_buffer function may be used to make it unlikely for the buffer specified by the paramter name to appear in a window. |
| check_buffers check_buffers () |
The check_buffers function checks to see whether or not any of the disk files that are associated with the editor's buffers have been modified since the assocation was made. The buffer flags are updated accordingly. |
| delbuf Void delbuf (String buf) |
delbuf may be used to delete a buffer with the name specified by buf. If the buffer does not exist, a S-Lang error will be generated. |
| getbuf_info getbuf_info () |
This function returns values to the stack. The four values from the top are:
(file,,,flags) = getbuf_info();
returns the file and the flags associated with the current buffer.
|
| pop2buf Void pop2buf (String buf) |
The pop2buf function will switch to another window and display the buffer specified by buf in it. If buf does not exist, it will be created. If buf already exists in a window, the window containing buf will become the active one. This function will create a new window if necessary. All that is guaranteed is that the current window will continue to display the same buffer before and after the call to pop2buf. |
| pop2buf_whatbuf String pop2buf_whatbuf (String buf) |
This function performs the same function as pop2buf except that the name of the buffer that buf replaced in the window is returned. This allows one to restore the buffer in window to what it was before the call to pop2buf_whatbuf. |
| set_buffer_hook Void set_buffer_hook (String hook, String f) |
Set current buffer hook hook to function f. f is a user defined S-Lang function. Currently, hook can be any
one of:
|
| set_buffer_umask Integer set_buffer_umask (Integer cmask) |
The function may be used to set the process file creation mask for the appropriate operations associated with the current buffer. This makes it possible to have a buffer-dependent umask setting. The function takes the desired umask setting and returns the previous setting. If cmask is zero, the default process umask setting will be used for operations while the buffer is current. If cmask is -1, the umask associated with the buffer will not be changed. |
| set_mode Void set_mode(String mode, Integer flags) |
This function sets buffer mode flags and status line mode name. mode is a string which is displayed on the
status line if the %m status line format specifier is used. The second argument, flags is an integer with
the possible values:
|
| setbuf Void setbuf(String buf) |
Changes the default buffer to one named buf. If the buffer does not exist, it will be created. Note: This change only lasts until top level of editor loop is reached at which point the the buffer associated with current window will be made the default. That is this change should only be considered as temporary. To make a long lasting change, use the function sw2buf. |
| setbuf_info
Void setbuf_info(String file, String dir, String buf, Integer flags) |
This function may be used to change attributes regarding the current buffer. It performs the opposite
function of the related function getbuf_info. Here file is the name of the file to be associated with the
buffer; dir is the directory to be associated with the buffer; buf is the name to be assigned to the
buffer, and flags describe the buffer attributes. See getbuf_info for a discussion of flags. Note that the
actual file associated with the buffer is located in directory dir with the name file. For example, the
function
define set_overwrite_mode ()
{
variable dir, file, flags, name;
(file, dir, name, flags) = getbuf_info ();
flags = flags | (1 shl 4);
setbuf_info (file, dir, name, flags);
}
may be used to turn on overwrite mode for the current buffer. Note that it is better exploit the fact that
S-Lang is a stack based language and simply write the above function as:
define set_overwrite_mode ()
{
setbuf_info (getbuf_info () | 0x10);
}
Here, (1 shl 4) has been written as the hexidecimal number 0x10.
|
| sw2buf Void sw2buf (String buf) |
This function is used to switch to another buffer whose name is specified by the parameter buf. If the buffer specified by buf does not exist, one will be created. Note: Unlike setbuf, the change to the new buffer is more permanent in the sense that when control passed back out of S-Lang to the main editor loop, if the current buffer at that time is the buffer specified here, this buffer will be attached to the window. |
| what_mode (String name, Integer flags) = Integer what_mode () |
This function may be used to obtain the mode flags and mode name of the current buffer. See set_mode for more details. |
| whatbuf String what_buffer() |
whatbuf returns the name of the current buffer. It is usually used in functions when one wants to work with more than one buffer. The function setbuf_info may be used to change the name of the buffer. |
| write_buffer Integer write_buffer (String filename) |
This function may be used to write the current buffer out to a file specified by filename. The buffer will then become associated with that file. The number of lines written to the file is returned. An error condition will be signaled upon error. |
| abbrev_table_p Integer abbrev_table_p (String name) |
Returns non-zero if an abbreviation table with called name exists. If the table does not exist, it returns zero. |
| create_abbrev_table Void create_abbrev_table (String name, String word) |
Create an abbreviation table with name name. The second parameter word is the list of characters used to represent a word for the table. If the empty string is passed for word, the characters that currently constitute a word are used. |
| define_abbrev Void define_abbrev (String tbl, String abbrv, String expans) |
This function is used to define an abbreviation abbrv that will be expanded to expans. The definition will be placed in the table with name tbl. |
| delete_abbrev_table Void delete_abbrev_table (String name) |
Delete the abbrev table specified by name. |
| dump_abbrev_table Void dump_abbrev_table (String name) |
This function inserts the contents of the abbreviation table called name into the current buffer. |
| list_abbrev_tables Integer list_abbrev_tables () |
This function returns the names of all currently defined abbreviation tables. The top item on the stack will be the number of tables followed by the names of the tables. |
| use_abbrev_table Void use_abbrev_table (String table) |
Use the abbreviation table named table as the abbreviation table for the current buffer. By default, the "Global" table is used. |
| what_abbrev_table (String, String) what_abbrev_table () |
This functions returns both the name of the abbreviation table and the definition of the word for the table currently associated with the current buffer. If none is defined it returns two empty strings. |
| create_blocal_var Void create_blocal_var (String name) |
This function is used to create a buffer local variable named name. A buffer local variable is a variable whose value is local to the current buffer. |
| get_blocal_var get_blocal_var (String name) |
This function returns the value of the buffer local variable specified by name. |
| set_blocal_var Void set_blocal_var (val, String v) |
This function sets the value of the buffer local variable with name v to value val. The buffer local variable specified by v must have been previously created by the create_blocal_var function. val must have the type that was declared when create_blocal_var was called. |
| color_number Integer color_number (String obj) |
This function returns the object number associated with the string obj. Valid names for obj are as per set_color. |
| set_color set_color (String_Type obj, String_Type fg, String_Type bg) |
This function sets the foreground and background colors of an object specified by the string obj to fg and
bg. The exact values of the strings fg and bg are system dependent. For the X-Window system, they can be
any string that the server understands, e.g., "SteelBlue". For other systems, the color must be one of the
following:
"black" "gray"
"red" "brightred"
"green" "brightgreen"
"brown" "yellow"
"blue" "brightblue"
"magenta" "brightmagenta"
"cyan" "brightcyan"
"lightgray" "white"
On most terminals, the values in the second column have no affect when used as the background color.
The valid names for obj are:
"normal" Default foreground/background
"status" The status window line
"region" Highlighted Regions
"cursor" Text Cursor (X-Windows)
"menu" The menu bar
"error" Error messages
"message" Other messages
"dollar" Color of the indicator that text extends
beyond the boundary of the window.
If color syntax highlighting is enabled, the following object names are also meaningful:
"number" Numbers in C-mode and Equations in TeX-mode
"delimiter" Commas, semi-colons, etc...
"keyword" Language dependent
"string" Literal strings
"comment" Comments
"operator" Such as +, -, etc...
"preprocess" Preprocessor lines
If line attributes are available, then you may also specifiy the color of the hidden line indicator:
"..." Hidden line indicator
The color of the menu objects may be specified via
"menu_char" Menu item key-shortcut color
"menu_shadow" Color of the shadow
"menu_selection" Selected menu-item color
"menu_popup" Color of the popup box
|
| set_color_esc Void set_color_esc (String object, String esc_seq) |
This function may be used to associate an escape sequence with an object. The escape sequence will be sent to the terminal prior to sending updating the object. It may be used on mono terminals to underline objects, etc... The object names are the same names used by the set_color function. Note: Care should be exercised when using this function. Also, one may need to experiment around a little to get escape sequences that work together. |
| set_color_object Void set_color_object (Integer obj, String fg, String bg) |
Associate colors fg and bg with object obj. Valid values for obj are in the range 30 to 128. All other values are reserved. Values for the strings fg and bg are as given by the description for set_color. |
| set_column_colors Void set_column_colors (Integer color, Integer c0, Integer c1) |
This function associates a color with columns c0 through c1 in the current buffer. That is, if there is no syntax highlighting already defined for the current buffer, when the current buffer is displayed, columns c0 through c1 will be displayed with the attributes of the color object. The parameters c0 and c1 are restricted to the range 1 through SCREEN_WIDTH. Use the function set_color_object to assign attributes to the color object. |
| _autoload Void _autoload (String fun, String fn, ..., Integer n) |
The _autoload function is like the autoload function except that it takes n pairs of function name (fun) /
filename (fn) pairs. For example,
_autoload ("fun_a", "file_a", "fun_b", "file_b", 2);
is equivalent to
autoload ("fun_a", "file_a");
autoload ("fun_b", "file_b");
|
| evalbuffer Void evalbuffer () |
This function causes the current buffer to be sent to the S-Lang interpreter for evaluation. If an error is encountered while parsing the buffer, the cursor will be placed at the location of the error. |
| get_jed_library_path String get_jed_library_path () |
This function returns the current search path for jed library files. The path may be set using the function set_jed_library_path. |
| set_jed_library_path Void set_jed_library_path (String p) |
This function may be used to set the search path for library files. Its parameter p may be a comma separated list of directories to search. When the editor is first started, the path is initialized from the JED_ROOT, or JED_LIBRARY environment variables. |
| BACKUP_BY_COPYING Int_Type BACKUP_BY_COPYING |
If non-zero, backup files will be made by copying the original file to the backup file. If zero, the backup file will be created by renaming the original file to the backup file. The default for BACKUP_BY_COPYING is zero because it is fastest. |
| IsHPFSFileSystem Integer IsHPFSFileSystem(String path) |
Returns non-zero if drive of path (possibly the default drive) is HPFS. |
| change_default_dir Integer change_default_dir (String new_dir) |
This function may be used to change the current working directory of the editor to new_dir. It returns zero upon success or -1 upon failure. Note: Each buffer has its own working directory. This function does not change the working directory of the buffer. Rather, it changes the working directory of the whole editor. This has an effect on functions such as rename_file when such functions are passed relative filenames. |
| copy_file Integer copy_file (String src, String dest) |
This function may be used to copy a file named src to a new file named dest. It attempts to preserve the
file access and modification times as well as the ownership and protection.
It returns 0 upon success and -1 upon failure. |
| delete_file Integer delete_file (String file) |
This function may be used to delete a file specified by the file parameter. It returns non-zero if the file was sucessfully deleted or zero otherwise. |
| expand_filename String expand_filename (String file) |
The expand_filename function expands a file to a canonical form. For example, under Unix, if file has the value "/a/b/../c/d", it returns "/a/c/d". Similarly, if file has the value "/a/b/c//d/e", "/d/e" is returned. |
| extract_filename String extract_filename (String filespec) |
This function may be used to separate the file name from the path of of a file specified by filespec. For
example, under Unix, the expression
extract_filename ("/tmp/name");
returns the string "name".
|
| file_changed_on_disk Integer file_changed_on_disk (String fn) |
This function may be used to determine if the disk file specified by the parameter fn is more recent than the current buffer. |
| file_status Integer file_changed_on_disk (String fn) |
This function may be used to determine if the disk file specified by the parameter fn is more recent than the current buffer. |
| file_status Integer file_status (String filename) |
The file_status function returns information about a file specified by the name filename. It returns an integer describing the file type: 2 file is a directory 1 file exists and is not a directory 0 file does not exist. -1 no access. -2 path invalid -3 unknown error |
| file_time_compare Integer file_time_cmp (String file1, String file2) |
This function compares the modification times of two files, file1 and file2. It returns an integer that is either positive, negative, or zero integer for file1 > file2, file1 < file2, or file1 == file2, respectively. In this context, the comparison operators are comparing file modification times. That is, the operator > should be read `is more recent than''. The convention adopted by this routine is that if a file does not exist, its modification time is taken to be at the beginning of time. Thus, if f exists, but g does not, the file_time_compare (f, g) will return a positive number. |
| find_file Integer find_file (String name) |
The find_file function switches to the buffer associated with the file specified by name. If no such buffer exists, one is created and the file specified by name is read from the disk and associated with the new buffer. The buffer will also become attached to the current window. Use the read_file function to find a file but not associate it with the current window. |
| insert_file Integer insert_file (String f) |
This function may be used to insert the contents of a file named f into the buffer at the current position. The current editing point will be placed at the end of the inserted text. The function returns -1 if the file was unable to be opened; otherwise it returns the number of lines inserted. This number can be zero if the file is empty. |
| read_file Integer read_file (string fn) |
The read_file function may be used to read a file specified by fn into its own buffer. It returns a non-zero value upon success and signals an error upon failure. The hook find_file_hook is called after the file is read in. Unlike the related function, find_file, this function does not create a window for the newly created buffer. |
| rename_file Integer rename_file (String old_name, String new_name) |
This function may be used to change the name of a disk file from old_name to new_name. Upon success, zero is returned. Any other value indicates failure. Note: Both filenames must refer to the same file system. |
| set_file_translation set_file_translation (Integer n) |
This function affects only the way the next file is opened. Its affect does not last beyond that. If it the value of the parameter is 1, the next file will be opened in binary mode. If the parameter is zero, the file will be opened in text mode. |
| is_line_hidden Integer is_line_hidden () |
This function returns a non-zero value if the current line is hidden. It will return zero if the current line is visible. |
| set_line_hidden Void set_line_hidden (Integer flag) |
If the parameter flag is non-zero, the current line will be given the hidden attribute. This means that it will not be displayed. If the parameter is zero, the hidden attribute will be turned off. |
| set_region_hidden Void set_region_hidden (Integer flag) |
This function may be used to hide the lines in a region. If flag is non-zero, all lines in the region will be hidden. If it is zero, the lines in the region will be made visible. |
| skip_hidden_lines_backward Void skip_hidden_lines_backward (Integer type) |
This function may be used to move backward across either hidden or non-hidden lines depending upon whether
the parameter type is non-zero or zero. If type is non-zero, the Point is moved backward across hidden
lines until a visible line is reached. If type is zero, visible lines will be skipped instead. If the top
of the buffer is reached before the appropriate line is reached, the Point will be left there.
Note: The functions up and down are insensitive to whether or not a line is hidden. |
| skip_hidden_lines_forward
Void skip_hidden_lines_forward (Integer type) |
This function may be used to move forward across either hidden or non-hidden lines depending upon whether
the parameter type is non-zero or zero. If type is non-zero, the Point is moved forward across hidden lines
until a visible line is reached. If type is zero, visible lines will be skipped instead. If the end of the
buffer is reached before the appropriate line is reached, the Point will be left there.
Note: The functions up and down are insensitive to whether or not a line is hidden. |
| bobp Integer bobp () |
The bobp function is used to determine if the current position is at the beginning of the buffer or not. If
so, it returns a non-zero value. However, if it is not, it returns zero. This simple example,
define is_buffer_empty ()
{
return bobp () and eobp ();
}
returns non-zero if the buffer is empty; otherwise, it returns zero.
|
| bolp Integer bolp () |
bolp is used to test if the current position is at the beginning of a line or not. It returns non-zero if the position is at the beginning of a line or zero if not. |
| count_chars String count_chars () |
This function returns information about the size of the current buffer and current position in the buffer.
The string returned is of the form:
'h'=104/0x68/0150, point 90876 of 127057
|
| eobp Integer eobp () |
The functio eobp is used to determine if the current position is at the end of the buffer or not. It returns a non-zero value if at the end of the buffer or zero if not. |
| eolp Integer eolp () |
This function may be used to determine whether or not the current position is at the end of a line ot not. If it is, the routine returns a non-zero value; otherwise it returns zero. |
| get_word_chars String_Type get_word_chars () |
The get_word_chars returns the currently defined set of characters that constitute a word. The set may be returned as a character range. |
| what_char Integer what_char () |
The what_char function returns the value of the character at the current position as an integer in the
range 0 to 256. This simple example,
while (not (eolp ()))
{
if (what_char () == '_')
{
del (); insert ("\\_");
}
}
has the effect of replacing all underscore characters on the current line with a backslash-underscore
combination.
|
| what_column
Integer what_column () |
The what_column function returns the current column number expanding tabs, control characters, etc... The beginning of the line is at column number one. |
| what_line
Int_Type what_line |
The value of the what_line specifies the current line number. Lines are numbered from one.
This is a read-only variable. The actual number is measured from the top of the buffer which itself is affected by whether the buffer is narrowed or not. For example,
define one ()
{
push_mark (); narrow ();
return what_line;
}
always returns 1.
|
| ALT_CHAR Int_Type ALT_CHAR |
If this variable is non-zero, characters pressed in combination the Alt key will generate a two character sequence: the first character is the value of ALT_CHAR itself followed by the character pressed. For example, if Alt-X is pressed and ALT_CHAR has a value of 27, the characters ESC X will be generated. |
| CURRENT_KBD_COMMAND String_Type CURRENT_KBD_COMMAND |
The value of the CURRENT_KBD_COMMAND function represents the name of the currently executing procedure bound to the currently executing key sequence. |
| DEC_8BIT_HACK Int_Type DEC_8BIT_HACK |
If set to a non-zero value, a input character between 128 and 160 will be converted into a two character sequence: ESC and the character itself stripped of the high bit + 64. The motivation behind this variable is to enable the editor to work with VTxxx terminals that are in eight bit mode. |
| DEFINING_MACRO Int_Type DEFINING_MACRO |
The DEFINING_MACRO variable will be non-zero is a keyboard macro definition is in progress. |
| EXECUTING_MACRO Int_Type EXECUTING_MACRO |
The EXECUTING_MACRO variable will be non-zero is a keyboard macro is currently being executed. |
| FN_CHAR Int_Type FN_CHAR |
If this variable is non-zero, function keys presses will generate a two character sequence: the first character is the value of the FN_CHAR itself followed by the character pressed. |
| IGNORE_USER_ABORT Int_Type IGNORE_USER_ABORT |
If set to a non-zero value, the keyboard interrupt character, e.g., Ctrl-G will not trigger a S-Lang error. When JED starts up, this value is set to 1 so that the user cannot interrupt the loading of site.sl. Later, it is set to 0. |
| KILL_LINE_FEATURE Int_Type KILL_LINE_FEATURE |
If non-zero, kill_line will kill through end of line character if the cursor is at the beginning of a line. Otherwise, it will kill only to the end of the line. |
| LASTKEY String_Type LASTKEY |
The value of the LASTKEY variable represents the currently executing key sequence. |
| LAST_CHAR Int_Type LAST_CHAR |
The value of LAST_CHAR will be the last character read from the keyboard buffer. |
| LAST_KEY String_Type LAST_KEY |
The LASTKEY variable contains the most recently entered keyboard sequence. |
| META_CHAR Int_Type META_CHAR |
This variable determines how input characters with the high bit set are to be treated. If META_CHAR is less than zero, the character is passed through un-processed. However, if META_CHAR is greater than or equal to zero, an input character with the high bit set is mapped to a two character sequence. The first character of the sequence is the character whose ascii value is META_CHAR and the second character is the input with its high bit stripped off. |
| X_LAST_KEYSYM Int_Type X_LAST_KEYSYM |
The value of the X_LAST_KEYSYM variable represents the keysym of the most previously processed key. |
| buffer_keystring Void buffer_keystring (String str) |
Append string str to the end of the input stream to be read by JED's getkey routines. |
| definekey Void definekey(String f, String key, String kmap) |
Unlike setkey which operates on the global keymap, this function is used for binding keys to functions in a specific keymap. Here f is the function to be bound, key is a string of characters that make up the key sequence and kmap is the name of the keymap to be used. See setkey for more information about the arguments. |
| dump_bindings Void dump_bindings(String map) |
This functions inserts a formatted list of keybindings for the keymap specified by map into the buffer at the current point. |
| enable_flow_control Void enable_flow_control (Integer flag) |
This Unix specific function may be used to turn XON/XOFF flow control on or off. If flag is non-zero, flow control is turned on; otherwise, it is turned off. |
| flush_input Void flush_input () |
This function may be used to remove all forms of queued input. |
| get_key_function String get_key_function () |
The get_key_function waits for a key to be pressed and returns a string that represents the binding of the key. If the key has no binding the empty string is returned. Otherwise, it also returns an integer that describes whether or not the function is an internal one. If the function is internal, 1 will be returned; otherwise zero will be returned to indicate that the binding is either to an S-Lang function or a macro. If it is a macro, the first character of the of returned string will be the @ character. |
| getkey Integer getkey () |
The getkey function may be used to read an input character from the keyboard. It returns an integer in the range 0 to 256 which represents the ASCII or extended ASCII value of the character. |
| input_pending Integer input_pending (Integer tsecs) |
This function is used to see if keyboard input is available to be read or not. The paramter tsecs is the
amount of time to wait for input before returning if input is not available. The time unit for tsecs is
one-tenth of a second. That is, to wait up to one second, pass a value of ten to this routine. It returns
zero if no input is available, otherwise it returns non-zero. As an example,
define peek_key ()
{
variable ch;
!if (input_pending (0)) return -1;
ch = getkey ();
ungetkey (ch);
return ch;
}
returns the value of the next character to be read if one is available; otherwise, it returns -1.
|
| keymap_p Integer keymap_p (String kmap) |
The keymap_p function may be used to determine whether or not a keymap with name kmap exists. If the keymap specified by kmap exists, the function returns non-zero. It returns zero if the keymap does not exist. |
| make_keymap Void make_keymap (String km) |
The make_keymap function creates a keymap with a name specified by the km parameter. The new keymap is an exact copy of the pre-defined "global" keymap. |
| map_input Void map_input (Integer x, Integer y) |
The map_input function may be used to remap an input character with ascii value x from the keyboard to a
different character with ascii value y. This mapping can be quite useful because it takes place before the
editor interprets the character. One simply use of this function is to swap the backspace and delete
characters. Since the backspace character has an ascii value of 8 and the delete character has ascii value
127, the statement
map_input (8, 127);
maps the backspace character to a delete character and
map_input (127, 8);
maps the delete character to a backspace character. Used together, these two statement effectively swap the
delete and backspace keys.
|
| prefix_argument Integer prefix_argument (Integer dflt) |
This function may be used to determine whether or not the user has entered a prefix argument from the
keyboard. If a prefix argument is present, its value is returned; otherwise, dflt is returned. Calling this
function cancels the prefix argument. For example,
variable arg = prefix_argument (-9999);
if (arg == -9999)
message ("No Prefix Argument");
else
message (Sprintf ("Prefix argument: %d", arg, 1));
displays the prefix argument in the message area.
Note: This function is incapable of distinguishing between the case of no prefix argument and when the argument's value is dflt. Currently, this is not a problem because the editor does not allow negative prefix arguments. |
| set_abort_char Void set_abort_char (Integer ch) |
This function may be used to change the keyboard character that generates an S-Lang interrupt. The parameter ch is the ASCII value of the character that will become the new abort character. The default abort character Ctrl-G corresponds to ch=7. |
| set_prefix_argument Void set_prefix_argument (Int_Type n) |
This function may be used to set the prefix argument to the value specified by n. If n is less than zero, then the prefix argument is cancelled. |
| setkey Void setkey(String fun, String key) |
This function may be used to define a key sequence specified by the string key to the function fun. key can
contain the ^ character which denotes that the following character is to be interpreted as a control
character, e.g.,
setkey("bob", "^Kt");
sets the key sequence Ctrl-K t to the function bob.
The fun argument is usually the name of an internal or a user defined S-Lang function. However, if may also be a sequence of functions or even another keysequence (a keyboard macro). For example,
setkey ("bol;insert(string(whatline()))", "^Kw");
assigns the key sequence Ctrl-K w to move to the beginning of a line and insert the current line number.
For more information about this important function, see the JED User Manual.
Note that setkey works on the "global" keymap. |
| undefinekey Void undefinekey (String key, String kmap) |
This function may be used to remove a keybinding from a specified keymap. The key sequence is given by the parameter key and the keymap is specified by the second parameter kmap. |
| ungetkey Void ungetkey (Integer ch) |
This function may be used to push a character ch represented by its ASCII value, onto the input stream. This means that the next keyboard to be read will be ch. |
| unsetkey Void unsetkey(String key) |
This function is used to remove the definition of the key sequence key from the "global" keymap. This is sometimes necessary to bind new key sequences which conflict with other ones. For example, the "global" keymap binds the keys "^[[A", "^[[B", "^[[C", and "^[[D" to the character movement functions. Using unsetkey("^[[A") will remove the binding of "^[[A" from the global keymap but the other three will remain. However, unsetkey("^[[") will remove the definition of all the above keys. This might be necessary to bind, say, "^[[" to some function. |
| use_keymap Void use_keymap (String km) |
This function may be used to dictate which keymap will be used by the current buffer. km is a string value that corresponds to the name of a keymap. |
| what_keymap
String what_keymap () |
This function returns the name of the keymap associated with the current buffer. |
| which_key Integer which_key (String f) |
The which_key function returns the the number of keys that are bound to the function f in the current
keymap. It also returns that number of key sequences with control characters expanded as the two character
sequence ^ and the the whose ascii value is the control character + 64. For example,
define insert_key_bindings (f)
{
variable n, key;
n = which_key (f);
loop (n)
{
str = ();
insert (str);
insert ("\n");
}
}
inserts into the buffer all the key sequences that are bound to the function f.
|
| create_line_mark User_Mark create_line_mark (Integer c) |
The function create_line_mark returns an object of the type User_Mark. This object contains information regarding the current position and current buffer. The parameter c is used to specify the color to use when the line is displayed. |
| create_user_mark User_Mark create_user_mark () |
The function create_user_mark returns an object of the type User_Mark. This object contains information regarding the current position and current buffer. |
| dupmark Integer dupmark () |
This function returns zero if the mark is not set or, if the mark is set, a duplicate of it is pushed onto the mark stack and a non-zero value is returned. |
| goto_user_mark Void goto_user_mark (User_Mark mark) |
This function returns to the position of the User Mark mark. Before this function may be called, the current buffer must be the buffer associated with the mark. |
| is_user_mark_in_narrow Integer is_user_mark_in_narrow (User_Mark m) |
This function returns non-zero if the user mark m refers to a position that is within the current narrow restriction of the current buffer. It returns zero if the mark lies outside the restriction. An error will be generated if m does not represent a mark for the current buffer. |
| is_visible_mark is_visible_mark () |
This function may be used to test whether or not the mark is a visible mark. A visible mar is one which causes the region defined by it to be highlighted. It returns 1 is the mark is visible, or 0 if the mark is not visible or does not exist. |
| markp Void markp () |
This function returns a non-zero value if the mark is set; otherwise, it returns zero. If a mark is set, a region is defined. |
| move_user_mark Void move_user_mark (User_Mark mark) |
This function call takes a previously created User Mark, mark, and moves it to the current position and
buffer. This means that if one subsequently calls goto_user_mark with this mark as an argument, the the
position will be set to what it is prior to the call to move_user_mark. Note: This function call is not
equivalent to simply using
mark = create_user_mark ();
because independent copies of a User Mark are not created uponn assignment. That is, if one has
variable mark1, mark2;
setbuf ("first");
mark1 = create_user_mark ();
mark2 = mark1;
setbuf ("second");
and then calls
move_user_mark (mark1);
both user marks, mark1 and mark2 will be moved since they refer to the same mark.
|
| pop_mark pop_mark (Integer g) |
pop_mark pops the most recent mark pushed onto the mark stack. If the argument g is non-zero, the editing position will be moved to the location of the mark. However, if g is zero, the editing position will be unchanged. |
| pop_spot Void pop_spot () |
This function is used after a call to push_spot to return to the editing position at the last call to push_spot in the current buffer. |
| push_mark Void push_mark() |
This function marks the current position as the beginning of a region. and pushes other marks onto a stack.
A region is defined by this mark and the editing point. The mark is removed from the stack only when the
function pop_mark is called. For example,
define mark_buffer ()
{
bob ();
push_mark ();
eob ();
}
marks the entire buffer as a region.
|
| push_spot Void push_spot () |
push_spot pushes the location of the current buffer location onto a stack. This function does not set the mark. The function push_mark should be used for that purpose. The spot can be returned to using the function pop_spot. Note: Spots are local to each buffer. It is not possible to call push_spot from one buffer and then subsequently call pop_spot from another buffer to return to the position in the first buffer. For this purpose, one must use user marks instead. |
| user_mark_buffer String user_mark_buffer (User_Mark m) |
This function returns the name of the buffer associated with the User Mark specified by m. |
| enable_top_status_line Void enable_top_status_line (Integer x) |
If x is non-zero, the top status line is enabled. If x is zero, the top status line is disabled and hidden. |
|
menu_append_item
menu_append_item (menu, name, fun [,client_data]) String_Type menu, name; String_Type or Ref_Type fun; Any_Type client_data |
The menu_append_item function appends a menu item called name to the menu menu. If called with 3 arguments,
the third argument must be a string that will get executed or called when the menu item is selected.
When called with 4 arguments, the fun argument may be either a string or a reference to a function. When the item is selected, the function will be called and client_data will be passed to it. |
| menu_append_popup menu_append_popup (String_Type parent_menu, String_Type popup_name |
The menu_append_popup function may be used to append a new popup menu with name popup_name to the menu parent_menu, which may either be another popup menu or a menu bar. |
| menu_append_separator menu_append_separator (String_Type menu) |
The menu_append_separator function appends a menu item separator to the menu menu. |
| menu_copy_menu menu_copy_menu (String_Type dest, String_Type src) |
Then menu_copy_menu function copies the menu item, which may be another popup menu, to another popup menu. |
| menu_create_menu_bar menu_create_menu_bar (String_Type name) |
The menu_create_menu_bar function may be used to create a new menu bar called name. The new menu bar may be associated with a buffer via the menu_use_menu_bar function. |
| menu_delete_item menu_delete_item (String_Type name) |
The menu_delete_item function deletes the menu called name and all of its submenus. |
| menu_delete_items menu_delete_items (String_Type menu) |
The menu_delete_items function deletes all the menu items attached to a specified popup menu. However, unlike the related function menu_delete_item, the popup menu itself will not be removed. |
| menu_set_init_menubar _callback menu_set_init_menubar_callback (Ref_Type cb) |
The menu_set_init_menubar_callback may be used to specify the function that is to be called whenever a menu bar may need to be updated. This may be necessary when the user switches buffers or modes. The callback function must accept a single argument which is the name of the menubar. |
|
menu_set_menu_bar_prefix
enu_set_menu_bar_prefix (String_Type menubar, String_Type prefix) |
The menu_set_menu_bar_prefix specifies the string that is to be displayed on the specified menu bar. The default prefix is "F10 key ==> ". |
| menu_set_object_available
menu_set_object_available (String_Type menuitem, Int_Type flag) |
The menu_set_object_available function may be used to activate or inactivate the specified menu item, depending upon whether flag is non-zero or zero, respectively. |
|
menu_set_select_menubar _callback
menu_set_select_menubar_callback (String_Type menubar, Ref_Type f) |
The menu_set_select_menubar_callback function is used to indicate that the function whose reference is f should be called whenever the menu bar is selected. The callback function is called with one argument: the name of the menu bar. |
|
menu_set_select_popup _callback
menu_set_select_popup_callback (String_Type popup, Ref_Type f |
The menu_set_select_popup_callback function may be used to specify a function that should be called just
before a popup menu is displayed. The callback function must be defined to take a single argument, namely
the name of the popup menu.
The basic purpose of this function is to allow the creation of a dynamic popup menu. For this reason, the popup menu will have its items deleted before the callback function is executed. |
| menu_use_menu_bar menu_use_menu_bar (String_Type menubar) |
The menu_use_menu_bar function may be used to associate a specified menu bar with the current buffer. If no menu bar has been associated with a buffer, the "Global" menu bar will be used. |
| set_top_status_line String set_top_status_line (String str) |
This functions sets the string to be displayed at the top of the display. It returns the value of the line that was previously displayed. |
| MESSAGE_BUFFER String_Type MESSAGE_BUFFER |
The MESSAGE_BUFFER variable is a read-only string variable whose value indicates the text to be displayed or is currently displayed in the message buffer. |
| beep void beep () |
The beep function causes the terminal to beep according to the value of the variable IGNORE_BEEP. |
| clear_message Void clear_message () |
This function may be used to clear the message line of the display. |
| flush Void flush (String msg) |
The flush function behaves like message except that it immediately displays its argument msg as a message in the mini-buffer. That is, it is not necessary to call update to see the message appear. |
| tt_send Void tt_send (String s) |
This function may be used to send a string specified by s directly to the terminal with no interference by
the editor. One should exercise caution when using this routine since it may interfere with JED's screen
management routines forcing one to redraw the screen. Nevertheless, it can serve a useful purpose. For
example, when run in an XTerm window, using
tt_send ("\e[?9h");
will enable sending mouse click information to JED encoded as keypresses.
|
| MINIBUFFER_ACTIVE Int_Type MINIBUFFER_ACTIVE |
The MINIBUFFER_ACTIVE variable will be non-zero if the mini-buffer is in use. |
| _add_completion Void _add_completion (String f1, String f2, ..., Integer n) |
The _add_completion function is like the add_completion function except that it takes n names f1, ... fn.
For example,
_add_completion ("fun_a", "fun_b", 2);
is equivalent to
add_completion ("fun_a");
add_completion ("fun_b");
|
| add_completion Void add_completion(String f) |
The add_completion function adds the user defined S-Lang function with name specified by the string f to the list of functions that are eligible for mini-buffer completion. The function specified by f must be already defined before this function is called. The S-Lang function is_defined may be used to test whether or not the function is defined. |
| get_mini_response Int_Type get_mini_response (String_Type str) |
The get_mini_response function display the text str at the bottom of the screen and waits for the user to press a key. The key is returned. |
| get_y_or_n Int_Type get_y_or_n (String_Type str) |
The get_y_or_n function forms a y/n question by concatenating "? (y/n)" to str and displays the result at the bottom of the display. It returns 1 if the user responds with y, 0 with n, or -1 if the user cancelled the prompt. |
| get_yes_no Integer get_yes_no (String s) |
This function may be used to get a yes or no response from the user. The string parameter s will be used to construct the prompt by concating the string "? (yes/no)" to s. It returns 1 if the answer is yes or 0 if the answer is no. |
| read_mini String read_mini (String prompt, String dflt, String init) |
The read_mini function reads a line of input from the user in the mini-buffer. The first parameter, prompt,
is used to prompt the user. The second parameter, dflt, is what is returned as a default value if the user
simply presses the return key. The final parameter, init, is stuffed into the mini-buffer for editing by
the user. For example,
define search_whole_buffer ()
{
variable str;
str = read_mini ("Search for:", "", "");
!if (strlen (str)) return;
!if (fsearch (str))
{
push_mark (); bob ();
if (fsearch (str))
pop_mark (0);
else pop_mark (1);
{
pop_mark (1);
error ("Not found");
}
}
}
reads a string from the user and then searches forward for it and if not found, it resumes the search from
the beginning of the buffer. Note: If the user aborts the function mini_read by pressing the keyboard quit
character (e.g., Ctrl-G), an error is signaled. This error can be caught by an ERROR_BLOCK and the
appropriate action taken. Also if the mini-buffer is already in use, this function should not be called.
The variable MINIBUFFER_ACTIVE may be checked to determine if this is the case or not.
|
|
read_with_completion
Void read_with_completion (String prt, String dflt, String s, Integer type) |
This function may be used to read one of the objects specified by the last parameter type. The first
parameter, prt, is used as a prompt, the second parameter, dflt, is used to specify a default, and the
third parameter, s, is used to initialize the string to be read. type is an integer with the following
meanings:
'f' file name
'b' buffer name
'F' function name
'V' variable name
Finally, if type has the value 's', then the set of completions will be defined by a zeroth parameter,
list, to the function call. This parameter is simple a comma separated list of completions. For example,
read_with_completion ("Larry,Curly,Moe", \
"Favorite Stooge:", "Larry", "", 's');
provides completion over the set of three stooges. The function returns the string read.
|
| set_expansion_hook Void set_expansion_hook (String fname) |
This function may be used to specify a function that will be called to expand a filename upon TAB completion. The function fname must already be defined. When fname is called, it is given a string to be expanded. If it changes the string, it must return a non-zero value and the modified string. If the string is not modified, it must simply return zero. |
| gpm_disable_mouse gpm_disable_mouse () |
The gpm_disable_mouse function may be used to inactivate support for the GPM mouse. |
| mouse_get_event_info () (x, y, state) = mouse_get_event_info () |
This function returns the position of the last processed mouse event, and the state of the mouse buttons
and shift keys before the event.
x and y represent the column and row, respectively, where the event took place. They are measured with relative to the top left corner of the editor's display. state is a bitmapped integer whose bits are defined as follows:
1 Left button pressed
2 Middle button pressed
4 Right button pressed
8 Shift key pressed
16 Ctrl key pressed
Other information such as the button that triggered the event is available when the mouse handler is
called. As a result, this information is not returned by mouse_get_event_info.
|
| mouse_map_buttons Void mouse_map_buttons (Integer x, Integer y) |
This function may be used to map one mouse button to another. The button represented by x will appear as y. |
| mouse_set_current_window Void mouse_set_current_window () |
Use of this function results in changing windows to the window that was current at the time of the mouse event. |
| mouse_set_default_hook
Void set_default_mouse_hook (String name, String fun) |
This function associates a slang function fun with the mouse event specified by name. The first parameter
name must be one of the following:
"mouse_up" "mouse_status_up"
"mouse_down" "mouse_status_down"
"mouse_drag" "mouse_status_drag"
"mouse_2click" "mouse_status_2click"
"mouse_3click" "mouse_status_3click"
The meaning of these names should be obvious. The second parameter, fun must be defined as
define fun (line, column, btn, shift)
and it must return an integer. The parameters line and column correspond to the line and column numbers in
the buffer where the event took place. btn is an integer that corresonds to the button triggering the
event. It can take on values 1, 2, and 4 corresponding to the left, middle, and right buttons,
respectively. shift can take on values 0, 1, or 2 where 0 indicates that no modifier key was pressed, 1
indicates that the SHIFT key was pressed, and 2 indicates that the CTRL key was pressed. For more detailed
information about the modifier keys, use the function mouse_get_event_info.
When the hook is called, the editor will automatically change to the window where the event occured. The return value of the hook is used to dictate whether or not hook handled the event or whether the editor should switch back to the window prior to the event. Specifically, the return value is interpreted as follows:
|
| get_process_input Void get_process_input (Int_Type tsecs) |
Read all pending input by all subprocesses. If no input is available, this function will wait for input until tsecs tenth of seconds have expired. |
| kill_process Void kill_process (Int_Type id) |
Kill the subprocess specified by the process handle id. |
| open_process Int_Type open_process (name, argv1, argv2, ..., argvN, N) |
Returns id of process, -1 upon failure. |
| process_mark User_Mark process_mark (Int_Type id) |
This function returns the user mark that contains the position of the last output by the process. |
| process_query_at_exit Void process_query_at_exit (Int_Type pid, Int_Type query) |
The process_query_at_exit may be used to specify whether or not the process specified by pid should be silently ignored when the editor exits. If the parameter query is non-zero, the user will be reminded the process exists before exiting. |
| run_shell_cmd Void run_shell_cmd (String cmd) |
The run_shell_cmd function may be used to run cmd in a separate process. Any output generated by the process is inserted into the buffer at the current point. It generates a S-Lang error if the process specified by cmd could not be opened. Otherwise, it returns the exit status of the process. |
| send_process_eof send_process_eof (Int_Type pid) |
This function closes the stdin of the process specified by the handle pid. |
| set_process Void set_process (Int_Type pid, String what, String value) |
pid is the process handle returned by open_process. The second parameter, what, specifies what to set. It
must be one of the strings:
|
| signal_process Void signal_process (Int_Type pid, Int_Type signum) |
This function may be used to send a signal to the process whose process handle is given by pid. The pid must be a valid handle that was returned by open_process. |
| blank_rect | The blank_rect function replaces all text in the rectangle defined by the current editing point and the mark by spaces. |
| copy_rect Void copy_rect () |
The copy_rect function is used to copy the contents of the currently defined rectangle to the rectangle buffer. It overwrites the previous contents of the rectangle buffer. A rectangle is defined by the diagonal formed by the mark and the current point. |
| insert_rect insert_rect () |
The insert_rect function inserts the contents of the rectangle buffer at the current editing point. The rectangle buffer is not modified. Any text that the rectangle would overwrite is moved to the right by an amount that is equal to the width of the rectangle. |
| kill_rect Void kill_rect () |
This function deletes the rectangle defined by the mark and the current point. The contents of the rectangle are saved in the rectangle buffer for later retrieval via the insert_rect function. The previous contents of the rectangle buffer will be lost. |
| open_rect Void open_rect () |
The open_rect function may be used to insert a blank rectangle whose size is determined by the mark and the current editing point. Any text that lies in the region of the rectangle will be pushed to the right. |
| KILL_ARRAY_SIZE Int_Type KILL_ARRAY_SIZE |
This variable contains the value of the size of the internal kill array of character strings. Any number from zero up to but not including the value of KILL_ARRAY_SIZE may be used as an argument in the functions that manipulate this array. |
| append_region_to_file Integer append_region_to_file (String file) |
Appends a marked region to file returning number of lines written or -1 on error. This does NOT modify a buffer visiting the file; however, it does flag the buffer as being changed on disk. |
| append_region_to_kill_array Void append_region_to_kill_array (Integer n) |
This function appends the currently defined region to the contents of nth element, specified by n, of an
internal array of character strings.
Note: This function is not available on 16 bit systems. |
| bufsubstr String bufsubstr () |
This function returns a string that contains the characters in the region specified by a mark and the current editing point. If the region crosses lines, the string will contain newline characters. |
| check_region Void check_region (Integer ps) |
This function checks to see if a region is defined and may exchange the current editing point and the mark
to define a canonical region. If the mark is not set, it signals an S-Lang error. A canonical region is one
with the mark set earlier in the buffer than than the editing point. Always call this if using a region
which requires such a situation.
If the argument ps is non-zero, push_spot will be called, otherwise, ps is zero and it will not be called. As an example, the following function counts the number of lines in a region:
define count_lines_region ()
{
variable n;
check_region (1); % spot pushed
narrow ();
n = what_line ();
widen ();
pop_spot ();
return n;
}
|
| copy_region Void copy_region (String buf) |
This function may be used to copy a region defined by a mark and the current position to the buffered specified by the name buf. It does not delete the characters in region but it does pop the mark that determines the region. |
| copy_region_to_kill_array Void copy_region_to_kill_array (Integer n) |
This function copies the currently defined region to the nth element, specified by n, of an internal array
of character strings replacing what is currently there.
Note: This function is not available on 16 bit systems. |
| count_narrows Integer count_narrows () |
This function returns the narrow depth of the current buffer. |
| narrow Void narrow () |
This function may be used to restict editing to the region of lines between the mark and the editing point.
The region includes the line containing the mark as well as the line at the current point. All other lines
outside this region are completely inacessable without first lifting the restriction using the widen
function. As a simple example, suppose that there is a function called print_buffer that operates on the
entire buffer. Then the following function will work on a region of lines:
define print_region ()
{
narrow ();
print_buffer ();
widen ();
}
The narrow function will signal an error if the mark is not set. Note also that the narrow function may be
used recursively in the sense that a narrowed region may be further restricted using the narrow function.
For each narrow, the widen function must be called to lift each restriction.
|
| narrow_to_region Void narrow_to_region (void) |
The narrow_to_region function behaves like the narrow function that narrow operates on lines and narrow_to_region restricts editing to only characters within the region. |
| pipe_region Integer pipe_region (String cmd) |
The pipe_region function executes cmd in a separate process and sends the region of characters defined by the mark and the current point to the standard input of the process. It successful, it returns the exit status of the process. Upon failure it signals an error. Note: This function is only available for Unix and OS/2 systems. |
| pop_narrow Void pop_narrow () |
The purpose of this function is to restore the last narrow context that was saved via push_narrow. |
| push_narrow Void push_narrow () |
This function saves the current narrow context. This is useful when one wants to restore this context after widening the buffer. |
| translate_region Void translate_region () |
This function uses the global character array TRANSLATE_ARRAY to modify the characters in a region based on
the mapping defined by the array. The only restriction is that the newline character cannot be mapped. This
example
define swap_a_and_b ()
{
variable i;
_for (0; 255, 1)
{
i = ();
TRANSLATE_ARRAY[i] = i;
}
TRANSLATE_ARRAY['a'] = 'b';
TRANSLATE_ARRAY['b'] = 'a';
bob (); push_mark (); eob ();
translate_region ();
}
uses translate_region to swap the 'a' and 'b' characters in the current buffer.
|
| widen Void widen () |
This function undoes the effect of narrow. Consult the documentation for narrow for more information. |
| widen_buffer Void widen_buffer () |
This function widens the whole buffer. If one intends to restore the narrow context after calling this function, the narrow context should be saved via push_narrow. |
| widen_region Void widen_region () |
This function undoes the effect of narrow_to_region. Consult the documentation for narrow_to_region for more information. |
| write_region_to_file Integer write_region_to_file (String filename) |
This function may be used to write a region of the current buffer to the file specified by filename. It returns the number of lines written to the file or signals an error upon failure. |
| xform_region Void xform_region (Integer how) |
This function changes the characters in the region in a way specified by the parameter how. This is an
integer that can be any of of the following:
'u' Upcase_region
'd' Downcase_region
'c' Capitalize region
Anything else will change case of region.
|
| CASE_SEARCH Int_Type CASE_SEARCH |
If the value of CASE_SEARCH is non-zero, text searches will be case-sensitive, otherwise case-insensitive searches will be performed. |
| bfind Integer bfind (String str) |
find searches backward from the current position to the beginning of the line for the string str. If a match is found, the length of str is returned and the current point is moved to the start of the match. If no match is found, zero is returned. Note: This function respects the setting of the CASE_SEARCH variable. |
| bfind_char Integer fsearch_char (Integer ch) |
This function searches backward on the current line for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| bol_bsearch Integer bol_bsearch (str) |
bol_bsearch searches backward from the current point until the beginning of the buffer for the occurrences
of the string str at the beginning of a line. If a match is found, the length of str is returned and the
current point is moved to the start of the match. If no match is found, zero is returned.
Note: bol_bsearch is much faster than using re_bsearch to perform a search that matches the beginning of a line. |
| bol_bsearch_char Integer bol_fsearch_char (Integer ch) |
This function searches backward for a character ch at the beginning of a line. If it is found, 1 is returned; otherwise 0 is returned. |
| bol_fsearch Integer bol_fsearch (str) |
bol_fsearch searches forward from the current point until the end of the buffer for occurrences of the string str at the beginning of a line. If a match is found, the length of str is returned and the current point is moved to the start of the match. If no match is found, zero is returned. Note: bol_fsearch is much faster than using re_fsearch to perform a search that matches the beginning of a line. |
| bol_fsearch_char Integer bol_fsearch_char (Integer ch) |
This function searches forward for a character ch at the beginning of a line. If it is found, 1 is returned; otherwise 0 is returned. |
| bsearch Integer bsearch (String str) |
The bsearch function searches backward from the current position for the string str. If str is found, this function will return the length of str and move the current position to the beginning of the matched text. If a match is not found, zero will be returned and the position will not change. It respects the value of the variable CASE_SEARCH. |
| bsearch_char Integer fsearch_char (Integer ch) |
This function searches backward for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| ffind Integer ffind (String s) |
ffind searches forward from the current position to the end of the line for the string str. If a match is found, the length of str is returned and the current point is moved to the start of the match. If no match is found, zero is returned. Note: This function respects the setting of the CASE_SEARCH variable. To perform a search that includes multiple lines, use the fsearch function. |
| ffind_char Integer fsearch_char (Integer ch) |
This function searches forwardward on the current line for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| find_matching_delimiter Integer find_matching_delimiter (Integer ch) |
This function scans either forward or backward looking for the delimiter that matches the character
specified by ch. The actual direction depends upon the syntax of the character ch. The matching delimiter
pair must be declared as such by a prior call to define_syntax. This function returns one of the following
values:
1 Match found
0 Match not found
-1 A match was attempted from within a string.
-2 A match was attempted from within a comment
2 No information
In addition, the current point is left either at the match or is left at the place where the routine either
detected a mismatch or gave up. In the case of a comment or a string (return values of -2 or -1), the
current point is left at the beginning of a comment. Note: If the of ch is zero, the character at the
current point will be used.
|
| fsearch Integer fsearch (String str) |
This function may be used to search forward in buffer looking for the string str. If not found, this
functions returns zero. However, if found, the length of the string is returned and the current point is
moved to the to the start of the match. It respects the setting of the variable CASE_SEARCH. If the string
that one is searching for is known to be at the beginning of a line, the function bol_fsearch should be
used instead.
Note: This function cannot find a match that crosses lines. |
| fsearch_char Integer fsearch_char (Integer ch) |
This function searches forward for a character ch. If it is found, 1 is returned; otherwise 0 is returned. |
| looking_at Integer looking_at (String s) |
This function returns non-zero if the characters immediately following the current editing point match the string specified by s. Whether the match is case-sensitive or not depends upon the value of the variable CASE_SEARCH. The function returns zero if there is no match. |
| re_bsearch Integer re_bsearch(String pattern) |
Search backward for regular expression pattern. This function returns the 1 + length of the string matched. If no match is found, it returns 0. |
| re_fsearch Integer re_fsearch(String pattern) |
Search forward for regular expression pattern. This function returns the 1 + length of the string matched. If no match is found, it returns 0. |
| regexp_nth_match String regexp_nth_match (Integer n) |
This function returns the nth sub-expression matched by the last regular expression search. If the
parameter n is zero, the entire match is returned.
Note: The value returned by this function is meaningful only if the editing point has not been moved since the match. |
| replace Void replace(String old, String new) |
This function may be used to replace all occurances of the string old with the string, new, from current editing point to the end of the buffer. The editing point is returned to the initial location. That is, this function does not move the editing point. |
| replace_chars Void replace_chars (Integer n, String new) |
This function may be used to replace the next n characters at the editing position by the string new. After the replacement, the editing point will be moved to the end of the inserted string. The length of the replacement string new is returned. |
| replace_match Integer replace_match(String s, Integer how) |
This function replaces text previously matched with re_fsearch or re_bsearch at the current editing point with string s. If how is zero, s is a specially formatted string of the form described below. If how is non-zero, s is regarded as a simple string and is used literally. If the replacement fails, this function returns zero otherwise, it returns non-zero. |
| search_file Integer search_file (String filename, String re, Integer nmax) |
This function may be used to search for strings in a disk file matching the regular expression re. The first argument filename specifies which file to search. The last argument nmax specifies how many matches to return. Each line that is matched is pushed onto the S-Lang stack. The number of matches (limited by nmax) is returned. If the file contains no matches, zero is returned. |
| build_highlight_table Void build_highlight_table (String n) |
This function builds a DFA table for the enhanced syntax highlighting scheme specified for the syntax table specified by the name n. This must be called before any syntax highlighting will be done for that syntax table. |
| create_syntax_table Void create_syntax_table (String name) |
This the purpose of this function is to create a new syntax table with the name specified by name. If the table already exists, this function does nothing. |
|
define_highlight_rule
Void define_highlight_rule (String rule, String color, String n) |
This function adds an enhanced highlighting rule to the syntax table specified by the name n. The rule is
described as a regular expression by the string rule, and the associated color is given by the string
color, in the same format as is passed to set_color. For example:
create_syntax_table ("demo");
define_highlight_rule ("[A-Za-z][A-Za-z0-9]*", "keyword", "demo");
define_highlight_rule ("//.*$", "comment", "demo");
build_highlight_table ("demo");
causes a syntax table to be defined in which any string of alphanumeric characters beginning with an
alphabetic is highlighted in keyword color, and anything after "//" on a line is highlighted in comment
color.
The regular expression syntax understands character classes like [a-z] and [^a-z0-9], parentheses, +, *, ?, | and .. Any metacharacter can be escaped using a backslash so that it can be used as a normal character, but beware that due to the syntax of S-Lang strings the backslash has to be doubled when specified as a string constant. For example:
define_highlight_rule ("^[ \t]*\\*+[ \t].*$", "comment", "C");
defines any line beginning with optional whitespace, then one or more asterisks, then more whitespace to be
a comment. Note the doubled backslash before the *.
Note also that build_highlight_table must be called before the syntax highlighting can take effect. |
|
define_keywords_n
String define_keywords_n (String table, String kws, Integer len, Integer n) |
This function is used to define a set of keywords that will be color syntax highlighted in the keyword
color associated with the table specified by n. The first parameter, table, specifies which syntax table is
to be used for the definition. The second parameter, kws, is a string that is the concatenation of keywords
of length specified by the last parameter len. The list of keywords specified by kws must be in alphabetic
order. The function returns the previous list of keywords of length len. For example, C mode uses the
statement
() = define_keywords_n ("C", "asmforintnewtry", 3, 0);
to define the four three-letter keywords asm, for, int, new, and try. Note that in the above example, the
return value is not used.
|
| define_syntax Void define_syntax (..., Integer type, String name) |
This function adds a syntax entry to the table specified by the last parameter name. The actual number of
parameters vary according to the next to the last parameter type.
If type is '"' or '\'', a string or character delimiter syntax is defined. In this case, define_syntax only takes three parameters where the first parameter is an integer that represents the character for which the syntax is to be applied. Similarly, if type is '\\', then a quote syntax is defined and again define_syntax only takes three parameters where the first parameter is an integer that represents the character for which the syntax is to be applied. A quote character is one in which the syntax of the following character is not treated as special. If type is '(', then define_syntax takes four parameters where the first two parameters are strings that represent a matching set of delimiters. The first string contains the set of opening delimiters and the second string specifies the set of closing delimiters that match the first set. If a character from the closing set is entered into the buffer, the corresponding delimiter from the opening set will be blinked. For example, if the C language syntax table is called "C", then one would use
define_syntax ("([{", ")]}", '(', "C");
to declare the matching delimiter set. Note that the order of the characters in the two strings must
correspond. That is, the above example says that '(' matches ')' and so on.
If type is '%', a comment syntax is defined. As in the previous case, define_syntax takes four parameters where there first two parameters are strings that represent the begin and end comment delimiters. If the comment syntax is such that the comment ends at the end of a line, the second string must either be the empty string, "", or a newline "\n". In the current implementation, at most the begin and end comment strings can consist of at most two characters. If type is '+', the first parameter is a string whose characters are given the operator syntax. If type is ',', the first parameter is a string composed of characters that are condered to be delimiters. If type is '0', the first parameter is a string composed of characters that make up a number. If type is <, the first parameter is a string whose successive characters form begin and end keyword highlight directives. Finally, if type is '#', the first parameter is an integer whose value corresponds to the character used to begin preprocessor lines. As an example, imagine a language in which the dollar sign character $ is used as a string delimiter, the backward quote character ` is used as a quote character, comments begin with a semi-colon and end at the end of a line, and the characters '<' and '>' form matching delimiters. Then one might use
create_syntax_table ("strange");
define_syntax ('$', '"', "strange");
define_syntax ('`', '\\', "strange");
define_syntax (";", "", '%', "strange");
define_syntax ("<", ">", '(', "strange");
to create a syntax table called "strange" and define the syntax entries for appropriate this example.
|
| enable_highlight_cache Void enable_highlight_cache (String file, String n) |
This function enables caching of the DFA table for the enhanced syntax highlighting scheme belonging to the
syntax table specified by the name n. This should be called before any calls to define_highlight_rule or to
build_highlight_table. The parameter file specifies the name of the file (stored in the directory set by
the set_highlight_cache_dir function) which should be used as a cache.
For example, in cmode.sl one might write
enable_highlight_cache ("cmode.dfa", "C");
to enable caching of the DFA. If caching were not enabled for C mode, the DFA would take possibly a couple
of seconds to compute every time Jed was started.
Transferring cache files between different computers is theoretically possible but not recommended. Transferring them between different versions of Jed is not guaranteed to work. |
| parse_to_point Integer parse_to_point () |
This function attempts to determine the syntactic context of the current editing point. That is, it tries
to determine whether or not the current point is in a comment, a string, or elsewhere. It returns:
-2 In a comment
-1 In a string or a character
0 Neither of the above
Note: This routine is rather simplistic since it makes the assumption that the character at the beginning
of the current line is not in a comment nor is in a string.
|
|
set_fortran_comment_chars
void set_fortran_comment_chars (String_Type table, String_Type list) |
This function may be used to specify the set of characters that denote fortran style comments. The first
parameter table is the name of a previously defined syntax table, and list denotes the set of characters
that specify the fortran-style comment.
The string list is simply a set of characters and may include character ranges. If the first character of list is '^', then the meaning is that only those characters that do not specify fortran sytle comments are included in the list. Fortran mode uses the following:
set_fortran_comment_chars ("FORTRAN", "^0-9 \t\n");
This means that if any line that begins with any character except the characters 0 to 9, the space, tab,
and newline characters will denote a comment.
|
| set_highlight_cache_dir Void set_highlight_cache_dir (String dir) |
This function sets the directory where the dfa syntax highlighting cache files are located. |
| set_syntax_flags Void set_syntax_flags (String table, Integer flag) |
This function may be used to set the flags in the syntax table specified by the table parameter. The flag
parameter may take any of the following values or any combination bitwise or-ed together:
0x01 Keywords are case insensitive
0x02 Comments are Fortran-like
0x04 Ignore leading whitespace in C comments
0x08 Keywords are TeX-like
0x10 Comments start/end are whole words
0x20 Syntax highlight whole preprocessor line in same color
0x40 Leading whitespace allowed for preprocessor lines.
A Fortran-like comment means that any line that begins with certain specified characters is considered to
be a comment. This special subset of characters must be specified via a call to the
set_fortran_comment_chars function.
If the 0x04 bit is set, then whitespace at the beginning of a line in a C comment preceeding a '*' character will not be highlighted. A TeX-like keyword is any word that follows the quote character. |
| use_syntax_table Void use_syntax_table (String n) |
This function associates the current buffer with the syntax table specified by the name n. Until another syntax table is associated with the buffer, the syntax table named n will be used in all operations that require a syntax. This includes parenthesis matching, indentation, etc. |
| IGNORE_BEEP Int_Type IGNORE_BEEP |
This variable determines how the terminal is to be beeped. It may be any one of the following values:
0 Do not beep the terminal in any way.
1 Produce an audible beep only.
2 Produce an visible beep only by flashing the display.
3 Produce both audible and visible bells.
|
| SCREEN_HEIGHT Int_Type SCREEN_HEIGHT |
This is a read-only variable whose value represents the number of rows of the display or terminal. |
| SCREEN_WIDTH Int_Type SCREEN_WIDTH |
This is a read-only variable whose value represents the number of columns of the display or terminal. |
| TERM_BLINK_MODE Int_Type TERM_BLINK_MODE |
If the value of this variable is non-zero, JED will interpret high-intensity background colors as blinking characters. On some terminals, e.g., rxvt, the blink bit will be mapped to an actual high intensity background color. |
| TERM_CANNOT_INSERT Int_Type TERM_CANNOT_INSERT |
The value of this variable indicates whether or not the terminal is able to insert. Do disable the use of the insertion capability, set the value of this variable to 0. |
| TERM_CANNOT_SCROLL Int_Type TERM_CANNOT_SCROLL |
If this variable is set to 0, the hardware scrolling capability of the terminal will not be used. This also means that the window will be recentered if the cursor moves outside the top or bottom rows of the window. |
| USE_ANSI_COLORS Int_Type USE_ANSI_COLORS |
The variable USE_ANSI_COLORS may be used to enable or disable color support. If set to a non-zero value, the terminal will be assumed to support ANSI colors. This value of this variable is initially determined by examining the terminal's terminfo file, or by looking for the existence of a COLORTERM environment variable. |
| get_termcap_string String get_termcap_string (String cap) |
This function may be used to extract the string associated with the termcap capability associated with cap. Note: This function is only available on Unix systems. |
| set_term_vtxxx | Set terminal display appropriate for a vtxxx terminal. This function takes a single integer parameter. If non-zero, the terminal type is set for a vt100. This means the terminal lacks the ability to insert/delete lines and characters. If the parameter is zero, the terminal is assumed to be vt102 compatable. Unless you are using a VERY old terminal or a primitive emulator, use zero as the parameter. |
| BLINK Int_Type BLINK |
The BLINK variable controls whether or not matching parenthesis are blinked upon the insertion of a closing parenthesis. If its value is non-zero, the matching parenthesis will be blinked; otherwise, it will not. |
| DISPLAY_EIGHT_BIT Int_Type DISPLAY_EIGHT_BIT |
This variable determines how characters with the high bit set are to be displayed. Specifically, any character whose value is greater than or equal to the value of DISPLAY_EIGHT_BIT is output to the terminal as is. Characters with the high bit set but less than this value are sent to the terminal in a multiple character representation. For Unix and VMS systems the value should be set to 160. This is because many terminals use the characters with values between 128 and 160 as eight bit control characters. For other systems, it can be set to zero. |
| DISPLAY_TIME Int_Type DISPLAY_TIME |
If this variable is non-zero, the current time will be displayed on the status line if the format for the status line permits it. If it is zero, the time will not be displayed even if the %t format string is part of the status line format. |
| DOLLAR_CHARACTER Int_Type DOLLAR_CHARACTER = '$' |
The character represented by DOLLAR_CHARACTER is used to indicate that text extends beyond the borders of the window. This character is traditionally a dollar sign. If the value of DOLLAR_CHARACTER is 0, no character will be used for this indicator. |
| HIGHLIGHT Int_Type HIGHLIGHT |
If this variable is non-zero, marked regions will be highlighted. |
| HORIZONTAL_PAN Int_Type HORIZONTAL_PAN |
If the value of this variable is non-zero, the window wil pan when the cursor goes outside the border of the window. More precisely, if the value is less than zero, the entire window will pan. If the value is positive, only the current line will pan. The absolute value of the number determines the panning increment. |
| LINENUMBERS Int_Type LINENUMBERS |
The LINENUMBERS variable determines whether or not line or column numbers will be displayed on the status line. If the value of LINENUMBERS is 0, then neither the line nor column number information will be displayed. If LINENUMBERS is set to 1, then the current line number will be displayed but column numbers will not be. If LINENUMBERS is 2, the both line a column numbers will be displayed. |
| LINE_NUMBERS Int_Type LINE_NUMBERS |
If set to 0, line numbers are not displayed on the status line. If set to 1, line numbers will be displayed. If set to anything else, the %c column format specifier will be parsed allowing the column number to be displayed on the screen. |
| Simulate_Graphic_Chars Int_Type Simulate_Graphic_Chars |
If the value of this variable is non-zero, graphic characters will be simulated by simple ascii characters instead of trying to use the terminal's alternate character set. |
| Status_Line_String String_Type Status_Line_String |
Status_Line_String is a read-only string variable that specifies the format of the status line for newly created buffers. To set the status line format, use the function set_status_line. |
| TAB Int_Type TAB |
This variable controls the tab width associated with the current buffer. A value of zero means that tab characters are not expanded and that tabs are never used to produce whitespace. |
| TAB_DEFAULT Int_Type TAB_DEFAULT |
The value of TAB_DEFAULT is the default tab setting given to all newly created buffers. A value of zero means that tab characters are not expanded and that tabs are never used to produce whitespace. |
| TOP_WINDOW_ROW Int type TOP_WINDOW_ROW |
If this value of this variable is non-zero, the end of buffer indicator "[EOB]" will be displayed at the end of the buffer. Such an indicator is used for various editor emulations such as the VAX/VMS EDT editor. |
| WANT_SYNTAX_HIGHLIGHT Int_Type WANT_SYNTAX_HIGHLIGHT |
If the value of this variable is non-zero, syntax highlighting will be enabled. Otherwise, syntax highlighting will be turned off. |
| blink_match Void blink_match () |
This function will attempt to blink the matching delimiter immediately before the editing point. |
| enlargewin Void enlargewin () |
This function increases the size of the current window by one line by adjusting the size of the other windows accordingly. |
| nwindows Integer nwindows () |
The nwindows function returns the number of windows currently visible. If the variable MINIBUFFER_ACTIVE is non-zero, the minibuffer is busy and contributes to the number of windows. |
| onewindow Void onewindow () |
This function deletes all other windows except the current window and the mini-buffer window. |
| otherwindow Void otherwindow () |
This function will make the next window in the ring of windows as the default window. For example,
define zoom_next_window ()
{
otherwindow (); onewindow ();
}
defines a function that moves to the next window and then makes it the only window on the screen.
|
| recenter Void recenter (Integer nth) |
This function may be used to scroll the window such that the nth line of the window contains the current line. If nth is zero, the current line will be placed at the center of the window and the screen will be completely redrawn. |
| set_status_line set_status_line (String format, Integer flag) |
This function may be used to customize the status line of the current window according to the string
format. If the second parameter flag is non-zero, format will apply to the global format string; otherwise
it applies to current buffer only. Newly created buffer inherit the global format string when they appear
in a window. The format string may contain the following format specifiers:
%b buffer name
%f file name
%v JED version
%t current time --- only used if variable DISPLAY_TIME is non-zero
%p line number or percent string
%% literal '%' character
%m mode string
%a If abbrev mode, expands to "abbrev"
%n If buffer is narrowed, expands to "Narrow"
%o If overwrite mode, expands to "Ovwrt"
%c If the variable LINENUMBERS is 2, this expands to the current column number.
For example, the default status line used by JED's EDT emulation uses the format string:
"(Jed %v) EDT: %b (%m%a%n%o) %p,%c Advance %t"
|
| splitwindow Void splitwindow () |
This function splits the current window vertically creating another window that carries the current window's buffer. |
| update Void update (Integer f) |
This function may be called to update the display. If the parameter f is non-zero, the display will be updated even if there is input pending. If f is zero, the display may only be partially updated if input is pending. |
| w132 void w132 () |
This function may be used to set the number of columns on a vtxxx compatable terminal to 132. |
| w80 Void w80 () |
This function may be used to set the number of columns on a vtxxx compatable terminal to 80. |
| window_info Integer window_info(Integer item) |
The window_info function returns information concerning the current window. The actual information that is
returned depends on the item parameter. Acceptable values of item and the description of the information
returned is given in the following table:
'r' : Number of rows
'w' : Width of window
'c' : Starting column (from 1)
't' : Screen line of top line of window (from 1)
|
| window_line Integer window_line () |
This function returns the number of rows from the top of the current window for the current line. If the current line is the very first line in the window, a value of 1 will be returned, i.e., it is the first line of the window. |
| BATCH Int_Type BATCH |
BATCH is a read-only variable will be zero if the editor is run in interactive or full-screen mode. It will be 1 if the editor is in batch mode (via the -batch comment line argument). If the editor is in script mode (via -script), then the value of BATCH will be 2. |
| JED_ROOT String_Type JED_ROOT |
This is a read-only string variable whose value indicates JED's root directory. This variable may be set using the JED_ROOT environment variable. |
| _jed_secure_mode Int_Type _jed_secure_mode |
The value of _jed_secure_mode will be non-zero if the editor is running in secure mode. This mode does not allow any access to the shell. |
| _jed_version Int_Type _jed_version |
The value of _jed_version represents the version number of the editor. |
| _jed_version_string String_Type _jed_version_string |
The value of _jed_version_string represents the version number of the editor. |
| call Void call(String f) |
The call function is used to execute an internal function which is not directly accessable to the S-Lang interpreter. |
| core_dump Void core_dump(String msg, Integer severity) |
core_dump will exit the editor dumping the state of some crucial variables. If severity is 1, a core dump will result. Immediately before dumping, msg will be displayed. |
| define_word Void define_word (String s) |
This function is used to define the set of characters that form a word. The string s consists of those
characters or ranges of characters that define the word. For example, to define only the characters A-Z and
a-z as word characters, use:
define_word ("A-Za-z");
To include a hyphen as part of a word, it must be the first character of the control string s. So for
example,
define_word ("-i-n");
defines a word to consist only of the letters i to n and the hyphen character.
|
| exit_jed Void exit_jed () |
This function should be called to exit JED is a graceful and safe manner. If any buffers have been modified
but not saved, the user is queried about whether or not to save each one first. exit_jed calls the S-Lang
hook exit_hook if it is defined. If exit_hook is defined, it must either call quit_jed or exit_jed to
really exit the editor. If exit_jed is called from exit_hook, exit_hook will not be called again. For
example:
define exit_hook ()
{
flush ("Really Exit?");
forever
{
switch (getkey () & 0x20) % map to lowercase
{ case 'y': exit_jed (); }
{ case 'n': return; }
beep ();
}
}
may be used to prompt user for confirmation of exit.
|
| get_doc_string Integer get_doc_string (String obj, String filename) |
This function may be used to extract the documentation for a variable or function from a jed documentation file given by filename. If successful, it returns non-zero as well as the documentation string. It returns zero upon failure. The first character of obj determines whether obj refers to a function or to a variable. The rest of the characters specify the name of the object. |
| get_last_macro String get_last_macro () |
This function returns characters composing the last keyboard macro. The charactors that make up the macro
are encoded as themselves except the following characters:
'\n' ----> \J
null ----> \@
\ ----> \\
'"' ----> \"
|
| get_passwd_info (dir, shell, pwd, uid, gid) = get_passwd_info (String username) |
This function returns password information about the user with name username. The returned variables have
the following meaning:
dir: login directory
shell: login shell
pwd: encripted password
uid: user identification number
gid: group identification number
If the user does not exist, or the system call fails, the function returns with uid and gid set to -1.
|
| getpid Integer is_internal(String f) |
is_internal returns non-zero is function f is defined as an internal function or returns zero if not. Internal functions not immediately accessable from S-Lang; rather, they must be called using the call function. See also the related S-Lang function is_defined in the S-Lang Programmer's Reference. |
| quit_jed Void quit_jed () |
This function quits the editor immediately. No buffers are auto-saved and no hooks are called. The function exit_jed should be called when it is desired to exit in a safe way. |
| random Integer random (Integer seed, Integer nmax) |
The random function returns a random number in the range 0 to, but not including, nmax. If the first
parameter seed is 0, the number generated depends on a previous seed. If seed is -1, the current time and
process id will be used to seed the random number generator; otherwise seed will be used.
Example: generate 1000 random integers in the range 0-500 and insert them into buffer:
() = random (-1, 0); % seed generator usingtime and pid
loop (1000)
insert (Sprintf ("%d\n", random (0, 500), 1));
Note: The random number is generated via the expression:
r = r * 69069UL + 1013904243UL;
|
| set_line_readonly Void set_line_readonly (Integer flag) |
This function may be used to turn on or off the read-only state of the current line. If the integer parameter flag is non-zero, the line will be made read-only. If the paramter is zero, the read-only state will be turned off. |
| suspend Void suspend () |
The action of this command varies with the operating system. Under Unix, the editor will be suspended and control will pass to the parent process. Under VMS and MSDOS, a new subprocess will be spawned. Before suspension, suspend_hook is called. When the editor is resumed, resume_hook will be called. These hooks are user-defined functions that take no arguments and return no values. |
| usleep Void usleep (Integer ms) |
A call to usleep will cause the editor to pause for ms milliseconds |
Page created 19 March 2010 and
Page equipped with GoogleBuster technology