<< Prev | - Up - | Next >> |
The commands in this chapter assist in editing Oz code. To achieve this, many of these are aware of the lexical or syntactical structure of Oz programs.
The Oz modes offer commands for creating new interactive buffers and quickly switching between Oz buffers:
oz-new-buffer
(C-. n) [command]Create a new buffer using the Oz major mode. Note that this buffer has no associated file name, so quitting Emacs will kill it without warning.
oz-next-buffer
(M-n) [command]oz-previous-buffer
(M-p) [command]Switch to the previous resp. next buffer in the buffer list that runs in an Oz mode. If no such buffer exists, an error is signalled.
The preferred indentation style can currently be customized through the following user option:
oz-indent-chars
(default: 3
) [user option]Number of columns that statements are indented w. r. t. the block containing them.
Several commands assist in formatting existing Oz code.
oz-indent-line
&optional
COUNT
(TAB) [command]Reindent the current line. If COUNT
is given, reindent that many lines above and below point as well.
oz-indent-region
[command]Reindent all lines at least partly covered by the current region.
oz-indent-buffer
[command]Reindent every line in the buffer.
indent-oz-expr
(M-C-q) [command]Reindent all lines at least partly covered by the Oz expression following point. For a description of what constitutes an Oz expression, see Section 3.5.
The following command assists in authoring Oz code.
oz-electric-terminate-line
(RET) [command]Terminate the current line, i. e., delete all whitespace around point and break the line. If the user option oz-auto-indent
is non-nil
, indent both lines.
oz-auto-indent
(default: t
) [user option]See oz-electric-terminate-line
.
Additionally, DEL is bound to the Emacs command backward-delete-char-untabify
.
Fontification is the term used in Emacs for displaying text in different font faces, depending on its syntactical form and context, to ease reading of code. For example, comments and strings may be displayed in different colours.
Many major modes in Emacs provide several levels of fontification with increasing use of faces, but also increasing resource consumption. In the Oz modes, there are three levels. You can select one using the font-lock-maximum-decoration
user option, e. g., add the following line to your .emacs
:
(setq font-lock-maximum-decoration 3)
The default level depends on your version of Emacs.
The following user option controls automatic fontification in the OPI.
oz-want-font-lock
(default: t
) [user option]If non-nil
, automatically invoke font-lock-mode
when any of the Oz modes is activated. If you prefer to control this via global-font-lock-mode
, you can set this to nil
.
You might like the following user option and command if you care about superfluous (usually invisible) spaces:
oz-pedantic-spaces
(default: nil
) [user option]If non-nil, highlight ill-placed whitespace. Note that this user option must be set before the oz
library is loaded.
oz-space-face
[face]The face in which ill-placed whitespace is highlighted.
oz-remove-annoying-spaces
[command]Remove all ill-placed whitespace from the current buffer. This is all the whitespace that is highlighted in oz-space-face
.
oz-fill-paragraph
&optional
JUSTIFY
[command]Like the fill-paragraph
command, but handles Oz comments. If any of the current line is a comment, fill the comment or the paragraph of it that point is in, preserving the comment's indentation and initial percent signs. The buffer-local variable fill-paragraph-function
is bound to this command, so it will also be invoked by M-x fill-paragraph (M-q).
oz-comment-region
START
END
&optional
ARG
[command]Comment or uncomment each line in the region. With just C-u as prefix argument, uncomment each line in region. A numeric prefix argument ARG
means use ARG
comment characters. If ARG
is negative, delete that many comment characters instead. Blank lines do not get comments.
oz-uncomment-region
START
END
&optional
ARG
[command]Comment or uncomment each line in the region. See the oz-comment-region
command for more information; note that the prefix argument is negated though.
In this section, we use the term Oz definition to stand for the text from a proc
, fun
, class
or meth
keyword up to its matching end
. Also, we use the term Oz expression to stand for the text corresponding to either a bracketed Oz construct (such as proc
... end
or local
... end
) or a single word.
forward-oz-expr
&optional
COUNT
(M-C-f) [command]Move point forward by one balanced Oz expression. With COUNT
, do it that many times. Negative COUNT
means backwards.
backward-oz-expr
&optional
COUNT
(M-C-b) [command] Move point backward by one balanced Oz expression. With COUNT
, do it that many times. COUNT
must be positive.
mark-oz-expr
COUNT
(M-C-@, M-C-SPC) [command] Set mark COUNT
balanced Oz expressions from point. The place mark goes to is the same place the forward-oz-expr
command would move to with the same argument.
transpose-oz-exprs
ARG
(M-C-t) [command]Like the transpose-words
command (M-t) but applies to balanced Oz expressions. Caveat: This might not produce nice results in all cases.
kill-oz-expr
COUNT
(M-C-k) [command] Kill the balanced Oz expression following point. With COUNT
, kill that many Oz expressions after point. Negative COUNT
means kill -
COUNT
Oz expressions before point.
backward-kill-oz-expr
COUNT
(M-C-DEL 1) [command]Kill the balanced Oz expression preceding point. With COUNT
, kill that many Oz expressions before point. Negative COUNT
means kill -
COUNT
Oz expressions after point.
oz-beginning-of-defun
(M-C-a) [command]Move point to the start of the Oz definition it is in. If point is not inside an Oz definition, move to start of buffer. Returns t
unless search stops due to beginning or end of buffer.
oz-end-of-defun
(M-C-e) [command]Move point to the end of the Oz definition it is in. If point is not inside an Oz definition, move to end of buffer.
<< Prev | - Up - | Next >> |