![]() |
Source mode, the macro editor and the shortcut editor | ![]() |
TeXmacs documents and style files are trees, and the editor can show a tree either as it is typeset or as its source: tags with their names and arguments, which can be edited structurally. The same machinery serves several purposes: editing style files and packages (.ts files), editing the preamble or the whole source tree of a document, showing a single tag as source (inactive), entering new tags by name with \, and the dialogs which edit one macro or one keyboard shortcut.
This chapter describes how source is displayed, how it is edited and how the macro and shortcut editors work. The user's view of the rendering options is explained in rendering of style files and packages, and the rewriting of inactive markup inside the typesetter in macro expansion: inactive markup.
A document is shown as source when the environment variable preamble is true (the source style and Document\(\rightarrow\)Source\(\rightarrow\)Edit source tree set it), and a single subtree when it is wrapped in inactive or inactive*. The typesetter rewrites such trees into ordinary markup which draws the tags.
The C++ class edit_dynamic_rep creates tags, activates them and inserts or removes arguments; the Scheme module (source source-edit) binds these commands to ↩, ⇥ and the source menus.
The macro editor ((source macro-widgets)) edits one definition in a small auxiliary buffer and writes it back to the preamble; (source macro-edit) finds definitions in the document and in style files, and (source macro-search) collects the style options and parameters of a tag.
The shortcut editor ((source shortcut-edit)) keeps the user's own keyboard shortcuts in $TEXMACS_HOME_PATH/system/shortcuts.scm.
Typeset/Bridge/bridge.cpp,
Typeset/Env/env_inactive.cpp,
Typeset/Concat/concat_inactive.cpp
Inactive bridges, the rewriting of inactive markup and the drawing of source tags.
Edit/Modify/edit_dynamic.cpp
Creating and activating tags, \ commands and symbols, inserting and removing arguments.
source/source-edit.scm,
source-kbd.scm,
source-menu.scm
Editing commands, keyboard and menus of source mode, extraction of style files.
source/macro-edit.scm,
macro-widgets.scm,
macro-search.scm,
macro-menu.scm
The macro editors and the search of definitions, options and parameters.
source/shortcut-edit.scm,
shortcut-widgets.scm
User keyboard shortcuts.
styles/source.ts,
generic/document-edit.scm,
generic/document-part.scm
The source style, the source tree mode and the preamble of a document.