mirror of https://github.com/texmacs/doc.git
Doc: typo
This commit is contained in:
parent
a94cf46985
commit
77fed1355c
|
@ -1,4 +1,4 @@
|
|||
<TeXmacs|1.0.6.10>
|
||||
<TeXmacs|1.99.1>
|
||||
|
||||
<style|tmdoc>
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
|||
All <TeXmacs> documents or document fragments can be thought of as
|
||||
<em|trees>, as explained in more detail in the chapter about the
|
||||
<hlink|<TeXmacs> document format|../../format/basics/basics.en.tm>. Inside
|
||||
<value|scheme> programs, there are two main ways to represent such trees,
|
||||
<scheme> programs, there are two main ways to represent such trees,
|
||||
depending on whether one manipulates active or passive documents:
|
||||
|
||||
<paragraph*|Passive documents and <value|scheme> trees><label|tree-passive>
|
||||
<paragraph*|Passive documents and <scheme> trees><label|tree-passive>
|
||||
|
||||
Passive documents, like those which are processed by a<nbsp>conversion
|
||||
tool, are usually represented by <em|scheme trees>. For instance, the
|
||||
|
@ -23,28 +23,27 @@
|
|||
|
||||
is typically represented by
|
||||
|
||||
<\scheme-fragment>
|
||||
<\scm-code>
|
||||
(frac (concat "a" (rsup "2")) "b+c")
|
||||
</scheme-fragment>
|
||||
</scm-code>
|
||||
|
||||
This representation is convenient in the sense that they can be manipulated
|
||||
directly using standard <value|scheme> routines on lists.
|
||||
directly using standard <scheme> routines on lists.
|
||||
|
||||
<paragraph*|Active documents and C++ trees><label|tree-active>
|
||||
|
||||
Active documents, like ones which are visible in one of the editors
|
||||
windows, are rather represented using the internal C++ type
|
||||
<verbatim|tree>, which has been exported to <value|scheme> via the glue.
|
||||
When a tree is part of a real document inside the editor, the tree is aware
|
||||
about its position inside the document. Using routines from the tree API,
|
||||
you may then make changes in the document simply by assigning new values to
|
||||
the tree.
|
||||
<verbatim|tree>, which has been exported to <scheme> via the glue. When a
|
||||
tree is part of a real document inside the editor, the tree is aware about
|
||||
its position inside the document. Using routines from the tree API, you may
|
||||
then make changes in the document simply by assigning new values to the
|
||||
tree.
|
||||
|
||||
For instance, consider the following experiment: open two windows and start
|
||||
a <value|scheme> session in each window. In the second window, enter the
|
||||
lines
|
||||
a <scheme> session in each window. In the second window, enter the lines
|
||||
|
||||
<with|prog-language|scheme|prog-session|default|<\session>
|
||||
<\session|scheme|default>
|
||||
<\input|scheme] >
|
||||
(use-modules (utils library tree))
|
||||
</input>
|
||||
|
@ -52,12 +51,12 @@
|
|||
<\input|scheme] >
|
||||
(define t (buffer-tree))
|
||||
</input>
|
||||
</session>>
|
||||
</session>
|
||||
|
||||
In the first window, you may now modify the document in the second window
|
||||
using commands like
|
||||
|
||||
<with|prog-language|scheme|prog-session|default|<\session>
|
||||
<\session|scheme|default>
|
||||
<\input|scheme] >
|
||||
(tree-set! t (tree 'document (string-\<gtr\>tree "First line.")
|
||||
|
||||
|
@ -72,7 +71,7 @@
|
|||
<\input|scheme] >
|
||||
(tree-set t 0 (tree 'strong (tree-ref t 0)))
|
||||
</input>
|
||||
</session>>
|
||||
</session>
|
||||
|
||||
<paragraph*|A common framework><label|tree-hybrid>
|
||||
|
||||
|
@ -83,7 +82,7 @@
|
|||
framework. For instance, the last three lines in the above experiment may
|
||||
be replaced by
|
||||
|
||||
<with|prog-language|scheme|prog-session|default|<\session>
|
||||
<\session|scheme|default>
|
||||
<\input|scheme] >
|
||||
(tree-set! t '(document "First line." "Second line."))
|
||||
</input>
|
||||
|
@ -95,7 +94,7 @@
|
|||
<\input|scheme] >
|
||||
(tree-set t 0 `(strong ,(tree-ref t 0)))
|
||||
</input>
|
||||
</session>>
|
||||
</session>
|
||||
|
||||
More precisely, a scheme expression of the type <verbatim|content> is
|
||||
either a string, a tree or a list whose first element is a symbol and whose
|
||||
|
@ -111,18 +110,18 @@
|
|||
Besides the fact that trees remember their <em|positions> inside the global
|
||||
edit tree, it is also possible to create cursor positions inside the global
|
||||
edit tree, which are naturally updated when modifications take place. This
|
||||
technique is useful when you want to write and editing routine which does
|
||||
technique is useful when you want to write an editing routine which does
|
||||
not act locally at the cursor position. For instance, the following routine
|
||||
can be used to insert content at the start of the current buffer in a
|
||||
reliable way:
|
||||
|
||||
<\scheme-fragment>
|
||||
<\scm-code>
|
||||
(define (insert-at-buffer-start t)
|
||||
|
||||
\ \ (with-cursor (path-start (root-tree) (buffer-path))
|
||||
|
||||
\ \ \ \ (insert t)))
|
||||
</scheme-fragment>
|
||||
</scm-code>
|
||||
|
||||
The <scm|with-cursor> macro temporarily changes the cursor position, while
|
||||
storing the old cursor position in such a way that it will be updated
|
||||
|
@ -138,4 +137,7 @@
|
|||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled "GNU Free
|
||||
Documentation License".>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
<initial|<\collection>
|
||||
</collection>>
|
Loading…
Reference in New Issue