Mercurial > hg > octave-lyh
annotate doc/interpreter/emacs.txi @ 11523:fd0a3ac60b0e
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 14 Jan 2011 05:47:45 -0500 |
parents | d682cd6669ac |
children | 72c96de7a403 |
rev | line source |
---|---|
11523 | 1 @c Copyright (C) 1996-2011 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 | |
47 * Installing EOS:: | |
48 * Using Octave Mode:: | |
11255
d682cd6669ac
Update info-based documentation menus to include new nodes.
Rik <octave@nomad.inbox5.com>
parents:
10828
diff
changeset
|
49 * Running Octave from Within Emacs:: |
3294 | 50 * Using the Emacs Info Reader for Octave:: |
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 | |
254 through and defaults to @code{'("octave")}. If there is also an Octave | |
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 | |
332 @itemize @bullet | |
333 @item | |
334 strings in @code{font-lock-string-face} | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
335 |
3294 | 336 @item |
337 comments in @code{font-lock-comment-face} | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
338 |
3294 | 339 @item |
340 the Octave reserved words (such as all block keywords) and the text | |
341 functions (such as @samp{cd} or @samp{who}) which are also reserved | |
342 using @code{font-lock-keyword-face} | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
343 |
3294 | 344 @item |
7594 | 345 the built-in operators (@samp{&&}, @samp{==}, @dots{}) using |
3294 | 346 @code{font-lock-reference-face} |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
347 |
3294 | 348 @item |
349 and the function names in function declarations in | |
350 @code{font-lock-function-name-face}. | |
351 @end itemize | |
352 | |
353 There is also rudimentary support for Imenu (currently, function names | |
354 can be indexed). | |
355 | |
356 @cindex TAGS | |
357 @cindex Emacs TAGS files | |
6072 | 358 @cindex @code{octave-tags} |
3294 | 359 You can generate TAGS files for Emacs from Octave @file{.m} files using |
6072 | 360 the shell script @code{octave-tags} that is installed alongside your copy of |
3294 | 361 Octave. |
362 | |
363 Customization of Octave mode can be performed by modification of the | |
364 variable @code{octave-mode-hook}. If the value of this variable is | |
365 non-@code{nil}, turning on Octave mode calls its value. | |
366 | |
367 If you discover a problem with Octave mode, you can conveniently send a | |
368 bug report using @kbd{C-c C-b} (@code{octave-submit-bug-report}). This | |
369 automatically sets up a mail buffer with version information already | |
370 added. You just need to add a description of the problem, including a | |
371 reproducible test case and send the message. | |
372 | |
11255
d682cd6669ac
Update info-based documentation menus to include new nodes.
Rik <octave@nomad.inbox5.com>
parents:
10828
diff
changeset
|
373 @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
|
374 @appendixsec Running Octave from Within Emacs |
3294 | 375 |
376 The package @file{octave} provides commands for running an inferior | |
377 Octave process in a special Emacs buffer. Use | |
378 @lisp | |
379 M-x run-octave | |
380 @end lisp | |
381 @noindent | |
382 to directly start an inferior Octave process. If Emacs does not know | |
383 about this command, add the line | |
384 @lisp | |
385 (autoload 'run-octave "octave-inf" nil t) | |
386 @end lisp | |
387 @noindent | |
388 to your @file{.emacs} file. | |
389 | |
390 This will start Octave in a special buffer the name of which is | |
391 specified by the variable @code{inferior-octave-buffer} and defaults to | |
392 @code{"*Inferior Octave*"}. From within this buffer, you can | |
393 interact with the inferior Octave process `as usual', i.e., by entering | |
394 Octave commands at the prompt. The buffer is in Inferior Octave mode, | |
395 which is derived from the standard Comint mode, a major mode for | |
396 interacting with an inferior interpreter. See the documentation for | |
397 @code{comint-mode} for more details, and use @kbd{C-h b} to find out | |
398 about available special keybindings. | |
399 | |
400 You can also communicate with an inferior Octave process from within | |
401 files with Octave code (i.e., buffers in Octave mode), using the | |
402 following commands. | |
403 | |
404 @table @kbd | |
405 @item C-c i l | |
406 Send the current line to the inferior Octave process | |
407 (@code{octave-send-line}). | |
408 With positive prefix argument @var{N}, send that many lines. | |
409 If @code{octave-send-line-auto-forward} is non-@code{nil}, go to the | |
410 next unsent code line. | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
411 |
3294 | 412 @item C-c i b |
413 Send the current block to the inferior Octave process | |
414 (@code{octave-send-block}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
415 |
3294 | 416 @item C-c i f |
417 Send the current function to the inferior Octave process | |
418 (@code{octave-send-defun}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
419 |
3294 | 420 @item C-c i r |
421 Send the region to the inferior Octave process | |
422 (@code{octave-send-region}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
423 |
3294 | 424 @item C-c i s |
425 Make sure that `inferior-octave-buffer' is displayed | |
426 (@code{octave-show-process-buffer}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
427 |
3294 | 428 @item C-c i h |
429 Delete all windows that display the inferior Octave buffer | |
430 (@code{octave-hide-process-buffer}). | |
10828
322f43e0e170
Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
431 |
3294 | 432 @item C-c i k |
433 Kill the inferior Octave process and its buffer | |
434 (@code{octave-kill-process}). | |
435 @end table | |
436 | |
437 The effect of the commands which send code to the Octave process can be | |
438 customized by the following variables. | |
439 @table @code | |
440 @item octave-send-echo-input | |
441 Non-@code{nil} means echo input sent to the inferior Octave process. | |
442 Default is @code{t}. | |
443 | |
444 @item octave-send-show-buffer | |
445 Non-@code{nil} means display the buffer running the Octave process after | |
446 sending a command (but without selecting it). | |
447 Default is @code{t}. | |
448 @end table | |
449 | |
450 If you send code and there is no inferior Octave process yet, it will be | |
451 started automatically. | |
452 | |
453 The startup of the inferior Octave process is highly customizable. | |
454 The variable @code{inferior-octave-startup-args} can be used for | |
455 specifying command lines arguments to be passed to Octave on startup | |
456 as a list of strings. For example, to suppress the startup message and | |
457 use `traditional' mode, set this to @code{'("-q" "--traditional")}. | |
458 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
|
459 startup; note that these commands will not produce any visible output |
3294 | 460 in the process buffer. Which file to use is controlled by the variable |
461 @code{inferior-octave-startup-file}. If this is @code{nil}, the file | |
462 @file{~/.emacs-octave} is used if it exists. | |
463 | |
464 And finally, @code{inferior-octave-mode-hook} is run after starting the | |
465 process and putting its buffer into Inferior Octave mode. Hence, if you | |
466 like the up and down arrow keys to behave in the interaction buffer as | |
467 in the shell, and you want this buffer to use nice colors, add | |
468 @lisp | |
469 (add-hook 'inferior-octave-mode-hook | |
470 (lambda () | |
471 (turn-on-font-lock) | |
472 (define-key inferior-octave-mode-map [up] | |
473 'comint-previous-input) | |
474 (define-key inferior-octave-mode-map [down] | |
475 'comint-next-input))) | |
476 @end lisp | |
477 @noindent | |
478 to your @file{.emacs} file. You could also swap the roles of @kbd{C-a} | |
479 (@code{beginning-of-line}) and @code{C-c C-a} (@code{comint-bol}) using | |
480 this hook. | |
481 | |
482 @quotation | |
5479 | 483 @strong{Note} that if you set your Octave prompts to something different |
484 from the defaults, make sure that @code{inferior-octave-prompt} matches | |
485 them. Otherwise, @emph{nothing} will work, because Emacs will not know | |
3294 | 486 when Octave is waiting for input, or done sending output. |
487 @end quotation | |
488 | |
4167 | 489 @node Using the Emacs Info Reader for Octave |
3294 | 490 @appendixsec Using the Emacs Info Reader for Octave |
491 | |
7096 | 492 You may also use the Emacs Info reader with Octave's @code{doc} function. |
493 For this, the package @file{gnuserv} needs to be installed. | |
3294 | 494 |
495 If @file{gnuserv} is installed, add the lines | |
496 @lisp | |
497 (autoload 'octave-help "octave-hlp" nil t) | |
498 (require 'gnuserv) | |
499 (gnuserv-start) | |
500 @end lisp | |
501 @noindent | |
502 to your @file{.emacs} file. | |
503 | |
504 You can use either `plain' Emacs Info or the function @code{octave-help} | |
505 as your Octave info reader (for @samp{help -i}). In the former case, | |
6477 | 506 use @code{info_program ("info-emacs-info")}. |
3294 | 507 The latter is perhaps more attractive because it allows to look up keys |
508 in the indices of @emph{several} info files related to Octave (provided | |
509 that the Emacs variable @code{octave-help-files} is set correctly). In | |
6477 | 510 this case, use @code{info_program ("info-emacs-octave-help")}. |
3294 | 511 |
7096 | 512 If you use Octave from within Emacs, it is best to add these settings to |
513 your @file{~/.emacs-octave} startup file (or the file pointed to by the | |
514 Emacs variable @code{inferior-octave-startup-file}). |