<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<HTML>
 <HEAD>
  <link rel="icon"          href="/favicon.ico" type="image/x-icon">
  <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
  <link rel="stylesheet"    href="../../../../../../default.css"  type="text/css">

  <TITLE>Sexp Edit</TITLE>

  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
  <META HTTP-EQUIV="Description"
        NAME="description" CONTENT="A Simple Sexp Structure Editor.">
  <META NAME="author"      CONTENT="Pascal J. Bourguignon">

  <META NAME="keywords"    CONTENT="Common Lisp, Lisp, Sexp, Editor, Structure Editor">
 </HEAD>
<BODY>
<!--TOP-BEGIN-->
<!-- This section is automatically generated by html-update, -->
<!-- from data in 'node.el'.    Please, do not edit it here. -->
<DIV CLASS="TOP"></DIV>
<!--TOP-END-->
<!--MENU-BEGIN-->
<!-- This section is automatically generated by html-update, -->
<!-- from data in 'node.el'.    Please, do not edit it here. -->
<DIV CLASS="MENU"><HR><P>|
 <A HREF="../../../../../../toc.html">Contents</a> |
 <A HREF="../../../../../../index.html">Home</a> |
 <A HREF="../ibcl/index.html.in">Previous</a> |
 <A HREF="../index.html.in">Up</a> |
 <A HREF="../playtomo-stonedge/index.html.in">Next</a> |
</P><HR></DIV>
<!--MENU-END-->

<H1>A Simple Sexp Structure Editor</H1>

<p>This is a simple sexp structure editor to demonstrate how we can
edit lisp sources directly instead of going thru the deserialization
and serialization (converting the sexps into a textual representation
and using a text editor such as emacs).<p>

<p>This editor manipulates directly the sexp data structure.</p>

<UL>
<LI><A HREF="sedit.lisp">sedit.lisp</A></LI>
</ul>


<p>It is invoked as (sedit sexp), and returns the modified sexp.
(The sexp is modified destructively).</p>
<pre>
 (sedit (copy-tree '(an example)))
</pre>
<p>At each interaction loop, it prints the whole sexp, showing the selected
sub-sexp, and query a command. The list of commands are:</p>
<ul>
<li><tt> q quit               </tt> to return the modified sexp from sedit.
<li><tt> i in                 </tt> to enter inside the selected list.
<li><tt> o out                </tt> to select the list containing the selection.
<li><tt> f forward n next     </tt> to select the sexp following the selection (or out).
<li><tt> b backward p previous</tt> to select the sexp preceding the selection (or out).
<li><tt> s insert             </tt> to insert a new sexp before the selection.
<li><tt> r replace            </tt> to replace the selection with a new sexp.
<li><tt> a add                </tt> to add a new sexp after the selection.
<li><tt> x cut                </tt> to cut the selection into a *clipboard*.
<li><tt> c copy               </tt> to copy the selection into a *clipboard*.
<li><tt> y paste              </tt> to paste the *clipboard* replacing the selection.
</ul>

Example:
<pre>

C/IBCL-USER[4]&gt; (sedit '())

Sexp Editor:
【NIL】
&gt; r
replacement sexp: (let ((*package #.*package*)) (print 'hello))
【(LET ((*PACKAGE #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;)) (PRINT (QUOTE HELLO)))】
&gt; i
(【LET】 ((*PACKAGE #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;)) (PRINT (QUOTE HELLO)))
&gt; n
(LET 【((*PACKAGE #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;))】 (PRINT (QUOTE HELLO)))
&gt; i
(LET (【(*PACKAGE #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;)】) (PRINT (QUOTE HELLO)))
&gt; i
(LET ((【*PACKAGE】 #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;)) (PRINT (QUOTE HELLO)))
&gt; r
replacement sexp: *package*
(LET ((【*PACKAGE*】 #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;)) (PRINT (QUOTE HELLO)))
&gt; q
(LET ((*PACKAGE* #&lt;PACKAGE IMAGE-BASED-COMMON-LISP-USER&gt;)) (PRINT 'HELLO))
C/IBCL-USER[5]&gt; (eval *)

HELLO
HELLO
C/IBCL-USER[6]&gt;

</pre>


<!--MENU-BEGIN-->
<!-- This section is automatically generated by html-update, -->
<!-- from data in 'node.el'.    Please, do not edit it here. -->
<DIV CLASS="MENU"><HR><P>|
 <A HREF="../../../../../../toc.html">Contents</a> |
 <A HREF="../../../../../../index.html">Home</a> |
 <A HREF="../ibcl/index.html.in">Previous</a> |
 <A HREF="../index.html.in">Up</a> |
 <A HREF="../playtomo-stonedge/index.html.in">Next</a> |
</P><HR></DIV>
<!--MENU-END-->
<!--BOTTOM-BEGIN-->
<!-- This section is automatically generated by html-update, -->
<!-- from data in 'node.el'.    Please, do not edit it here. -->
<DIV CLASS="BOTTOM">
<hr><code><small>
 | <a href="http://www.informatimago.com//develop/lisp/com/informatimago/small-cl-pgms/sedit/index.html.in">Mirror on informatimago.com</a>
 | <a href="http://informatimago.free.fr/i//develop/lisp/com/informatimago/small-cl-pgms/sedit/index.html.in">Mirror on free.fr</a>
 | </small></code>

<BR><SMALL>
      <a href="http://validator.w3.org/check?uri=referer"><img
          src="http://www.w3.org/Icons/valid-html401"
          alt="Valid HTML 4.01!" height="31" width="88"></a>
   </SMALL>
</DIV>
<!--BOTTOM-END-->
</BODY>
</HTML>
ViewGit