Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3e60ff9d4d6f58c8fbd17208f14089fa > files > 356

octave-doc-3.2.3-3mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>Running Octave From Within Emacs - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Emacs-Octave-Support.html#Emacs-Octave-Support" title="Emacs Octave Support">
<link rel="prev" href="Using-Octave-Mode.html#Using-Octave-Mode" title="Using Octave Mode">
<link rel="next" href="Using-the-Emacs-Info-Reader-for-Octave.html#Using-the-Emacs-Info-Reader-for-Octave" title="Using the Emacs Info Reader for Octave">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Running-Octave-From-Within-Emacs"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Using-the-Emacs-Info-Reader-for-Octave.html#Using-the-Emacs-Info-Reader-for-Octave">Using the Emacs Info Reader for Octave</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Using-Octave-Mode.html#Using-Octave-Mode">Using Octave Mode</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Emacs-Octave-Support.html#Emacs-Octave-Support">Emacs Octave Support</a>
<hr>
</div>

<h3 class="appendixsec">G.3 Running Octave From Within Emacs</h3>

<p>The package <samp><span class="file">octave</span></samp> provides commands for running an inferior
Octave process in a special Emacs buffer.  Use
<pre class="lisp">     M-x run-octave
</pre>
   <p class="noindent">to directly start an inferior Octave process.  If Emacs does not know
about this command, add the line
<pre class="lisp">     (autoload 'run-octave "octave-inf" nil t)
</pre>
   <p class="noindent">to your <samp><span class="file">.emacs</span></samp> file.

   <p>This will start Octave in a special buffer the name of which is
specified by the variable <code>inferior-octave-buffer</code> and defaults to
<code>"*Inferior Octave*"</code>.  From within this buffer, you can
interact with the inferior Octave process `as usual', i.e., by entering
Octave commands at the prompt.  The buffer is in Inferior Octave mode,
which is derived from the standard Comint mode, a major mode for
interacting with an inferior interpreter.  See the documentation for
<code>comint-mode</code> for more details, and use <kbd>C-h b</kbd> to find out
about available special keybindings.

   <p>You can also communicate with an inferior Octave process from within
files with Octave code (i.e., buffers in Octave mode), using the
following commands.

     <dl>
<dt><kbd>C-c i l</kbd><dd>Send the current line to the inferior Octave process
(<code>octave-send-line</code>). 
With positive prefix argument <var>N</var>, send that many lines. 
If <code>octave-send-line-auto-forward</code> is non-<code>nil</code>, go to the
next unsent code line. 
<br><dt><kbd>C-c i b</kbd><dd>Send the current block to the inferior Octave process
(<code>octave-send-block</code>). 
<br><dt><kbd>C-c i f</kbd><dd>Send the current function to the inferior Octave process
(<code>octave-send-defun</code>). 
<br><dt><kbd>C-c i r</kbd><dd>Send the region to the inferior Octave process
(<code>octave-send-region</code>). 
<br><dt><kbd>C-c i s</kbd><dd>Make sure that `inferior-octave-buffer' is displayed
(<code>octave-show-process-buffer</code>). 
<br><dt><kbd>C-c i h</kbd><dd>Delete all windows that display the inferior Octave buffer
(<code>octave-hide-process-buffer</code>). 
<br><dt><kbd>C-c i k</kbd><dd>Kill the inferior Octave process and its buffer
(<code>octave-kill-process</code>). 
</dl>

   <p>The effect of the commands which send code to the Octave process can be
customized by the following variables.
     <dl>
<dt><code>octave-send-echo-input</code><dd>Non-<code>nil</code> means echo input sent to the inferior Octave process. 
Default is <code>t</code>.

     <br><dt><code>octave-send-show-buffer</code><dd>Non-<code>nil</code> means display the buffer running the Octave process after
sending a command (but without selecting it). 
Default is <code>t</code>. 
</dl>

   <p>If you send code and there is no inferior Octave process yet, it will be
started automatically.

   <p>The startup of the inferior Octave process is highly customizable. 
The variable <code>inferior-octave-startup-args</code> can be used for
specifying command lines arguments to be passed to Octave on startup
as a list of strings.  For example, to suppress the startup message and
use `traditional' mode, set this to <code>'("-q" "--traditional")</code>. 
You can also specify a startup file of Octave commands to be loaded on
startup;  note that these commands will not produce any visible output
in the process buffer.  Which file to use is controlled by the variable
<code>inferior-octave-startup-file</code>.  If this is <code>nil</code>, the file
<samp><span class="file">~/.emacs-octave</span></samp> is used if it exists.

   <p>And finally, <code>inferior-octave-mode-hook</code> is run after starting the
process and putting its buffer into Inferior Octave mode.  Hence, if you
like the up and down arrow keys to behave in the interaction buffer as
in the shell, and you want this buffer to use nice colors, add
<pre class="lisp">     (add-hook 'inferior-octave-mode-hook
               (lambda ()
                 (turn-on-font-lock)
                 (define-key inferior-octave-mode-map [up]
                   'comint-previous-input)
                 (define-key inferior-octave-mode-map [down]
                   'comint-next-input)))
</pre>
   <p class="noindent">to your <samp><span class="file">.emacs</span></samp> file.  You could also swap the roles of <kbd>C-a</kbd>
(<code>beginning-of-line</code>) and <code>C-c C-a</code> (<code>comint-bol</code>) using
this hook.

   <blockquote>
<strong>Note</strong> that if you set your Octave prompts to something different
from the defaults, make sure that <code>inferior-octave-prompt</code> matches
them.  Otherwise, <em>nothing</em> will work, because Emacs will not know
when Octave is waiting for input, or done sending output. 
</blockquote>

   </body></html>