[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter of the manual is meant to teach you to use the editor, because of this I have attempted to reduce references to the Lisp extension language to an absolute minimum.
1.1 Invoking Commands | How to use the commands and key-sequences described in this manual. | |
1.2 Command Arguments | Many commands can be modified by prefixing them with a numeric argument | |
1.3 The Help System | Online help facilities | |
1.4 Loading and Saving Files | Manipulating files | |
1.5 Editing Buffers | Simple editing commands | |
1.6 Moving Around Buffers | Commands for moving the cursor | |
1.7 Undo | Go back in time | |
1.8 Editing Units | Characters, words, lines, etc… | |
1.9 Cutting And Pasting | How to insert text from the clipboard | |
1.10 Using Blocks | Highlighting regions to manipulate | |
1.11 Killing | Deleting text for later insertion | |
1.12 Searching and Replacing | Searching the buffer for a regexp | |
1.13 Editing Modes | Editing different types of files | |
1.14 Minor Modes | Small alterations to editing modes | |
1.15 Using Buffers | Selecting & deleting buffers | |
1.16 Using Windows | Opening new windows | |
1.17 Using the Prompt | Entering strings and completion | |
1.18 Using Marks | Recording positions in files | |
1.19 Interrupting Jade | Breaking out of commands | |
1.20 Recursive Editing | Editing within a command | |
1.21 Character Images | How to get a Latin1 character set | |
1.22 Client Editing | Using Jade from other programs | |
1.23 Compiling Programs | Help for developing programs | |
1.23.6 Info Mode | Reading Info files with Jade | |
1.24 Shell | Using a shell inside a buffer | |
1.25 Simple Customisation | Configuring Jade |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Throughout this manual I have documented the key sequences you have to enter to make the editor perform a certain action. In fact, the key sequences are mapped to commands when they are typed and it is the command which performs the action.
Commands are simply pieces of Lisp code, usually with a unique name associated with that command. If you know the name of a command it is possible to invoke it using the Meta-x key sequence; simply type Meta-x command <RET> where command is the name of the command you wish to invoke.
Prompt for the name of a command (completion is available) then invoke it.
For the sake of simplicity I have often referred to key sequences as
commands; what I actually mean is that the key sequence is bound to
the command. For example the key sequence Ctrl-x Ctrl-f opens
a file, in fact the key sequence Ctrl-x Ctrl-f is bound to the
command find-file
, this Lisp function actually loads the file.
More detailed information about commands is available in the programmer’s manual, see @ref{Programming Jade}.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The actions of many commands can be altered by giving them a numeric argument, this argument is entered immediately prior to invoking the command (they are technically called prefix arguments).
Each argument is built using a number of special key sequences,
Append a digit to the end of the current prefix argument. Use a sequence of these keys to build up a decimal number. For example typing Meta-1 Meta-0 Meta-0 creates an argument of 100 for the following command.
(That’s Meta-minus.) Negates the value of current argument, if the command is invoked after a single Meta-- prefix the actual argument is -1.
Successive Ctrl-u key presses multiply the argument by 4 each time. Note that any existing argument entered by the numeric or minus commands (described above) is discarded with the first Ctrl-u.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To invoke the help system type the key sequence Ctrl-h or if your keyboard has it the <HELP> key.
A prompt will be displayed in the status line showing you which keys you can press next to enter one of the main options of the help system explained below. Alternatively, you can type either Ctrl-h or <HELP> again to display some text telling you more about the help system and how to use it.
The help system is exited after successfully invoking one of the commands described below or typing anything which is not a recognised command to the help system.
To list all function names matching regexp, type a regexp <RET> when in the help system.
Prints all key bindings and their associated commands which are installed in the current buffer.
Similarly to the a command, to list all variable names matching regexp, type e regexp <RET> when in the help system.
Displays the online documentation for a function. After invoking this option type the name of the function.
Shows some helpful text describing how to use the help system.
Enters the Info viewer. This allows you to browse through files written in the Info hypertext format. For more information see Info Mode, for more information on Info files in general see (info)Info.
Displays the command (with its documentation) for a key sequence. After typing Ctrl-h k enter the key sequence you want documented as if you were going to invoke the command.
Display the documentation for the current major mode.
Displays the online documentation and current value of a variable. Type the name of the variable after invoking this option.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Since Jade
is a text editor its main function is to edit files of text.
This means that you must be able to read the text contained in a file into
one of the editor’s buffers, then save it back to disk when you have finished
editing it. That is what this section deals with.
1.4.1 Commands To Load Files | Key sequences to load files | |
1.4.2 Commands To Save Files | How to save a buffer | |
1.4.3 File Variables | Local variables defined in files | |
1.4.4 Backup Files | Making backups | |
1.4.5 Auto-Saving Files | Files can be saved periodically | |
1.4.6 Accessing Compressed Files | Reading and writing gzipped files | |
1.4.7 Other File Commands | How to delete, rename or copy files |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several commands used to load files into buffers, these are,
Prompts for the name of a file (using file-completion) and display the buffer containing that file. If the file has not already been loaded it will be read into a new buffer.
Prompts for the name of a file, the current buffer is killed and the buffer
in which the prompted-for file is being edited is displayed. As in
find-file
it will be read into a new buffer if it is not already in
memory.
Similar to find-file
except that the buffer is marked as being
read-only. This means that no modifications can be made to the buffer.
Prompts for a file, then inserts it into the current buffer at the cursor position.
You can use the prompt’s completion feature to expand abbreviated filenames typed to the prompt, for more information see The Buffer Prompt.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These are the commands used to save buffers and the key sequences associated with them,
Saves the current buffer to the file that it is associated with (this is
either the file that it was loaded from or something else set by the
function set-file-name
). If no modifications have been made to the
file since it was loaded it won’t be saved (a message will be displayed
warning you of this).
Prompts for a name to save the file as. The file associated with this buffer is renamed and the file is saved as its new name.
For each buffer which has been modified since it was loaded, ask the user
if it should be saved or not. If so, the command save-file
is used to
save the file
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is often useful to define ‘local’ values of certain variables which only come into effect when a particular file is being edited. Jade allows you to include a special section in a file which, when the file is loaded, is used to give the variables specified buffer-local values. (For more information about buffer-local variables see @ref{Buffer-Local Variables}.)
The special section must be somewhere in the last twenty lines of a file, and must be formatted as in the following example,
XXX Local Variables: YYY XXX variable:value YYY … XXX End: YYY
That is, the string ‘Local Variables:’ followed by as many lines defining local values as necessary then the string ‘End:’. The two strings ‘XXX’ and ‘YYY’ may be anything (even nothing!) as long as they are the same on each line. They are normally used to put the local variable section into a comment in a source file.
For example, in a Texinfo source file the following piece of text at the bottom of the file would set the column at which lines are broken to 74 (note that ‘@c’ introduces a comment in Texinfo).
@c Local Variables: @c fill-column:74 @c End:
Two pseudo-variables which can be set using a local variables section are ‘mode’ and ‘eval’. Setting the ‘mode’ variable actually defines the major mode to use with the file (see section Editing Modes) while setting ‘eval’ actually evaluates the Lisp form VALUE then discards its value.
For example,
/* Local Variables: */ /* mode:C */ /* eval:(message "How pointless!") */ /* End: */
This Forces the file to be edited with the C mode and displays a
pointless message. Note that no variables called mode
or
eval
are actually set.
Several variables are used to control how the local variables feature works.
Defines how to process the ‘Local Variables:’ section of a file:
nil
means to ignore it, t
means process it as normal and
anything else means that each variable being set has to be confirmed by
the user. Its default value it t
.
This variable defines how the pseudo-variable ‘eval’ is treated in
a local variables list, it works in the same way as the
enable-local-variables
variable does. Its default value
is maybe
, making each form be confirmed before being evaluated.
Defines how many lines at the bottom of a file are scanned for the ‘Local Variables:’ marker, by default it is 20.
Note that this feature is compatible with GNU Emacs, and since I have tried to keep the names of variables compatible as well, there should be few problems.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The editor can optionally preserve the previous contents of a file when it is about to be overwritten by the saving of a buffer. It does this by renaming the old file, ‘foo’ as ‘foo~’ (the original name plus a tilde appended to it) before it is obliterated.
This variable controls whether or not backups are made of files about to
overwritten by the function write-buffer
(i.e. the commands
save-file
and save-file-as
). When non-nil the old instance
of the file is renamed so that it has a tilde appended to its old name.
When non-nil all backups are made by copying the original file instead of renaming it as the backup file. This is slower but less destructive.
If backup-by-copying
is nil
and renaming the original
file would not be a good idea (i.e. it might break a link or something)
and this variable is non-nil
the backup will be made by copying
the original file.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade is able to save snapshots of a buffer’s contents at set time intervals. When this time interval expires and the buffer has been modified since it was last (auto-) saved to disk (and the editor is idle) the buffer is saved to a special file (usually the base component of the file’s name surrounded by ‘#’ characters in the file’s directory).
When non-nil this makes the function open-file
(and therefore the
commands find-file
, etc) flag that the file it just read should be
auto saved regularly.
This is the default number of seconds between each auto save. This variable is only referenced when each file is opened.
Its standard value is 120 seconds.
This buffer-local variable controls the number of seconds between each auto-save of the buffer it belongs to. A value of zero means never auto-save.
When the buffer is saved properly (i.e. with save-file
and friends) its
auto-save file is deleted. Note that this doesn’t happen when you kill a buffer
and an auto-save file exists (in case you didn’t mean to kill the buffer).
To recover an auto-saved file (i.e. after an editor crash or something!)
use the command recover-file
.
Loads the auto-saved copy of the file stored in this buffer overwriting its current contents (if any changes are to be lost you will have to agree to losing them).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade contains basic support for reading, inserting and writing buffers
which have been compressed using the gzip
or compress
compression programs. When this feature is enabled such files are
transparently decompressed when loaded into the buffer and compressed
when saved back to a file.
Unfortunately this doesn’t work on Amigas yet. To install it the Lisp form,
(require 'gzip)
should be in your ‘.jaderc’ file (or you can do this by hand
in the *jade*
buffer if you want).
After the gzip
package has been installed any files loaded
into buffers whose filename end in ‘.gz’ or ‘.Z’ are
uncompressed, this suffix is stripped when searching for a major mode
to install in the buffer but otherwise the buffer’s filename is left
intact.
Any buffer saved whose filename ends in one of the above suffixes
is automatically compressed (‘.gz’ is compressed by gzip
,
‘.Z’ by compress
).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Deletes the file called file-name.
Renames the file called source as the file dest.
Makes a copy of the file called source as the file dest.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The majority of keys when typed will simply insert themselves into the buffer (this is not always true but it’s a good assumption) since they have not been bound. Typically this includes all normal characters (i.e. alphanumeric, punctuation, etc) as well as any of the more obtuse key-sequences which have not been bound to a function (Ctrl-l is one of the more useful of these).
The behaviour of the <TAB> key is different to many other editors — it
doesn’t insert anything (unless a specific editing mode has bound it to
something else, like c-mode
for example), generally it just moves the
cursor to the next tab stop. This is partly because Jade doesn’t use “proper”
tabs and partly because it makes it easier to move around a line (because the
key sequence Shift-<TAB> moves to the previous tab stop).
Some miscellaneous editing commands follow.
This generally splits the line into two at the position of the cursor, some editing modes may provide an option which automatically indents the line after it’s split.
Deletes the character before the cursor.
Deletes the character under the cursor.
Kills the characters between the start of the line and the cursor. See section Killing.
Kills the characters from the cursor to the end of the line.
Kills the whole line.
Splits the line in two at the cursor, but leaves the cursor in its original position.
Kills from the cursor to the end of the current word.
Kills from the cursor to the end of the line, or if the cursor is at the end of the line from the cursor to the start of the next line. Each successive Ctrl-k appends to the text in the kill buffer.
Makes the characters from the cursor to the end of the word lower case.
Upper cases the characters from the cursor to the end of the word.
Capitalises the characters from the cursor to the end of the word, this means make the first character upper case and the rest lower.
Kills from the cursor to the beginning of the word.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here is a selection of the most commonly used commands which move the cursor around the current buffer.
Move one line up.
Move one line down.
Move one column to the left, stopping at the first column.
Move to the previous character, at the beginning of the line moves to the end of the previous line.
Move one column to the right. This keeps moving past the end of the line.
Move to the next character, at the end of a line moves to the start of the next line.
Move to the first line in the buffer.
Move to the last line in the buffer.
Move to the first character in the buffer.
Move to the last character in the buffer.
Move to the beginning of the current line.
Move to the last character in the current line.
Move to the previous screen of text.
Move to the next screen of text.
Move to the previous word.
Move to the next word.
Move to the start of the previous paragraph.
Move to the start of the next paragraph.
Insert a tab character, indenting the cursor to the next tab position.
Note that some editing modes redefine <TAB> to make it indent the current line to its correct depth.
Move to the position of the previous tab.
Move to the position of the next tab.
Prompt for a line number and go to it.
Move to the first non-space character in the current line.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade makes it very easy to undo changes to a buffer, this is very useful when you realise that actually, that wasn’t the part of the file you wanted to delete!
Basically to undo the last command type either Ctrl-_ or Ctrl-x u. If the last thing you did was to type some text into the buffer all the consecutively-typed characters count as one command.
To undo more than one command, simply type more than one Ctrl-_ (or Ctrl-x u) consecutively; this will progressively work its way back through the buffer’s history. The first non-undo command cancels this effect, so if you undo too far back invoke a command which doesn’t modify the buffer, then undo whatever you undid.
Undo the previous command, or the last block of consecutively typed characters. Successive undo commands work backwards though the undo-history until a non-undo command is invoked.
The exact amount of undo-information kept for each buffer is controlled
by the max-undo-size
variable. This defines the maximum number of
bytes which may be devoted to undo-information in a single buffer, the
default is 10000. No matter what this is set to, the last command is
always recoverable.
The maximum memory which may be devoted to recording undo-information in each buffer.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To make it easier to remember which key sequences do what Jade provides a number of commands which are similar to one another but operate on different units in the buffer. These related-commands are bound to the same key but with a different prefix or modifier. For example Ctrl-f moves forward one character while Meta-f moves forward one word.
1.8.1 Editing Characters | Commands operating on characters, | |
1.8.2 Editing Words | words, | |
1.8.3 Editing Expressions | expressions, | |
1.8.4 Editing Lines | and lines. |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These are the commands which operate on characters. Note that when an argument (see section Command Arguments) is given to one of these commands it actually operates on number of characters. For example, if you want to delete the next 5 characters starting at the cursor type Meta-5 Ctrl-d.
Move forward one character.
Move back one character.
Move one character to the right, when the end of the line is encountered it’s ignored and the cursor keeps moving to the right.
Move one character to the left, stops when the beginning of the line is reached.
Deletes the character beneath the cursor.
Deletes the character before the cursor.
Transposes the character before the cursor with the one under the cursor. When given an argument the character before the cursor is dragged forward over that many characters.
Delete all white space characters surrounding the cursor leaving a single space in their place. If a prefix argument is given that many spaces are left.
Delete all white space characters surrounding the cursor. This is equivalent to the key sequence Meta-0 Meta-<SPC>.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following commands operate on words. When given a prefix argument they operate on that number of words all in one go.
The syntax of a word depends largely on the major mode being used to edit the buffer with, see Editing Modes.
Move forward one word.
Move back one word.
Kills characters from the cursor to the start of the next word. See section Killing.
Kills characters from the start of the previous word to the cursor position.
Transpose words: the word before the cursor is dragged over the following word. An argument means to drag the word over that number of words.
Convert the characters from the cursor to the start of the next word to upper-case.
Similar to Meta-u but converts to lower-case.
Capitalise the word beginning at the cursor position. What happens is that the next alphabetic character is converted to upper-case then the rest of the word is converted to lower-case. Note that an argument to this command currently has no effect.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Expressions are used when editing programming languages; the editing mode for a particular programming language defines the syntax of an expression element in that language. In other editing modes an expression is defined as a single word.
These commands use prefix arguments in the normal manner.
Move forward over one expression element.
Move backwards over one expression.
Kills the following expression, starting from the current cursor position. A negative argument means kill backwards. See section Killing.
Transpose the previous expression with the following one. An argument means to drag the previous one over that many expressions.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These commands all operate on one or more lines of text. Most use a prefix argument (if entered) to define how many lines to move or operate on.
Move down one line.
Move to the previous line.
Move to the beginning of the current line.
Move to the end of the current line.
Prompts for the number of a line to jump to. If a prefix argument was entered that defines the line number.
Kill the current line. See section Killing.
Kill from the cursor to the end of the current line.
Kill from the cursor to the beginning of the line.
If the cursor is not at the end of the line kill the text from the cursor to the end of the line, else kill from the end of the line to the start of the next line.
If this command is given an argument it kills that number of whole lines, either backwards or forwards from the cursor, depending on whether or not the argument is negative or positive. An argument of zero kills from the cursor to the start of the current line.
Create a blank new line, leaving the cursor in its original position. A prefix argument says to create that many blank lines.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
One of the main functions of any editor is to allow you to move around chunks of text, Jade makes this very easy.
Generally, to paste down some text you have to get the text to be inserted into the window-system’s clipboard (1). If the text you wish to paste is in one of the editor’s buffers Jade has a number of commands for doing this, this is sometimes referred to as killing the text. For details of how to kill a piece of text see Killing.
If the text to be pasted is in the same buffer as the position to which you want to copy it there is an easier way than putting it into the clipboard. For more details see Commands on Blocks and the command Ctrl-i.
Once the text to be pasted is in the clipboard there are two commands which can be used to insert it into the buffer before the cursor,
Inserts text into the buffer before the cursor. The text inserted is either the current contents of the kill buffer, or the block marked in this window, if one exists.
This is a variant of Ctrl-y, it treats the string that it is pasting
as a “rectangle” of text. That is, each successive line in the string
(each separated by a newline character) is inserted on successive lines in
the buffer but at the same column position. For more details see
Rectangular Blocks and the function insert-rect
.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A block is a section of a buffer, you mark it by specifying its edges (i.e. the first and last characters). This part of the buffer can then have various things done to it, for example insert it somewhere else.
Each window can only have a single block marked at any one time, it will be displayed in the reverse of normal text (i.e. white on black, not black on white).
1.10.1 Marking Blocks | Commands to define the current block | |
1.10.2 Commands on Blocks | How to work with blocks | |
1.10.3 Rectangular Blocks | Columns of text as blocks |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To mark a block you must specify its outermost points, note that the text marked by the block ends one character before the marked position (this is so that it easy to mark whole lines).
Rectangular blocks are a bit different for more information, see Rectangular Blocks.
Note also that block marks shrink and grow as text is deleted and inserted inside them, similar to what normal marks do.
These are the commands used to mark a block,
If a block is currently marked in this window it will unmark it. Otherwise it will either mark the beginning or end of the block depending on whether or not a block has previously been partially marked.
The normal method for marking a few characters is to first make sure that no block is currently marked (the status line displays the status of the block marks, a ‘b’ means that one end of a block has been marked and a ‘B’ means that both ends of a block are marked in which case it will be highlighted somewhere in the buffer) then press Ctrl-m at one end, move the cursor to the opposite end and press Ctrl-m again.
Mark the whole of the buffer.
Mark the current word.
Mark the current paragraph.
Another method for marking a block is to use the mouse, double clicking the left mouse button on a character has the same effect as moving to that character and typing Ctrl-m. Similarly, clicking the left mouse button while pressing the <SHIFT> key clears a marked block.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Inserts the block marked in this window, at the cursor position, then unmarks the block.
Kills the contents of the marked block, for information about killing see Killing.
Similar to Ctrl-w except that the text is not actually deleted, just stored for later recall.
Deletes the text in the currently marked block.
Makes all alpha characters in the current block lower case.
Makes all characters in the block upper case.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Normally blocks are thought of sequentially from their first to last characters. It is also possible to mark rectangular blocks, the block marks being thought of as the opposite corners of the rectangle.
The commands which operate on blocks automatically check whether the
current block is a rectangle; if so they change their function accordingly.
For example, the Ctrl-i command (insert-block
) understands
that rectangular blocks have to be inserted in a different manner to
normal, sequential, blocks.
Toggle between marking sequential and rectangular blocks, each window has its own value of this attribute (i.e. one window can be marking rectangles while the rest don’t).
Similar to Ctrl-y except that the string inserted is treated as a
rectangle — newline characters don’t get inserted, instead the next line
is inserted in the next line in the buffer at the same column as that inserted
into the previous line. For more details see the function insert-rect
.
At present there is a problem with changing the case of a rectangular block with Ctrl-x Ctrl-l or Ctrl-x Ctrl-u, they treat it as a sequential block. This will be fixed soon.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Killing is the general method for deleting a piece of text so that it can later be re-inserted into a buffer. Each time you kill some text it is stored in the window-system’s clipboard (see see section Cutting And Pasting) where it can be accessed by Jade or other programs.
The text copied by successive kill commands are concatenated together, this makes it easy to incrementally save text a piece at a time.
The main commands for killing are as follows, they are only described in brief since their full descriptions are in other parts of the manual.
Kill the current block. See section Using Blocks.
Kill the current block without actually deleting it from the buffer.
Kills the current line. See section Editing Lines.
Kill the word starting from the cursor. See section Editing Words.
Kills from the cursor to the beginning of the current word.
Kill the expression following the cursor. See section Editing Expressions.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is very easy to search any of Jade’s buffers for a specific string, the standard search command will search the current buffer for a specified regular expression.
Once you have found an occurrence of the string you are looking for it is then possible to replace it with something else.
1.12.1 Regular Expressions | The syntax of regular expressions | |
1.12.2 Incremental Search | How to search for regexps | |
1.12.3 Global Replace | Replacing all occurrences of a regexp | |
1.12.4 Query Replace | Interactively replacing regexps |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade uses the regexp(3) package by Henry Spencer, with some modifications that I have added. It comes with this heading:
Copyright (c) 1986 by University of Toronto.
Written by Henry Spencer. Not derived from licensed software.Permission is granted to anyone to use this software for any purpose on any computer system, and to redistribute it freely, subject to the following restrictions:
- The author is not responsible for the consequences of use of this software, no matter how awful, even if they arise from defects in it.
- The origin of this software must not be misrepresented, either by explicit claim or by omission.
- Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
The syntax of a regular expression (or regexp) is as follows (this is quoted from the regexp(3) manual page):
A regular expression is zero or more branches, separated by ‘|’. It matches anything that matches one of the branches.
A branch is zero or more pieces, concatenated. It matches a match for the first, followed by a match for the second, etc.
A piece is an atom possibly followed by ‘*’, ‘+’, or ‘?’. An atom followed by ‘*’ matches a sequence of 0 or more matches of the atom. An atom followed by ‘+’ matches a sequence of 1 or more matches of the atom. An atom followed by ‘?’ matches a match of the atom, or the null string.
An atom is a regular expression in parentheses (matching a match for the regular expression), a range (see below), ‘.’ (matching any single character), ‘^’ (matching the null string at the beginning of the input string), ‘$’ (matching the null string at the end of the input string), a ‘\’ followed by a single character (matching that character), or a single character with no other significance (matching that character).
A range is a sequence of characters enclosed in ‘[]’. It normally matches any single character from the sequence. If the sequence begins with ‘^’, it matches any single character not from the rest of the sequence. If two characters in the sequence are separated by ‘-’, this is shorthand for the full list of ASCII characters between them (e.g. ‘[0-9]’ matches any decimal digit). To include a literal ‘]’ in the sequence, make it the first character (following a possible ‘^’). To include a literal ‘-’, make it the first or last character.
Some example legal regular expressions could be:
Matches an ‘a’ followed by zero or more ‘b’ characters, followed by one or more ‘a’ characters, followed by a ‘b’. For example, ‘aaab’, ‘abbbab’, etc…
Matches ‘one_three’ or ‘two_three’.
Matches ‘cmd_’ followed by one or more digits, it must start at the beginning of the line.
As well as being matched against, regexps also provide a means of “remembering” portions of the string that they match. The first nine parenthesised expressions that are matched and the whole match are recorded so that they can be used later.
The main use for this is in the command to replace a previously found regexp
with the Lisp functions regexp-expand
, regexp-expand-line
and
replace-regexp
. The string which is given as the template (i.e. the
string that replaces the matched string) is expanded inserting these recorded
strings where asked to.
Each occurrence of ‘\C’ in the template is a candidate for expansion. C can be one of:
Replaces the whole substring matched by the regular expression.
The numbered parenthesised expression.
The character ‘\’.
For example, if a regexp of ‘:([0-9]+):’ matches a line ‘foo:123:bar’, the expansion template ‘x_\1’ would produce ‘x_123’.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade’s main command for searching buffers is an Emacs-style incremental search (or isearch). This is a subsystem of the editor which lets you interactively search for regular expressions in a buffer.
Start an incremental search, initially searching forwards through the buffer.
Similar to Ctrl-s except that searching is initially in the backwards direction.
When you are in an isearch the general idea is to type in a regular expression and see what it matches in the buffer. As more characters are added to the string being searched for the cursor indicates strings which match. To backtrack your steps (i.e. the characters you have typed) the backspace key is used.
The special commands which are available when isearching are,
Search forwards for another occurrence of the search regexp. This can also be used to wrap around to the start of the buffer if no more matches exist between the cursor and the end of the buffer.
Search backwards for the regexp.
Cancels the isearch. If the search is currently failing (the string you’ve typed doesn’t match anything) characters are deleted from the regexp until either a match is found or the original cursor position is reached. If the search is not failing the cursor is returned to its original position and the isearch is exited.
Copies the word under the cursor to the regexp being searched for.
The rest of the current line is appended to the regexp being searched for.
The next character typed is appended to the regexp no matter what it is, this can be used to enter control characters. Note that currently you can’t search for newline characters.
Accept the cursor’s current position, the isearch is exited leaving the cursor as it is.
Moves back up the stack which represents the current isearch, i.e. deletes characters from the search regexp or moves the cursor through the positions it had to reach its current position.
Any other keys are appended to the regular expression being searched for.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For all occurrences of the regular expression regexp replace it with the string obtained by expanding template. For details of how the template works see Regular Expressions.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The query-replace
function provides an interactive method of
replacing strings in a buffer which match a specific regular expression.
For each occurrence found you, the user, have a number of options; for example, you could replace this occurrence with a prespecified template.
Invoke a query-replace, for all occurrences of the regular expression, regexp you will be prompted for what you want to do with it. Usually this will be to replace it with the expansion provided by the template (see see section Regular Expressions) template.
Special commands which come into effect each time the query-replace finds a match are,
Replace this occurrence with the expansion of template and search for the next match.
Ignore this match and search for the next.
Replace this occurrence, then wait for another command.
Exit this query-replace.
Replace this occurrence then exit.
Replace the current match and all the rest between here and the end of the buffer.
Retrace your steps through each match which has been found.
Enter a recursive-edit, this is allows you to edit this match by hand. When you exit the recursive-edit (with the Ctrl-Meta-c command) the next match is searched for.
Delete the current match, then enter a recursive-edit, as in the Ctrl-r command.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Modes are used to tailor the editor to the type of the file being edited in a buffer. They are normally a file of Lisp which installs the buffer-local key bindings and variables which are needed for that type of file.
For example, C-mode is a mode used to edit C source code, its main function is to try to indent each line to its correct position automatically.
The name of the mode active in the current buffer is displayed in the status line, inside the square brackets.
At present there are only a small number of modes available. It is fairly straightforward to write a mode for other classes of file though. @xref{Writing Modes}.
Most of the modes for editing programming languages use the command Meta-; to insert a comment place-holder, the cursor is moved to where you should type the body of the comment.
1.13.1 Invoking a Mode | How editing modes are invoked on a buffer | |
1.13.2 Generic mode | The foundations which all modes build from | |
— Modes for editing programming languages — | ||
---|---|---|
1.13.3 C mode | Mode for C source code | |
1.13.4 Lisp mode | Mode for Lisp | |
1.13.5 Asm mode | For generic assembler source | |
— Modes for natural language — | ||
1.13.6 Text mode | For normal language-based text | |
1.13.7 Indented-Text mode | Variant of Text-mode | |
1.13.8 Texinfo mode | Mode for editing Texinfo source |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When a new file is loaded the function init-mode
tries to find the
mode that it should be edited with. If it is successful the mode will be
automatically invoked.
It is also possible to install a mode manually, simply invoke the command which is the name of the mode. For example to install the ‘C mode’ in a buffer type Meta-x c-mode.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is not a mode as such since there is no Lisp code associated with it. When no mode is being used to edit the buffer, it is said to use the “Generic” mode.
This is the base from which all other modes build, it consists of all the standard key bindings. Words are defined as one or more alphanumeric characters, paragraphs are separated by a single blank line.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
c-mode
is used for editing C source code files. Any files which end in
‘.c’ or ‘.h’ are automatically edited in this mode.
It’s one and only function is to try and indent lines to their correct depth, it doesn’t always get it right but it works fairly well. The keys that it rebinds to achieve this are,
It also defines the syntax of an expression in the C language for use with the expression commands, see Editing Expressions.
Indents the current line to what the editor thinks is the correct position.
These keys are handled specially since the indentation of the line that they are inserted on may have to be adjusted.
Indents all lines which are marked by the current block.
Editing mode for C source code. Automatically used for files ending in ‘.c’ or ‘.h’.
This hook is called by c-mode
each time the mode is invoked.
Size of tab stops used by c-mode
.
When non-nil <RET> will indent the line after splitting it.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
lisp-mode
is used to edit files of Lisp intended to be read by the
editor. Its main function is to manage the indentation of Lisp expressions
for you. Each form is regarded as an expression by the commands which
operate on expressions, see Editing Expressions.
There is also support for using a buffer as a simple shell-interface to the editor’s Lisp subsystem.
The method used for indenting lines of Lisp is fairly straightforward,
the first symbol in the expression containing this line is found.
This symbol’s lisp-indent
property is then used to decide which
indentation method to apply to this line. It can be one of the following,
nil
The standard method (also used if the symbol doesn’t have a lisp-indent
property).
If the first argument to the function is on the same line as the name of the function then subsequent lines are placed under the first argument. Otherwise, the following lines are indented to the same depth as the function name.
For example,
(setq foo 20 bar 1000) (setq foo 20 bar 1000)
defun
This method is used for all functions (or special-forms, macros) whose name begins with ‘def’ and any lambda-expressions.
All arguments to the function are indented lisp-body-indent
columns
from the start of the expression.
For example,
(defun foo (bar) "A test" (let ((foo bar)) ...
The first n arguments to the function are indented twice the value
of lisp-body-indent
, the remaining arguments are indented by
lisp-body-indent
.
For example the special-form if
has a lisp-indent
property of 2,
(if condition t-expression nil-expressions...)
Special commands for Lisp mode are,
Evaluates the expression preceding the cursor, prints the value on the next line. This is designed to be used like a shell, you type a Lisp expression, press Ctrl-j and Jade prints the value for you.
Indents the current line.
Indents all lines which are marked by the current block.
Evaluates the expression before the cursor, prints it’s value in the status line.
Editing mode for Jade’s Lisp. Automatically invoked for files ending in ‘.jl’.
This hook is evaluated each time lisp-mode
is invoked.
The number of characters which the body of a form is indented by, the default value is 2.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A basic mode for editing assembler source files with, provides automatic indentation of labels and instructions.
The special commands are,
Breaks the line as normal, if asm-indent
is non-nil a tab
characters is inserted as well.
Deletes all indentation from the start of the current line, then inserts the string ‘:\t’ to move to the next tab stop. This is used to enter labels.
If the line is not empty, all indentation is deleted from the start of the line. A dot (‘.’) is then inserted.
Major mode for generic assembler source files.
The hook which is called when asm-mode
is entered.
When this variable is non-nil the <RET> key inserts the string ‘\n\t’ instead of just ‘\n’. This indents the cursor to the first tab stop of the new line.
This variable defines the string which denotes the start of a comment in the assembler that you are using. By default this is ‘;’.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is the most basic mode for editing English-style text in. The main
difference over generic-mode
and is that words are allowed to
contain underscores and there are some extra commands,
Centres the current line. The position of the fill-column
is used
to calculate the centre of the line. For more information on the
fill-column
variable see Fill mode.
Centres the current paragraph.
Major mode for editing English text.
Evaluated when text-mode
is invoked. Variants of text-mode
also use this hook.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is a variant of text-mode
, see Text mode. It’s only
difference is in the way the <TAB> key is handled — tab stops are
calculated from the previous non-empty line. Each transition from a
sequence of one or more spaces to a non-space character is used as a tab
stop. If there are none of these to the right of the cursor normal the
standard tabbing command is used.
Variant of text-mode
.
Evaluated when indented-text-mode
is invoked. The hook
text-mode-hook
is also evaluated (before this one).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
texinfo-mode
is used to edit Texinfo source files, it is automatically
selected for files ending in ‘.texi’ or ‘.texinfo’. It provides
a few basic key bindings to take some of the tedium out of editing these files.
Paragraphs are separated by the regexp ‘^@node’, i.e. each node is a separate paragraph.
The special commands are,
Inserts as many spaces as are needed to move the cursor to the next tab position. The reason tab characters aren’t used is that TeX doesn’t agree with them.
Insert the string ‘@code{}’, positioning the cursor between the braces.
Insert the string ‘@dfn{}’, positioning the cursor between the braces.
Inserts the string ‘@end’.
Inserts the string ‘@file{}’, the cursor is put between the braces.
Inserts the string ‘@item’.
Inserts the string ‘@lisp\n’.
Inserts the string ‘@menu\n’.
Prompts for the name of a node and makes a menu-item for it.
Prompts for each part of a node definition (name, next, prev, up) and inserts the ‘@node …’ string needed.
Inserts the string ‘@samp{}’ and puts the cursor between the braces.
Inserts the string ‘@var{}’, the cursor is put between the braces.
Inserts a pair of braces with the cursor between them.
Moves the cursor to the character after the next closing brace.
Major mode for editing Texinfo source files.
Evaluated when texinfo-mode
is invoked. The hook text-mode-hook
is evaluated first.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The editing modes described in the previous section were “Major modes”,
each mode was designed for a particular class of file. Minor modes work on
top of the major modes, each minor mode provides a single extra feature for
editing the buffer they are used in. For example overwrite-mode
is a
minor mode which makes any keys you type overwrite the character beneath
the cursor, instead of inserting themselves before the cursor.
The names of the minor modes currently active in the current buffer are displayed in the status line, to the right of the name of the major mode.
1.14.1 Overwrite mode | Typed characters overwrite the character beneath them. | |
1.14.2 Fill mode | Automatically break long lines as they are typed. | |
1.14.3 Auto-Save mode | How to disable auto-saving of a buffer. | |
1.14.4 Latin-1 mode | Displaying European characters. |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When enabled, characters typed replace the existing character under the cursor instead of just moving it to the right.
The command to toggle this mode on and off is Meta-x overwrite-mode.
Toggles overwriting character insertion in the current buffer.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Filling splits lines so that they aren’t longer than a certain number of
characters. The fill-mode
checks if you have passed this threshold
when you type the <SPC> key. Any words passed the threshold get moved
to the next line.
Sets the fill-column
variable (see below) to the cursor’s current
column position.
Toggles the auto-filling minor mode.
The maximum number of characters allowed in a single line. This is used by the filling and centring functions.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is not really a minor mode but it obeys the same calling conventions (i.e. calling its function toggles its action).
Toggles whether or not the current buffer is regularly saved to a temporary file.
For more details about auto-saving see Auto-Saving Files.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This minor mode toggles the display of characters in the Latin-1 character set, by default these characters are displayed as octal escape sequences.
This only works properly if the font that you are using defines glyphs for these characters!
Toggles the display of characters in the Latin-1 character set. This is a global setting.
For more information about what is displayed for each character see Character Images.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As you have probably realised, buffers are probably the most important part of the editor. Each file that is being edited must be stored in a buffer. They are not restricted to editing files though, all buffers are regarded as simply being a list of lines which can be displayed in a window and modified as needed.
This means that they are very flexible, for example, the Lisp debugger uses a buffer for its user interface, the Info reader uses two buffers – one to display the current node, the other to store the file’s tag table (never displayed, just used to look up the position of nodes).
Each buffer has a name, generally buffers which contain proper files use the base part of the filename, while buffers which don’t correspond to files use a word which starts and ends with asterisks (i.e. ‘*jade*’).
Each window can display one buffer at any one time. There is no restriction on the number of windows which may display the same buffer at once.
1.15.1 Displaying Buffers | How to make a window display a buffer | |
1.15.2 Deleting Buffers | Killing unwanted buffers | |
1.15.3 Other Buffer Commands | General buffer manipulation | |
1.15.4 The Buffer Menu | Interactive buffer manipulation |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are two main commands for switching to a different buffer,
Prompt for the name of a buffer and display it in the current window.
In a different window (opens a new window if there is currently only one) prompt for the name of a buffer and display it in that window.
Both commands are very similar, the Ctrl-x 4 b variant simply invokes a command to switch to a different window before calling the Ctrl-x b command.
When typing the name of the new buffer you can use the prompt’s completion mechanism to expand abbreviations (see see section The Buffer Prompt). If you just press <RET> with an empty prompt the default choice will be used. This will be the the buffer that was being shown in this window before the current buffer was selected (its name is displayed in the prompt’s title).
The Ctrl-x Ctrl-f command and its variants also switch buffers since they look for an existing copy of the file in a buffer before loading it from disk, see Commands To Load Files.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There is no real need to delete buffers, those that haven’t been used for a while just hang around at the end of the list. If you’re short on memory though it can help to kill some of the unused buffers which you have accumulated.
The command to kill a buffer is,
Prompts for the name of a buffer (with completion) then deletes that buffer (if the buffer contains unsaved modifications you are asked if you really want to lose them). It is removed from all window’s buffer-lists and any window which is displaying it is switched to another buffer (the next in its list).
Any marks which point to the buffer are made “non-resident” (that is, they point to the name of the file in the buffer) and the buffer is discarded.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Rotates the current window’s list of buffers.
Restores the contents of the current buffer to the contents of the file that it was loaded from, if an auto-save file exists you are asked if you want to revert to that instead.
Ask whether to save any modified buffers that exist.
Deletes the contents of the current buffer. Beware, you won’t be warned if you’re about to lose any unsaved modifications!
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The buffer menu presents you with a list of all the buffers accessible from the current window in most-recently-used order. You are then able to manipulate the buffer list using several simple commands.
Enters the buffer menu; the buffer ‘*Buffer Menu*’ is selected and a list of available buffers is printed in it.
The following example shows how the buffer list is printed.
MR Name Mode File -- ---- ---- ---- - *Buffer Menu* Buffer Menu + user.texi Texinfo man/user.texi *jade* Lisp
The column headed ‘M’ shows whether the buffer has been modified since it was last saved and the column ‘R’ shows whether or not the buffer is read-only. The other columns should be self-explanatory.
When the ‘*Buffer Menu*’ buffer is selected the following commands are available. When a single buffer is to be manipulated by a command, the buffer described by the line which the cursor is on is chosen.
Mark the buffer for deletion and move to the next buffer. A ‘D’ is displayed in the first column of a line if that buffer is marked for deletion.
Mark the buffer to be saved then move to the next buffer in the list. A ‘S’ in the second column of a line denotes a buffer which has been marked to be saved.
Execute previously-marked saves and deletions.
Unmark the current line (i.e. clear any ‘D’ or ‘S’ markers) then move to the next entry in the buffer list.
Toggle the modified flag of the current line’s buffer, then move down.
Toggle the read-only status of the current line’s buffer, then move to the next entry.
Select the current line’s buffer in this window.
Select the current line’s buffer in the other window.
Move to the next line in the buffer list.
Move to the previous line in the buffer list.
Redraw the buffer list, incorporating any changes made to the available buffers.
Quit the buffer menu.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Windows have two main functions: to display the contents of buffers (but only one buffer at a time) and to collect input from you, the user.
The editor must have at least one window open at all times, when you close the last window Jade will exit, there is no limit to the number of windows which you may have open at once.
Each window is split into two parts, they are
This is the largest part of the window, it is where the buffer that this window is displaying is drawn.
A single line of text associated with the window, under X11 this is the area of the beneath the horizontal line at the bottom of the window, on the Amiga it is the title of the window. The status line is normally used to display information about this window and what it is displaying, it has this format,
buffer-name (mode-names) (col,row) n line(s) [flags]
Where the individual parts mean,
The name of the buffer being edited, it can have either a ‘+’ or a ‘-’ appended to it, a plus means the buffer has been modified since it was saved, a minus means that the buffer is read-only.
This tells you which editing modes are being used by this buffer, the first word is the name of the major mode, any subsequent words correspond to the names of the minor modes for this buffer. If this section is surrounded by square brackets ‘[…]’ instead of parentheses it means that you are currently in a recursive edit, for example, inside the Lisp debugger.
The column that the cursor is at.
The row number of the cursor.
The number of lines in this buffer
General one-character flags related to the status of the window and its buffer.
Each window maintains a list of all buffers which are available for
displaying, this is kept in order, from the most recently used to the
least. This list (called buffer-list
) is used by some of the buffer
manipulation commands when they are working out which buffer should be
displayed.
1.16.1 Creating Windows | Opening a new window | |
1.16.2 Killing Windows | How to close windows | |
1.16.3 Other Window Commands | General window manipulation |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Opens a new window, it will have the most of the attributes that the current window does, things like: size, buffer, font, etc… If you are using X11 you will probably have to use your mouse to select its position, depending on the window manager you use, on the Amiga it will be created at the same position as the current window.
In a different window, one will be created if only one window is open, find a file, for more details see Commands To Load Files.
In a different window add an entry to a change-log file. See section Keeping ChangeLogs.
In a different window, choose a buffer to display, similar to the Ctrl-x b command. See section Displaying Buffers.
Enter the help system in a different window. See section The Help System.
Enter the Info browser in a different window. See section Info Mode.
Display the next error (or whatever) in the *compilation*
buffer in
a different window. See section Finding Errors.
Note that for each Ctrl-x 4 command there is a corresponding Ctrl-x 5 command. Instead of using a different window to the current one, a new window is opened for each Ctrl-x 5 command typed.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Close the current window, if it is the last window that the editor has open it will exit (after asking you if you wish to lose any unsaved modifications to buffers).
Close all windows except the current one.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Activate the next window of the editor’s. Under X11 this involves warping the mouse-pointer to the top left corner of the newly activated window.
Choose a font to use in the current window. This command prompts for the name of the font then installs it in the window. Font names are the same as for the shell argument ‘-font’ (@pxref{Startup Options}).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are two different styles of prompt that the editor uses when it wants you to enter a string.
1.17.1 The Simple Prompt | The prompt at the bottom of the window | |
1.17.2 The Buffer Prompt | Prompt with its own buffer and completion |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The simplest prompt uses the the bottom-most line in the window, it prints the prompt’s title on the left hand side, you should type your response and then press the <RET> key. This prompt is very primitive, the only special commands that it has are,
Delete the previous character.
Replace the contents of the prompt with the last string entered. When you type <Up> or <Down> again the original contents are restored.
Cancel the prompt.
All other keys are simply printed in the prompt — whatever they are.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This type of prompt is more sophisticated. It creates a new buffer for
you to type your response into (called *prompt*
), the title of the
prompt is displayed in the buffer’s first line.
Normally you type the answer to the prompt into the buffer and then press the <RET> key. All normal editor commands are available while you are using the prompt, you can switch buffers, load new files, whatever you like.
Another advantage of this type of prompt is that it supports completion, this allows you to type the beginning of your response then press the <TAB> key. What you have typed will be matched against the list of responses that the editor has (i.e. when being prompted for the name of a file it will be matched against all available files), if a unique match is found your response will be completed to that match.
If several potential completions are found, these will be displayed after
the line ::Completions::
in the buffer and your response will only
be completed as far as the potential completions are similar. For example,
if you enter ‘fo’ then press <TAB> and files called ‘foo’ and
‘foobar’ exist, the contents of the prompt will become ‘foo’.
Completion is provided for many different things, some are: files, buffers, symbols, functions, variables, Info nodes, etc…
The special commands for this type of prompt are,
Complete the contents of the prompt. If more than one potential completion exists they are printed in the buffer.
Enter the result of this prompt. If you invoke this command while the cursor is
on a printed potential completion (those under the ::Completions::
line) the whole line will be entered. Otherwise, just the text to the left
of the cursor is entered.
Print all possible completions of the current prompt but do not try to actually change the contents of the prompt.
Cancel the prompt.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Marks are used to record a position in a file, as the file’s buffer is modified so does the position that the mark points to — a mark will keep pointing at the same character no matter what happens (unless the character is deleted!).
The other good thing about marks is that they point to files not buffers. This means that you can set a mark in a buffer, delete the buffer and then move to the position of the mark, the file will be reloaded and the cursor will point at the original character.
Normally there are three user-accessible marks (2) and one special
auto-mark
which is used, amongst other things, to record the “previous”
position of the cursor, allowing you to retrace your last major step.
The commands available on marks are,
Move to the mark #1, #2 or #3, depending on which function key is pressed (<F1> means mark #1, etc…). If the file pointed to is not in memory it will be loaded into a new buffer.
Set the position of mark #1, #2 or #3, depending on the function key.
Swap the positions of the cursor and the auto-mark
.
Set the position of the auto-mark
.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is often useful to be able to tell Jade to quit whatever it is doing and wait for more commands; this is called interrupting Jade. When the editor receives an interrupt signal it will abort what it is doing and rewind itself back to the inner-most recursive edit (see see section Recursive Editing).
The interrupt signal differs with the operating system being used,
SIGINT
signal is used, this can be sent via
the intr
character (get the editor into the foreground of the
shell it was started from and type Ctrl-c in the shell’s terminal),
or directly through the kill
shell command. For example, look at
the following shell session extract,
/var/src/jade/man$ ps PID TT STAT TIME COMMAND 60 1 SW 0:02 (xinit) 87 1 S 0:08 fvwm 127 p0 S 0:00 /bin/bash 155 p0 S 0:04 jade 156 p1 S 0:00 /bin/bash 159 p1 R 0:00 ps /var/src/jade/man$ kill -INT 155
First the ps
command is used to find the Jade process’ pid (155),
then the kill
command is used to send the INT
signal
to this process.
break
(or possibly breaktask
) command to send the signal.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Recursive editing is the act of editing a file while the current
command is still being evaluated. For example, when using the
query-replace
command (Meta-%) the Ctrl-r command
enters a recursive edit to let you edit the buffer, even though you
are still doing a query-replace (which will be resumed when the recursive
edit finishes).
As the name suggests a recursive edit calls the editor’s main command loop recursively from within a command. Any number of recursive edits may be stacked up and then unwound back to the top-level of the editor.
When a recursive edit is in progress the name of the mode being used to edit the buffer is shown in square brackets, not parentheses as in the top-level instance.
The commands for manipulating recursive edits are as follows,
Exit the innermost recursive edit, this has no effect at the top-level.
Return to the outermost edit — the top-level. This is useful when you get “lost” inside a sequence of recursive edits.
Enter a new recursive edit; this command is usually best avoided to save confusion.
In general, recursive editing is rarely used except in unavoidable circumstances (i.e. in the Lisp debugger).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In general any character can be mapped to any sequence of up to four character sized images (called glyphs) when it is drawn into a window. The TAB character is a notable exception; it expands to as many spaces as are needed to fill up to the next tab stop.
By default, the editor is set up to display the following,
A caret (‘^’) followed by the ASCII value of the character exclusive-or’d with 0x40, i.e. ‘^@’ to ‘^_’.
Printed literally, this includes all “normal” characters and punctuation.
‘^?’
Represented by the octal escape sequence (i.e. ‘\200’) for that character’s numeric value.
If you want to edit files containing characters in the Latin1
character
set (numerically, from 160 to 255) you can put the following in your
‘.jaderc’ file,
(latin-1-mode)
this will redefine the necessary characters.
If you want more details about this sort of thing see @ref{Glyph Tables}.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Normally you will only have one instance of Jade executing at a single
time. Often though, another program will want you to edit a file, for
example when you are composing a mail message. There is normally a way
to specify which editor you want to use, for example the EDITOR
environment variable.
If you were to ask to edit the file in jade
an additional
process executing Jade would be started, totally separate from the
original. It is possible to use the original instance.
Firstly Jade must be set up to listen for clients wanting files edited,
this is done with the server-open
command. You can either put
this in your ‘.jaderc’ file (with a line like ‘(server-open)’)
or call it manually with the command Meta-x server-open.
Only one instance of Jade may be a server at once. If you know that there is no other Jade running but it still won’t let you open a server, and you are running on Unix, look for a dead socket called ‘~/.Jade_rendezvous’ and delete it if necessary.
Once the editor is listening for client messages the separate program
jadeclient
may be used to load files into the server from an
external source. The format of jadeclient
invocation is,
jadeclient [+line-number] file-name …
When invoked, it will ask the server to edit each file-name (initially positioned at line line-number) in turn, exiting only after each file has finished being edited.
If when the jadeclient
program is invoked their is no server open
(i.e. either Jade is not running or you haven’t used the server-open
function) a message ‘Jade not running, waiting...’ will be printed
and jadeclient
will sit waiting for you to open a Jade server.
So, simply get the program you want to use Jade to use the jadeclient
program as its editor. For example, I use mh
to handle my electronic
mail; in my ‘~/.mh_profile’ file I have the line,
Editor: jadeclient
to tell it that I want to edit my mail in Jade.
The one special command for client/server editing is,
If the file being edited in the current buffer is a client file, tell the client program which loaded it that it has finished being edited. The actual buffer is not deleted.
It is also possible to finish editing a client file by simple deleting its buffer in the normal way (Ctrl-x k), Deleting Buffers.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade has a number of features to help you develop programs, foremost is the ability to run a compilation inside one of the editor’s buffers. Unfortunately, this is only possible when using the Unix operating system at the present.
Once the compilation has finished you can then step through each error produced.
1.23.1 Running a Compilation | Launching a compilation process | |
1.23.2 Finding Errors | Stepping through compile errors | |
1.23.3 Debugging Programs | Using GDB in an editor buffer | |
1.23.4 Using Grep | Searching files for a regexp | |
1.23.5 Keeping ChangeLogs | Simple recording of file revisions |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The command to run a shell command in a buffer is,
Prompts you for the command to execute, with a default of the last command
you ran (starts as ‘make’). A shell process is created which runs
asynchronously to the editor in the same directory as the current buffer’s
file was loaded from. The buffer *compilation*
is selected and this
is where all output from the program is printed.
When the process finishes running a message is printed in the
*compilation*
buffer telling you its exit-code.
Only one process may be run with the compile
function at once.
This command is not available on the Amiga version yet.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When you have compiled something with the Meta-x compile command it is possible to step through each of the errors that it produces. To do this use the command,
Displays the next error in the *compilation*
buffer. The file that
is in is loaded (if necessary) and the line with the error is found.
If you edit a file which has errors in it, then try to find the next error (which is in the same file) everything will still work. The positions of errors are updated as the buffers are modified.
The only exception to this is when you invoke the next-error
function
while the *compilation*
buffer is still being written to. If more
errors are produced in a file which has been modified since the compilation
started it is likely that the positions will get out of sync.
By default, the next-error
function understands the type of error
output that gcc
produces. This is of the form,
file:line-number:description
It is possible to use other formats though, the variables which control this are,
Regular expression to match a line containing an error. For gcc
this
is ‘^(.*):([0-9]+):(.+)’.
Expansion template to produce the name of the file with the error, using
compile-error-regexp
and the line containing the error. By default
this is ‘\1’.
Similar to compile-file-expand
except that it expands to a string
defining the number of the line with the error. By default, ‘\2’.
Similar to compile-file-expand
, but produces the description of the
error. By default, ‘\3’.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jade allows you to run the GDB debugger in a buffer. Some of the advantages of this over the usual terminal based interaction are,
To start a gdb subprocess use the Meta-x gdb command, you will be asked to enter the name of the program to debug then gdb will be started in a new buffer (called ‘*gdb*’ or similar). You are then able to type commands into the buffer, they will be sent to gdb each time you type the <RET> key.
The commands for controlling the gdb subprocess are as follows (the
Ctrl-c prefixed commands are only available within the
*gdb*
buffer whereas the Ctrl-x Ctrl-a variations are
accessible globally so that they can be invoked from within the target’s
source files),
Continue execution to the next source line, this is the gdb command
next
.
Continue execution until a different source line is reached, this is
the gdb command step
.
Continue running until the current stack frame exits, the finish
command.
Resume execution until a breakpoint is reached or the target exits.
Display the stack frame above the current one.
Display the stack frame under the current one.
Set a breakpoint at the current source line, if the *gdb*
buffer
is active the line selected is where the program last stopped.
Set a temporary breakpoint at the current source line.
Remove all breakpoints which are set at the current source line.
Redisplay the current frame, centring it in its window.
For a summary of these commands type Ctrl-h m in the *gdb*
buffer.
Since the gdb process runs on top of the Shell mode the bindings from that mode are also available.
There is no limit to the number of gdb processes you may run at once, each will get its own buffer. When a gdb command is invoked in a buffer which doesn’t have a gdb subprocess (i.e. a source file’s buffer) the command will be sent to the gdb process which either was last sent a command, or last made the editor display a new frame. Hopefully this will work fairly intuitively.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is often very useful to grep through a set of files looking for a
regular expression, this is what the grep
command does. With Jade
it is possible to run an external grep
program in the
*compilation*
buffer. This then enables you to step through each
grep hit using the Ctrl-x ` command, Finding Errors.
The commands to use grep are,
Prompt for a string of arguments to give grep
, you do not need to
provide the name of the program, or the ‘-n’ switch, this is done
automatically. The shell will do any filename-globbing on the arguments
so it is advisable to surround the regular expression with single quotes.
Note that the regular expression syntax will be different to that which Jade uses. Also this command won’t work on an Amiga.
This command provides a method for scanning the current buffer for all lines matching a regular expression (which you are prompted for). It is written entirely in Lisp — this means that the normal regular expression syntax is needed and it will work on an Amiga.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A ChangeLog is a file (usually called ‘ChangeLog’) which keeps a log of all changes you have made to the files in its directory. For example, the ‘src/ChangeLog’ file for Jade keeps a list of changes made to the editor’s source code.
There is no magic involved, you simply use a command to add a new entry to a directory’s log after modifying a file in that directory. You then have to enter a summary of the changes that you made.
The command to do this is,
Prompts for the name of a directory then lets you type a description of the changes you have made.
If you enter more than one change in the same day (and from the same host) the same heading will be used. The heading consists of the time and date, your name, your login and the name of the host you’re on. (3)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Despite the name of this section there is actually no such thing as the
info-mode
. The Lisp file ‘info.jl’ is what this section
documents — it is a set of Lisp functions which make a buffer (the
‘*Info*’ buffer) into a simple browser for Info files(4).
To invoke it type Ctrl-h i, the ‘*Info*’ buffer will be selected showing the ‘(dir)’ node (the root of the Info documentation tree).
When in the ‘*Info*’ buffer the following key bindings are available.
Displays the next page of the current node.
Displays the previous page.
Move to the specified menu-item (1 means the first, etc) in the menu in this node. The keys 1 to 9 work in this way.
Move to the beginning of the current node.
Display the directory node (‘(dir)’) of the Info documentation tree.
Follow a reference, the one under the cursor if one exists.
Prompt for the name of a node and try to display it.
Display the Info tutorial node (‘(info)Help’).
Go back to the last node that was displayed before this one.
Prompts for a menu-item (the one on the same line as the cursor is the default) and display the node it points to.
Display the next node.
Display the previous node.
Display the node “above” this one.
Quit the Info browser.
Display a piece of text describing all commands available in Info mode.
Go to the link (menu item or xref) described on the current line.
Go to the link you double clicked on.
Put the cursor on the next link in this node.
Put the cursor on the previous link.
This mode has a number of disadvantages over the other Info browsers
available (i.e. the stand-alone info
program, or Emacs’ Info viewer):
*
node name.
makeinfo
formatted files work properly though.
Of course, its main advantage is that it runs in Jade!
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When running on a Unix-style operating system Jade allows you to run a shell subprocess in a buffer (usually the ‘*shell*’ buffer). Each line you type in the buffer is sent to the shell and the output from the shell is displayed in the buffer.
Start a new shell subprocess running in a buffer called ‘*shell*’.
If a buffer ‘*shell*’ already exists a new buffer with a unique name will be opened (i.e. ‘*shell*<2>’).
The working directory of the shell subprocess will be the directory which the contents of the current buffer was read from.
This command won’t work on Amigas!
Each ‘*shell*’ buffer installs the major mode shell-mode
.
This provides the following commands.
Move the cursor to the beginning of the current line, after the prompt which the shell printed (if one exists).
If the cursor is at the end of the buffer send the shell process the
eof
character (‘^D’) (signifying the end of the file).
Otherwise delete the character under the cursor.
Send the current line to the shell (minus any prompt at the beginning of the line). If the cursor is not on the last line of the buffer (i.e. the most recent prompt) the current line is copied to the end of the buffer before being sent.
Move the cursor to the next prompt in the buffer.
Move to the previous prompt.
Send the intr
character (‘^C’) to the shell process.
Send the eof
character (‘^D’) to the shell.
Send the susp
character (‘^Z’) to the shell.
Send the quit
character (‘^\’) to the shell.
This hook is evaluated by the Shell mode after it has initialised itself (and started its subprocess).
The following variables customise the actions of the Shell mode.
This variable defines the file name of the shell to run. Its default
value is either the value of the environment variable SHELL
or
if that doesn’t exist the file ‘/bin/sh’.
When this variable’s value is non-nil
the <RET> command always
sends the whole of the current line (minus any prompt) even when the
cursor is not at the end of the line. Otherwise only the part of the
line before the cursor is sent.
The default value of this variable is t
.
This buffer-local variable defines the regular expression used to match the prompt printed by the shell each time it waits for you to enter a shell command. By default it has the value ‘^[^]#$%>)]*[]#$%>)] *’ but this may be incorrect if you have modified your shell’s prompt.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The best way to tailor the editor to your own requirements is with your personal startup file. This is called ‘.jaderc’ in your home directory (5), it is a file of Lisp forms evaluated when Jade initialises itself.
Usually, setting the values of variables in your startup file is enough
to configure Jade how you want, the Lisp function to set a variable is called
setq
, it’s first argument is the name of the variable, it’s second the
value you wish to set it to. This value will usually be one of the following
data types,
"xyz"
A string ‘xyz’.
123
0173
0x7b
A number, all of the above have the value 123 (in decimal, octal and hexadecimal).
nil
t
A boolean value, nil
means false, or not true. t
is the
opposite (in fact, any value not nil
is true).
My ‘.jaderc’ file looks something like this (note that semicolons introduce comments),
;;;; .jaderc -*-Lisp-*- ;; Size of tabs for Lisp source is 2 (setq lisp-body-indent 2) ;; When on an Amiga, flag that I don't want pull down menus (when (amiga-p) (setq amiga-no-menus t)) ;; When editing English-text use auto-filling (add-hook 'text-mode-hook 'fill-mode-on) ;; -with a maximum of 74 characters in a line (setq fill-column 74) ;; Start the edit server (server-open)
Most simple customisations can be achieved by simply giving a variable
a new value. Use the setq
special form to do this (a special
form is a type of function) as in the examples above. If you wish to
set variables interactively use the set
command:
Meta-x set <RET> variable-name <RET> new-value <RET>.
The add-hook
function adds a function (in this case fill-mode-on
)
to be called when the specified hook (in this case text-mode-hook
)
is evaluated. The single-quote before the names means that the names are
passed as constants; not their values. If you don’t quite understand
what I’m talking about don’t worry.
For full documentation of Jade’s programming language see @ref{Programming Jade}.
[Top] | [Contents] | [Index] | [ ? ] |
When using an Amiga, unit zero
of the clipboard.device
is used. For X11, the first cut-buffer.
There is no reason why you can’t have more, the editor sets no limitation on the number of marks available. This is just how I have set the editor up.
On the
Amiga there is no way to get these details. So, Jade looks for some
environment variables, USERNAME
for the login name, HOSTNAME
for the name of the host and REALNAME
for your actual name.
Info
is the GNU way of creating hypertext documents, for more information see
(info)Info.
On the Amiga, your home directory is defined as the contents of the
environment variable HOME
.
[Top] | [Contents] | [Index] | [ ? ] |
This document was generated on September 19, 2022 using texi2html 5.0.
The buttons in the navigation panels have the following meaning:
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ << ] | FastBack | Beginning of this chapter or previous chapter | 1 |
[ < ] | Back | Previous section in reading order | 1.2.2 |
[ Up ] | Up | Up section | 1.2 |
[ > ] | Forward | Next section in reading order | 1.2.4 |
[ >> ] | FastForward | Next chapter | 2 |
[Top] | Top | Cover (top) of document | |
[Contents] | Contents | Table of contents | |
[Index] | Index | Index | |
[ ? ] | About | About (help) |
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
This document was generated on September 19, 2022 using texi2html 5.0.