Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 4290

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>editing Macaulay2 code with emacs</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_using_sp__Macaulay2_spwith_sp__Te__Xmacs.html">next</a> | <a href="_using_sp__Macaulay2_spwith_spemacs_spafter_spit_sphas_spbeen_spset_spup.html">previous</a> | forward | <a href="_using_sp__Macaulay2_spwith_spemacs_spafter_spit_sphas_spbeen_spset_spup.html">backward</a> | <a href="_using_sp__Macaulay2_spwith_spemacs.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_getting_spstarted.html" title="">getting started</a> > <a href="_using_sp__Macaulay2_spwith_spemacs.html" title="">using Macaulay2 with emacs</a> > <a href="_editing_sp__Macaulay2_spcode_spwith_spemacs.html" title="">editing Macaulay2 code with emacs</a></div>
<hr/>
<div><h1>editing Macaulay2 code with emacs</h1>
<div><p>In this section we learn how to use emacs to edit Macaulay2 code.  Assuming you have set up your emacs init file as described in <a href="_setting_spup_spthe_sp__Macaulay2_spemacs_spinterface.html" title="">setting up the Macaulay2 emacs interface</a> when you visit a file whose name ends with <tt>.m2</tt> you will see on the mode line the name Macaulay2 in parentheses, indicating that the file is being edited in Macaulay2 mode.</p>
<p>To see how electric parentheses, electric semicolons, and indentation work, move to a blank line of this file and type the following text.</p>
<pre>f = () -> (
     a := 4;
     b := {6,7};
     a+b)</pre>
<p>Observe carefully how matching left parentheses are indicated briefly when a right parenthesis is typed.</p>
<p>Now position your cursor in between the 6 and 7.  Notice how pressing <tt>M-C-u</tt> moves you up out of the list to its left.  Do it again.  Experiment with <tt>M-C-f</tt> and <tt>M-C-b</tt> to move forward and back over complete parenthesized expressions.  (In the emacs manual a complete parenthesized expression is referred to as an sexp, which is an abbreviation for S-expression.)  Try out <tt>C-u 2 M-C-@</tt> as a way of marking the next two complete parenthesized expression, and see how to use <tt>C-w</tt> to kill them and <tt>C-y</tt> to yank them back.  Experiment with <tt>M-C-k</tt> to kill the next complete parenthesized expression.</p>
<p>Position your cursor on the 4 and observe how <tt>M-;</tt> will start a comment for you with two hyphens, and position the cursor at the point where commentary may be entered.</p>
<p>Type <tt>res</tt> somewhere and then press <tt>C-c TAB</tt> to bring up the possible completions of the word to documented Macaulay2 symbols.</p>
<p>Notice how <tt>C-h m</tt> or <tt>F1 m</tt> will display the keystrokes peculiar to the mode in a help window.</p>
</div>
</div>
</body>
</html>