Mercurial > hg > octave-lyh
annotate doc/interpreter/emacs.txi @ 17289:bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Macro handles options ("on") or properties ("position") more elegantly
than @code{"text"}.
* doc/interpreter/macros.texi: Add new @qcode macro.
* doc/interpreter/tips.txi: Add documentation about @qcode macro.
* doc/interpreter/basics.txi, doc/interpreter/container.txi,
doc/interpreter/emacs.txi, doc/interpreter/errors.txi,
doc/interpreter/eval.txi, doc/interpreter/expr.txi,
doc/interpreter/external.txi, doc/interpreter/func.txi,
doc/interpreter/grammar.txi, doc/interpreter/image.txi,
doc/interpreter/install.txi, doc/interpreter/interp.txi,
doc/interpreter/io.txi, doc/interpreter/matrix.txi,
doc/interpreter/numbers.txi, doc/interpreter/oop.txi,
doc/interpreter/package.txi, doc/interpreter/plot.txi,
doc/interpreter/quad.txi, doc/interpreter/sparse.txi,
doc/interpreter/strings.txi, doc/interpreter/system.txi,
doc/interpreter/vectorize.txi, libinterp/corefcn/balance.cc,
libinterp/corefcn/bitfcns.cc, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/conv2.cc, libinterp/corefcn/data.cc,
libinterp/corefcn/debug.cc, libinterp/corefcn/defaults.cc,
libinterp/corefcn/dirfns.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/error.cc, libinterp/corefcn/file-io.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/graphics.cc, libinterp/corefcn/help.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lu.cc,
libinterp/corefcn/luinc.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/oct-hist.cc, libinterp/corefcn/pager.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/qz.cc, libinterp/corefcn/rand.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/str2double.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/symtab.cc,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/toplev.cc,
libinterp/corefcn/tril.cc, libinterp/corefcn/typecast.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc,
libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/parse-tree/oct-parse.in.yy,
libinterp/parse-tree/pt-binop.cc, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-mat.cc, scripts/@ftp/ftp.m,
scripts/deprecated/java_convert_matrix.m, scripts/deprecated/java_debug.m,
scripts/deprecated/java_unsigned_conversion.m, scripts/deprecated/shell_cmd.m,
scripts/general/dblquad.m, scripts/general/display.m,
scripts/general/genvarname.m, scripts/general/idivide.m,
scripts/general/interp1.m, scripts/general/interp2.m,
scripts/general/interp3.m, scripts/general/interpn.m, scripts/general/isa.m,
scripts/general/profexplore.m, scripts/general/profile.m,
scripts/general/quadgk.m, scripts/general/randi.m, scripts/general/structfun.m,
scripts/general/subsindex.m, scripts/general/triplequad.m,
scripts/geometry/griddata.m, scripts/geometry/griddata3.m,
scripts/geometry/griddatan.m, scripts/geometry/voronoi.m, scripts/help/help.m,
scripts/help/lookfor.m, scripts/image/cmpermute.m, scripts/image/colormap.m,
scripts/image/image.m, scripts/image/imagesc.m, scripts/image/imfinfo.m,
scripts/image/imformats.m, scripts/image/imread.m, scripts/image/imshow.m,
scripts/image/imwrite.m, scripts/image/ind2gray.m, scripts/image/lines.m,
scripts/image/rgb2ind.m, scripts/image/spinmap.m, scripts/io/dlmwrite.m,
scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m,
scripts/java/javaclasspath.m, scripts/java/usejava.m,
scripts/miscellaneous/bzip2.m, scripts/miscellaneous/computer.m,
scripts/miscellaneous/copyfile.m, scripts/miscellaneous/debug.m,
scripts/miscellaneous/dos.m, scripts/miscellaneous/edit.m,
scripts/miscellaneous/gzip.m, scripts/miscellaneous/license.m,
scripts/miscellaneous/mkoctfile.m, scripts/miscellaneous/movefile.m,
scripts/miscellaneous/parseparams.m, scripts/miscellaneous/unix.m,
scripts/optimization/fminbnd.m, scripts/optimization/fminsearch.m,
scripts/optimization/fminunc.m, scripts/optimization/fsolve.m,
scripts/optimization/fzero.m, scripts/optimization/glpk.m,
scripts/optimization/lsqnonneg.m, scripts/optimization/optimset.m,
scripts/optimization/pqpnonneg.m, scripts/pkg/pkg.m, scripts/plot/allchild.m,
scripts/plot/ancestor.m, scripts/plot/area.m, scripts/plot/axis.m,
scripts/plot/bar.m, scripts/plot/barh.m, scripts/plot/box.m,
scripts/plot/caxis.m, scripts/plot/cla.m, scripts/plot/clabel.m,
scripts/plot/clf.m, scripts/plot/close.m, scripts/plot/colorbar.m,
scripts/plot/daspect.m, scripts/plot/ezmesh.m, scripts/plot/ezmeshc.m,
scripts/plot/ezsurf.m, scripts/plot/ezsurfc.m, scripts/plot/findall.m,
scripts/plot/findobj.m, scripts/plot/gcbo.m, scripts/plot/gcf.m,
scripts/plot/gco.m, scripts/plot/grid.m, scripts/plot/guihandles.m,
scripts/plot/hdl2struct.m, scripts/plot/hidden.m, scripts/plot/hold.m,
scripts/plot/isonormals.m, scripts/plot/isosurface.m, scripts/plot/legend.m,
scripts/plot/mesh.m, scripts/plot/meshc.m, scripts/plot/meshz.m,
scripts/plot/newplot.m, scripts/plot/orient.m, scripts/plot/pareto.m,
scripts/plot/patch.m, scripts/plot/pbaspect.m, scripts/plot/pcolor.m,
scripts/plot/plot.m, scripts/plot/print.m,
scripts/plot/private/__add_default_menu__.m, scripts/plot/quiver.m,
scripts/plot/quiver3.m, scripts/plot/refreshdata.m, scripts/plot/saveas.m,
scripts/plot/scatter.m, scripts/plot/scatter3.m, scripts/plot/shading.m,
scripts/plot/shrinkfaces.m, scripts/plot/slice.m, scripts/plot/stem.m,
scripts/plot/stem3.m, scripts/plot/struct2hdl.m, scripts/plot/subplot.m,
scripts/plot/surf.m, scripts/plot/surfc.m, scripts/plot/surfl.m,
scripts/plot/tetramesh.m, scripts/plot/uigetfile.m, scripts/plot/uimenu.m,
scripts/plot/uiputfile.m, scripts/plot/waterfall.m, scripts/plot/whitebg.m,
scripts/plot/xlim.m, scripts/plot/ylim.m, scripts/plot/zlim.m,
scripts/polynomial/conv.m, scripts/polynomial/polyout.m,
scripts/polynomial/splinefit.m, scripts/set/ismember.m, scripts/set/powerset.m,
scripts/set/setdiff.m, scripts/set/union.m, scripts/set/unique.m,
scripts/signal/detrend.m, scripts/signal/filter2.m, scripts/signal/freqz.m,
scripts/signal/periodogram.m, scripts/signal/spectral_adf.m,
scripts/signal/spectral_xdf.m, scripts/sparse/eigs.m, scripts/sparse/svds.m,
scripts/specfun/legendre.m, scripts/special-matrix/gallery.m,
scripts/statistics/base/mean.m, scripts/statistics/base/moment.m,
scripts/statistics/tests/cor_test.m,
scripts/statistics/tests/kolmogorov_smirnov_test.m,
scripts/statistics/tests/kolmogorov_smirnov_test_2.m,
scripts/statistics/tests/kruskal_wallis_test.m,
scripts/statistics/tests/prop_test_2.m, scripts/statistics/tests/sign_test.m,
scripts/statistics/tests/t_test.m, scripts/statistics/tests/t_test_2.m,
scripts/statistics/tests/t_test_regression.m,
scripts/statistics/tests/u_test.m, scripts/statistics/tests/var_test.m,
scripts/statistics/tests/welch_test.m,
scripts/statistics/tests/wilcoxon_test.m, scripts/statistics/tests/z_test.m,
scripts/statistics/tests/z_test_2.m, scripts/strings/base2dec.m,
scripts/strings/index.m, scripts/strings/isstrprop.m,
scripts/strings/mat2str.m, scripts/strings/regexptranslate.m,
scripts/strings/rindex.m, scripts/strings/str2num.m, scripts/strings/strcat.m,
scripts/strings/strjust.m, scripts/strings/strmatch.m,
scripts/strings/validatestring.m, scripts/testfun/demo.m,
scripts/testfun/example.m, scripts/testfun/test.m, scripts/time/addtodate.m,
scripts/time/asctime.m, scripts/time/datestr.m, scripts/time/datetick.m,
scripts/time/weekday.m, scripts/ui/errordlg.m, scripts/ui/helpdlg.m,
scripts/ui/inputdlg.m, scripts/ui/listdlg.m, scripts/ui/msgbox.m,
scripts/ui/questdlg.m, scripts/ui/warndlg.m: Use new @qcode macro.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 19 Aug 2013 20:46:38 -0700 |
parents | f2a8592b8fbd |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1 @c Copyright (C) 1996-2012 Kurt Hornik |
7018 | 2 @c |
3 @c This file is part of Octave. | |
4 @c | |
5 @c Octave is free software; you can redistribute it and/or modify it | |
6 @c under the terms of the GNU General Public License as published by the | |
7 @c Free Software Foundation; either version 3 of the License, or (at | |
8 @c your option) any later version. | |
9 @c | |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 @c for more details. | |
14 @c | |
15 @c You should have received a copy of the GNU General Public License | |
16 @c along with Octave; see the file COPYING. If not, see | |
17 @c <http://www.gnu.org/licenses/>. | |
18 | |
5428 | 19 @c Written by Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> on 1996/05/17. |
3294 | 20 @c Last updated by KH on 1997/07/31. |
21 | |
9032
349616d9c38e
Cleanup top-level documentation menu in octave.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
22 @node Emacs Octave Support |
3294 | 23 @appendix Emacs Octave Support |
24 | |
25 The development of Octave code can greatly be facilitated using Emacs | |
26 with Octave mode, a major mode for editing Octave files which can e.g.@: | |
27 automatically indent the code, do some of the typing (with Abbrev mode) | |
28 and show keywords, comments, strings, etc.@: in different faces (with | |
29 Font-lock mode on devices that support it). | |
30 | |
31 It is also possible to run Octave from within Emacs, either by directly | |
32 entering commands at the prompt in a buffer in Inferior Octave mode, or | |
33 by interacting with Octave from within a file with Octave code. This is | |
34 useful in particular for debugging Octave code. | |
35 | |
36 Finally, you can convince Octave to use the Emacs info reader for | |
37 @kbd{help -i}. | |
38 | |
39 All functionality is provided by the Emacs Lisp package EOS (for ``Emacs | |
40 Octave Support''). This chapter describes how to set up and use this | |
41 package. | |
42 | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
43 Please contact @email{Kurt.Hornik@@wu-wien.ac.at} if you have any questions |
3294 | 44 or suggestions on using EOS. |
45 | |
46 @menu | |
17160
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
14853
diff
changeset
|
47 * Installing EOS:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
14853
diff
changeset
|
48 * Using Octave Mode:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
14853
diff
changeset
|
49 * Running Octave from Within Emacs:: |
f2a8592b8fbd
doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents:
14853
diff
changeset
|
50 * Using the Emacs Info Reader for Octave:: |
3294 | 51 @end menu |
52 | |
4167 | 53 @node Installing EOS |
3294 | 54 @appendixsec Installing EOS |
55 | |
56 The Emacs package EOS consists of the three files @file{octave-mod.el}, | |
57 @file{octave-inf.el}, and @file{octave-hlp.el}. These files, or better | |
58 yet their byte-compiled versions, should be somewhere in your Emacs | |
59 load-path. | |
60 | |
61 If you have GNU Emacs with a version number at least as high as 19.35, | |
62 you are all set up, because EOS is respectively will be part of GNU | |
63 Emacs as of version 19.35. | |
64 | |
65 Otherwise, copy the three files from the @file{emacs} subdirectory of | |
66 the Octave distribution to a place where Emacs can find them (this | |
67 depends on how your Emacs was installed). Byte-compile them for speed | |
68 if you want. | |
69 | |
4167 | 70 @node Using Octave Mode |
3294 | 71 @appendixsec Using Octave Mode |
72 | |
73 If you are lucky, your sysadmins have already arranged everything so | |
74 that Emacs automatically goes into Octave mode whenever you visit an | |
75 Octave code file as characterized by its extension @file{.m}. If not, | |
76 proceed as follows. | |
77 | |
78 @enumerate | |
79 @item | |
80 To begin using Octave mode for all @file{.m} files you visit, add the | |
81 following lines to a file loaded by Emacs at startup time, typically | |
82 your @file{~/.emacs} file: | |
83 | |
84 @lisp | |
85 (autoload 'octave-mode "octave-mod" nil t) | |
86 (setq auto-mode-alist | |
87 (cons '("\\.m$" . octave-mode) auto-mode-alist)) | |
88 @end lisp | |
89 | |
90 @item | |
91 Finally, to turn on the abbrevs, auto-fill and font-lock features | |
92 automatically, also add the following lines to one of the Emacs startup | |
93 files: | |
94 @lisp | |
95 (add-hook 'octave-mode-hook | |
96 (lambda () | |
97 (abbrev-mode 1) | |
98 (auto-fill-mode 1) | |
99 (if (eq window-system 'x) | |
100 (font-lock-mode 1)))) | |
101 @end lisp | |
102 See the Emacs manual for more information about how to customize | |
103 Font-lock mode. | |
104 @end enumerate | |
105 | |
106 In Octave mode, the following special Emacs commands can be used in | |
107 addition to the standard Emacs commands. | |
108 | |
109 @table @kbd | |
110 @item C-h m | |
111 Describe the features of Octave mode. | |
112 | |
113 @item LFD | |
114 Reindent the current Octave line, insert a newline and indent the new | |
115 line (@code{octave-reindent-then-newline-and-indent}). An abbrev before | |
116 point is expanded if @code{abbrev-mode} is non-@code{nil}. | |
117 | |
118 @item TAB | |
119 Indents current Octave line based on its contents and on previous | |
120 lines (@code{indent-according-to-mode}). | |
121 | |
122 @item ; | |
123 Insert an ``electric'' semicolon (@code{octave-electric-semi}). If | |
124 @code{octave-auto-indent} is non-@code{nil}, reindent the current line. | |
125 If @code{octave-auto-newline} is non-@code{nil}, automagically insert a | |
126 newline and indent the new line. | |
127 | |
128 @item ` | |
129 Start entering an abbreviation (@code{octave-abbrev-start}). If Abbrev | |
130 mode is turned on, typing @kbd{`C-h} or @kbd{`?} lists all abbrevs. | |
131 Any other key combination is executed normally. Note that all Octave | |
132 abbrevs start with a grave accent. | |
133 | |
134 @item M-LFD | |
135 Break line at point and insert continuation marker and alignment | |
136 (@code{octave-split-line}). | |
137 | |
138 @item M-TAB | |
139 Perform completion on Octave symbol preceding point, comparing that | |
6501 | 140 symbol against Octave's reserved words and built-in variables |
3294 | 141 (@code{octave-complete-symbol}). |
142 | |
143 @item M-C-a | |
144 Move backward to the beginning of a function | |
145 (@code{octave-beginning-of-defun}). | |
146 With prefix argument @var{N}, do it that many times if @var{N} is | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
147 positive; otherwise, move forward to the @var{N}-th following beginning |
3294 | 148 of a function. |
149 | |
150 @item M-C-e | |
151 Move forward to the end of a function (@code{octave-end-of-defun}). | |
152 With prefix argument @var{N}, do it that many times if @var{N} is | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
153 positive; otherwise, move back to the @var{N}-th preceding end of a |
3294 | 154 function. |
155 | |
156 @item M-C-h | |
157 Puts point at beginning and mark at the end of the current Octave | |
158 function, i.e., the one containing point or following point | |
159 (@code{octave-mark-defun}). | |
160 | |
161 @item M-C-q | |
162 Properly indents the Octave function which contains point | |
163 (@code{octave-indent-defun}). | |
164 | |
165 @item M-; | |
166 If there is no comment already on this line, create a code-level comment | |
167 (started by two comment characters) if the line is empty, or an in-line | |
168 comment (started by one comment character) otherwise | |
169 (@code{octave-indent-for-comment}). | |
170 Point is left after the start of the comment which is properly aligned. | |
171 | |
172 @item C-c ; | |
173 Puts the comment character @samp{#} (more precisely, the string value of | |
174 @code{octave-comment-start}) at the beginning of every line in the | |
175 region (@code{octave-comment-region}). With just @kbd{C-u} prefix | |
176 argument, uncomment each line in the region. A numeric prefix argument | |
177 @var{N} means use @var{N} comment characters. | |
178 | |
179 @item C-c : | |
180 Uncomments every line in the region (@code{octave-uncomment-region}). | |
181 | |
182 @item C-c C-p | |
183 Move one line of Octave code backward, skipping empty and comment lines | |
184 (@code{octave-previous-code-line}). With numeric prefix argument | |
185 @var{N}, move that many code lines backward (forward if @var{N} is | |
186 negative). | |
187 | |
188 @item C-c C-n | |
189 Move one line of Octave code forward, skipping empty and comment lines | |
190 (@code{octave-next-code-line}). With numeric prefix argument @var{N}, | |
191 move that many code lines forward (backward if @var{N} is negative). | |
192 | |
193 @item C-c C-a | |
194 Move to the `real' beginning of the current line | |
195 (@code{octave-beginning-of-line}). If point is in an empty or comment | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
196 line, simply go to its beginning; otherwise, move backwards to the |
3294 | 197 beginning of the first code line which is not inside a continuation |
9081
c79cf77061b7
Cleanup documentation files contrib.texi, bugs.texi, install.texi, emacs.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
198 statement, i.e., which does not follow a code line ending in @samp{...} |
3294 | 199 or @samp{\}, or is inside an open parenthesis list. |
200 | |
201 @item C-c C-e | |
202 Move to the `real' end of the current line (@code{octave-end-of-line}). | |
203 If point is in a code line, move forward to the end of the first Octave | |
204 code line which does not end in @samp{...} or @samp{\} or is inside an | |
205 open parenthesis list. Otherwise, simply go to the end of the current | |
206 line. | |
207 | |
208 @item C-c M-C-n | |
209 Move forward across one balanced begin-end block of Octave code | |
210 (@code{octave-forward-block}). With numeric prefix argument @var{N}, | |
211 move forward across @var{n} such blocks (backward if @var{N} is | |
212 negative). | |
213 | |
214 @item C-c M-C-p | |
215 Move back across one balanced begin-end block of Octave code | |
216 (@code{octave-backward-block}). With numeric prefix argument @var{N}, | |
217 move backward across @var{N} such blocks (forward if @var{N} is | |
218 negative). | |
219 | |
220 @item C-c M-C-d | |
221 Move forward down one begin-end block level of Octave code | |
222 (@code{octave-down-block}). With numeric prefix argument, do it that | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
223 many times; a negative argument means move backward, but still go down |
3294 | 224 one level. |
225 | |
226 @item C-c M-C-u | |
227 Move backward out of one begin-end block level of Octave code | |
228 (@code{octave-backward-up-block}). With numeric prefix argument, do it | |
229 that many times; a negative argument means move forward, but still to a | |
230 less deep spot. | |
231 | |
232 @item C-c M-C-h | |
233 Put point at the beginning of this block, mark at the end | |
234 (@code{octave-mark-block}). | |
235 The block marked is the one that contains point or follows point. | |
236 | |
237 @item C-c ] | |
238 Close the current block on a separate line (@code{octave-close-block}). | |
239 An error is signaled if no block to close is found. | |
240 | |
241 @item C-c f | |
242 Insert a function skeleton, prompting for the function's name, arguments | |
9081
c79cf77061b7
Cleanup documentation files contrib.texi, bugs.texi, install.texi, emacs.texi
Rik <rdrider0-list@yahoo.com>
parents:
9032
diff
changeset
|
243 and return values which have to be entered without parentheses |
3294 | 244 (@code{octave-insert-defun}). |
245 | |
246 @item C-c C-h | |
247 Search the function, operator and variable indices of all info files | |
248 with documentation for Octave for entries (@code{octave-help}). If used | |
249 interactively, the entry is prompted for with completion. If multiple | |
250 matches are found, one can cycle through them using the standard | |
251 @samp{,} (@code{Info-index-next}) command of the Info reader. | |
252 | |
253 The variable @code{octave-help-files} is a list of files to search | |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17160
diff
changeset
|
254 through and defaults to @qcode{'("octave")}. If there is also an Octave |
3294 | 255 Local Guide with corresponding info file, say, @file{octave-LG}, you can |
256 have @code{octave-help} search both files by | |
257 @lisp | |
258 (setq octave-help-files '("octave" "octave-LG")) | |
259 @end lisp | |
260 @noindent | |
261 in one of your Emacs startup files. | |
262 | |
263 @end table | |
264 | |
265 A common problem is that the @key{RET} key does @emph{not} indent the | |
266 line to where the new text should go after inserting the newline. This | |
267 is because the standard Emacs convention is that @key{RET} (aka | |
268 @kbd{C-m}) just adds a newline, whereas @key{LFD} (aka @kbd{C-j}) adds a | |
269 newline and indents it. This is particularly inconvenient for users with | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
270 keyboards which do not have a special @key{LFD} key at all; in such |
3294 | 271 cases, it is typically more convenient to use @key{RET} as the @key{LFD} |
272 key (rather than typing @kbd{C-j}). | |
273 | |
274 You can make @key{RET} do this by adding | |
275 @lisp | |
276 (define-key octave-mode-map "\C-m" | |
277 'octave-reindent-then-newline-and-indent) | |
278 @end lisp | |
279 @noindent | |
280 to one of your Emacs startup files. Another, more generally applicable | |
281 solution is | |
282 @lisp | |
283 (defun RET-behaves-as-LFD () | |
284 (let ((x (key-binding "\C-j"))) | |
285 (local-set-key "\C-m" x))) | |
286 (add-hook 'octave-mode-hook 'RET-behaves-as-LFD) | |
287 @end lisp | |
288 @noindent | |
289 (this works for all modes by adding to the startup hooks, without having | |
290 to know the particular binding of @key{RET} in that mode!). Similar | |
291 considerations apply for using @key{M-RET} as @key{M-LFD}. As Barry | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
292 A. Warsaw @email{bwarsaw@@cnri.reston.va.us} says in the documentation for his |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9081
diff
changeset
|
293 @code{cc-mode}, ``This is a very common question. @code{:-)} If you want |
3294 | 294 this to be the default behavior, don't lobby me, lobby RMS!'' |
295 | |
296 The following variables can be used to customize Octave mode. | |
297 | |
298 @table @code | |
299 @item octave-auto-indent | |
300 Non-@code{nil} means auto-indent the current line after a semicolon or | |
301 space. Default is @code{nil}. | |
302 | |
303 @item octave-auto-newline | |
304 Non-@code{nil} means auto-insert a newline and indent after semicolons | |
305 are typed. The default value is @code{nil}. | |
306 | |
307 @item octave-blink-matching-block | |
308 Non-@code{nil} means show matching begin of block when inserting a space, | |
309 newline or @samp{;} after an else or end keyword. Default is @code{t}. | |
310 This is an extremely useful feature for automatically verifying that the | |
311 keywords match---if they don't, an error message is displayed. | |
312 | |
313 @item octave-block-offset | |
314 Extra indentation applied to statements in block structures. | |
315 Default is 2. | |
316 | |
317 @item octave-continuation-offset | |
318 Extra indentation applied to Octave continuation lines. | |
319 Default is 4. | |
320 | |
321 @item octave-continuation-string | |
322 String used for Octave continuation lines. | |
323 Normally @samp{\}. | |
324 | |
325 @item octave-mode-startup-message | |
326 If @code{t} (default), a startup message is displayed when Octave mode | |
327 is called. | |
328 | |
329 @end table | |
330 | |
331 If Font Lock mode is enabled, Octave mode will display | |
14853
72b8b39e12be
doc: Periodic grammarcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
332 |
3294 | 333 @itemize @bullet |
334 @item | |
335 strings in @code{font-lock-string-face} | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
336 |
3294 | 337 @item |
338 comments in @code{font-lock-comment-face} | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
339 |
3294 | 340 @item |
341 the Octave reserved words (such as all block keywords) and the text | |
342 functions (such as @samp{cd} or @samp{who}) which are also reserved | |
343 using @code{font-lock-keyword-face} | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
344 |
3294 | 345 @item |
7594 | 346 the built-in operators (@samp{&&}, @samp{==}, @dots{}) using |
3294 | 347 @code{font-lock-reference-face} |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
348 |
3294 | 349 @item |
350 and the function names in function declarations in | |
351 @code{font-lock-function-name-face}. | |
352 @end itemize | |
353 | |
354 There is also rudimentary support for Imenu (currently, function names | |
355 can be indexed). | |
356 | |
357 @cindex TAGS | |
358 @cindex Emacs TAGS files | |
6072 | 359 @cindex @code{octave-tags} |
3294 | 360 You can generate TAGS files for Emacs from Octave @file{.m} files using |
6072 | 361 the shell script @code{octave-tags} that is installed alongside your copy of |
3294 | 362 Octave. |
363 | |
364 Customization of Octave mode can be performed by modification of the | |
365 variable @code{octave-mode-hook}. If the value of this variable is | |
366 non-@code{nil}, turning on Octave mode calls its value. | |
367 | |
368 If you discover a problem with Octave mode, you can conveniently send a | |
369 bug report using @kbd{C-c C-b} (@code{octave-submit-bug-report}). This | |
370 automatically sets up a mail buffer with version information already | |
371 added. You just need to add a description of the problem, including a | |
372 reproducible test case and send the message. | |
373 | |
11255
d682cd6669ac
Update info-based documentation menus to include new nodes.
Rik <octave@nomad.inbox5.com>
parents:
10828
diff
changeset
|
374 @node Running Octave from Within Emacs |
d682cd6669ac
Update info-based documentation menus to include new nodes.
Rik <octave@nomad.inbox5.com>
parents:
10828
diff
changeset
|
375 @appendixsec Running Octave from Within Emacs |
3294 | 376 |
377 The package @file{octave} provides commands for running an inferior | |
378 Octave process in a special Emacs buffer. Use | |
379 @lisp | |
380 M-x run-octave | |
381 @end lisp | |
382 @noindent | |
383 to directly start an inferior Octave process. If Emacs does not know | |
384 about this command, add the line | |
385 @lisp | |
386 (autoload 'run-octave "octave-inf" nil t) | |
387 @end lisp | |
388 @noindent | |
389 to your @file{.emacs} file. | |
390 | |
391 This will start Octave in a special buffer the name of which is | |
392 specified by the variable @code{inferior-octave-buffer} and defaults to | |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17160
diff
changeset
|
393 @qcode{"*Inferior Octave*"}. From within this buffer, you can |
3294 | 394 interact with the inferior Octave process `as usual', i.e., by entering |
395 Octave commands at the prompt. The buffer is in Inferior Octave mode, | |
396 which is derived from the standard Comint mode, a major mode for | |
397 interacting with an inferior interpreter. See the documentation for | |
398 @code{comint-mode} for more details, and use @kbd{C-h b} to find out | |
399 about available special keybindings. | |
400 | |
401 You can also communicate with an inferior Octave process from within | |
402 files with Octave code (i.e., buffers in Octave mode), using the | |
403 following commands. | |
404 | |
405 @table @kbd | |
406 @item C-c i l | |
407 Send the current line to the inferior Octave process | |
408 (@code{octave-send-line}). | |
409 With positive prefix argument @var{N}, send that many lines. | |
410 If @code{octave-send-line-auto-forward} is non-@code{nil}, go to the | |
411 next unsent code line. | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
412 |
3294 | 413 @item C-c i b |
414 Send the current block to the inferior Octave process | |
415 (@code{octave-send-block}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
416 |
3294 | 417 @item C-c i f |
418 Send the current function to the inferior Octave process | |
419 (@code{octave-send-defun}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
420 |
3294 | 421 @item C-c i r |
422 Send the region to the inferior Octave process | |
423 (@code{octave-send-region}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
424 |
3294 | 425 @item C-c i s |
426 Make sure that `inferior-octave-buffer' is displayed | |
427 (@code{octave-show-process-buffer}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
428 |
3294 | 429 @item C-c i h |
430 Delete all windows that display the inferior Octave buffer | |
431 (@code{octave-hide-process-buffer}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
432 |
3294 | 433 @item C-c i k |
434 Kill the inferior Octave process and its buffer | |
435 (@code{octave-kill-process}). | |
436 @end table | |
437 | |
438 The effect of the commands which send code to the Octave process can be | |
439 customized by the following variables. | |
14853
72b8b39e12be
doc: Periodic grammarcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
440 |
3294 | 441 @table @code |
442 @item octave-send-echo-input | |
443 Non-@code{nil} means echo input sent to the inferior Octave process. | |
444 Default is @code{t}. | |
445 | |
446 @item octave-send-show-buffer | |
447 Non-@code{nil} means display the buffer running the Octave process after | |
448 sending a command (but without selecting it). | |
449 Default is @code{t}. | |
450 @end table | |
451 | |
452 If you send code and there is no inferior Octave process yet, it will be | |
453 started automatically. | |
454 | |
455 The startup of the inferior Octave process is highly customizable. | |
456 The variable @code{inferior-octave-startup-args} can be used for | |
457 specifying command lines arguments to be passed to Octave on startup | |
458 as a list of strings. For example, to suppress the startup message and | |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17160
diff
changeset
|
459 use `traditional' mode, set this to @qcode{'("-q" "--traditional")}. |
3294 | 460 You can also specify a startup file of Octave commands to be loaded on |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
461 startup; note that these commands will not produce any visible output |
3294 | 462 in the process buffer. Which file to use is controlled by the variable |
463 @code{inferior-octave-startup-file}. If this is @code{nil}, the file | |
464 @file{~/.emacs-octave} is used if it exists. | |
465 | |
466 And finally, @code{inferior-octave-mode-hook} is run after starting the | |
467 process and putting its buffer into Inferior Octave mode. Hence, if you | |
468 like the up and down arrow keys to behave in the interaction buffer as | |
469 in the shell, and you want this buffer to use nice colors, add | |
470 @lisp | |
471 (add-hook 'inferior-octave-mode-hook | |
472 (lambda () | |
473 (turn-on-font-lock) | |
474 (define-key inferior-octave-mode-map [up] | |
475 'comint-previous-input) | |
476 (define-key inferior-octave-mode-map [down] | |
477 'comint-next-input))) | |
478 @end lisp | |
479 @noindent | |
480 to your @file{.emacs} file. You could also swap the roles of @kbd{C-a} | |
481 (@code{beginning-of-line}) and @code{C-c C-a} (@code{comint-bol}) using | |
482 this hook. | |
483 | |
484 @quotation | |
5479 | 485 @strong{Note} that if you set your Octave prompts to something different |
486 from the defaults, make sure that @code{inferior-octave-prompt} matches | |
487 them. Otherwise, @emph{nothing} will work, because Emacs will not know | |
3294 | 488 when Octave is waiting for input, or done sending output. |
489 @end quotation | |
490 | |
4167 | 491 @node Using the Emacs Info Reader for Octave |
3294 | 492 @appendixsec Using the Emacs Info Reader for Octave |
493 | |
7096 | 494 You may also use the Emacs Info reader with Octave's @code{doc} function. |
495 For this, the package @file{gnuserv} needs to be installed. | |
3294 | 496 |
497 If @file{gnuserv} is installed, add the lines | |
498 @lisp | |
499 (autoload 'octave-help "octave-hlp" nil t) | |
500 (require 'gnuserv) | |
501 (gnuserv-start) | |
502 @end lisp | |
503 @noindent | |
504 to your @file{.emacs} file. | |
505 | |
506 You can use either `plain' Emacs Info or the function @code{octave-help} | |
507 as your Octave info reader (for @samp{help -i}). In the former case, | |
6477 | 508 use @code{info_program ("info-emacs-info")}. |
3294 | 509 The latter is perhaps more attractive because it allows to look up keys |
510 in the indices of @emph{several} info files related to Octave (provided | |
511 that the Emacs variable @code{octave-help-files} is set correctly). In | |
6477 | 512 this case, use @code{info_program ("info-emacs-octave-help")}. |
3294 | 513 |
7096 | 514 If you use Octave from within Emacs, it is best to add these settings to |
515 your @file{~/.emacs-octave} startup file (or the file pointed to by the | |
516 Emacs variable @code{inferior-octave-startup-file}). |