File: structure.texi

package info (click to toggle)
emacspeak 29.0-9
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 12,904 kB
  • sloc: xml: 55,354; lisp: 48,335; cpp: 2,321; tcl: 1,500; makefile: 936; python: 836; sh: 785; perl: 459; ansic: 241
file content (170 lines) | stat: -rw-r--r-- 8,568 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@c $Id: structure.texi 4397 2007-02-28 15:28:48Z tv.raman.tv $
@node Structured Editing
@section Structured Editing And Templates

Editing documents based on the inherent structure present in the
electronic encoding can be very efficient when using spoken
interaction.  We described mode @emph{ auctex} --- a specialized
interface to authoring LaTeX documents as a special instance of such
structured editing in @pxref{Document Authoring}.

The Emacspeak desktop allows the user to efficiently author and
maintain an electronic document based either on the
structure present in the
markup (as in the case of mode auctex) or on special outlining
constructs that allow the user to impose a desired logical structure
on the document.  This section describes the effect of speech-enabling
such editing tools and points out the advantages in using these in a
speech oriented interface.

Template-based authoring --- a technique that allows the user to create
a document by inserting contents into appropriate positions in a
predefined template--- goes hand in hand with such structured editing.
Finally, structured editing can vastly simplify the creation and
maintenance of structured data, for example, the data present in a UNIX
password file.  Such data files are in fact nothing more than a
collection of database records, where each record (or line) consists of
a set of fields delimited by a special character.  Maintaining such
files without exploiting the underlying structure often tends to be
error prone.  We describe editing modes that can exploit such record
structure to provide a fluent editing interface.  Finally, we outline a
speech-enabled interface to a spreadsheet application as a complex
instance of such structured data editing.




@menu
* Outline Editing ::             Editing and navigating outlines.
* Template-based Authoring::     Creating and Filling Templates.
* Maintaining Structured Data::   Structured Data.
@end menu

@node Outline Editing
@subsection Outline Editing

All of the various outline editing interfaces on the Emacs desktop
allow the user to @emph{ hide} or @emph{ show}
the contents at the different levels of a possibly nested tree
structure.
   Components of this tree structure can be
manipulated as a unit, e.g.,
entire subtrees can be deleted or copied.
Outline editing thus provides an efficient means of obtaining quick
overviews of a document.

The visual interface displays such hidden content as a series of
ellipses following the visible outline heading.  Emacspeak produces
auditory icon @emph{ ellipses} when
speaking such outline headings.

The basic @emph{ outline mode} allows the user to specify the syntax
and level of outline header lines as a regular expression.  This
simple technique can be used to advantage in the structured navigation
of large electronic texts such as those available on the Internet from
online book projects such as project Gutenberg and the Internet
Wiretap.  For example, when this feature is activated while reading
the electronic text of a Shakespearean play, the different acts can be
recognized as separate nodes in the logical structure of the document.
The user can then hide the document body with a single keystroke,
navigate the outline headings to find a particular act, and have that
portion rendered either visually or aurally.  Hiding an outline level
produces auditory icon @emph{ close-object}; exposing a hidden level
produces auditory icon @emph{ open-object}.
For details on using mode @code{outline}, see the relevant section of
the online Emacs info manual.

The basic outline facility described above is applicable to all
content being edited or browsed on the Emacspeak desktop.  In
addition, Emacspeak has  other specialized outline editing
modes such as  @emph{ folding mode} that provide extended
outlining facilities.  In mode
@emph{ folding}, the user can create
(possibly nested) @emph{ folds} --- logical containers of content
that are delimited by a special @emph{ fold mark}.  The fold mark is
typically a text string that is chosen based on the type of content
that is being manipulated.  Thus, when @emph{ folding} a C~program
source file, fold marks are created from C~comments.  The user can
@emph{ open} or @emph{ close} any or all folds in a document, and
these actions
are accompanied by auditory icons @emph{ open-object}
and @emph{ close-object}.  By entering a fold, all editing actions are
restricted to the contents of that fold; this proves a simple yet
convenient way of constraining editing actions such as search and
replace to specific portions of large documents.
Folds can be manipulated as a unit and can be deleted, copied or moved.

Mode @emph{ folding} proves especially effective in maintaining large
software modules.  The technique can be used to advantage by creating
folds for different sections in a module and by further placing each
function appearing in a particular %
section in a fold of its
own.  Complex functions can themselves be folded into sections where
each section reflects a different stage in the algorithm implemented
by that function.  Thus, the technique of folding can be used as an
effective aid in @emph{ literate} programming.  I typically write
software modules by first creating an outline structure using folds
that reflect the various components of that module. Next, I populate
each fold with the function signatures and documentation for the
functions in each section.  When I am satisfied with the overall
architecture of the module, I fill in the function skeletons with
actual program code.  This technique is used extensively in
maintaining  the  Emacspeak code base.


@node Template-based Authoring
@subsection Template-based Authoring


Emacspeak supports two powerful template-based authoring subsystems that
enable the user to quickly create and fill in templates.  @emph{ Dmacro}
(short for ``dynamic macros'') allows the user to define and invoke
template-based macros that are specialized for creating different types
of content.  For example, when programming in C, the user can invoke
dynamic macros that insert skeletons of standard C constructs with a few
keystrokes.  This form of editing has numerous advantages in creating
consistently structured code when developing large software modules.
Emacspeak speech-enables mode @emph{ dmacro} to provide succinct spoken
feedback as templates are created and filled.  The user invokes @emph{
dmacro} via command @emph{ insert dmacro}, which is typically bound to a
single key.  This results in a dialogue where the user is prompted to
pick one of the dynamic macros available in the current context.  If the
users choice can be uniquely completed, that completion is spoken;
otherwise, the list of possible completions based on the available
partial input is spoken, accompanied by auditory icon @emph{ help}.

An alternative template-editing facility is provided by mode  @emph{ tempo}
This mode is designed to  be used in creating
template-based editing tools for specific markup languages; a good
example is mode @emph{ html-helper},
a  mode for creating and updating HTML documents for
publishing on the WWW (see @pxref{Document Authoring}).

@node Maintaining Structured Data
@subsection Maintaining Structured Data


Consider the following entry from file @code{ /etc/passwd}
on my laptop.

@samp{aster:KoUxwQ2:501:100:Aster Labrador:/home/aster:/bin/bash}

 File @code{ /etc/passwd} is a simple instance of a text file
that stores structured data records as a series of fields delimited by
a special character. Each item in the file acquires @emph{
  meaning} from the @emph{ position}  in which it  occurs   for
example, the fifth field contains the @b{ user name}, Aster Labrador.
More generally, structured data where each field in a record has @emph{
  meaning} is found throughout the desktop in applications ranging
from entries in a rolodex to rows in a spreadsheet.

Typically, users do not directly edit the stored representation of the
data. Instead, application front-ends provide a more human-centric
(and hopefully less error prone) user interface for modifying and
maintaining the data. Thus, spreadsheet applications present the data
as a two dimensional table that is automatically updated to reflect
changes in the underlying data. The two dimensional table is perhaps
the most commonly found visual front-end to structured data tables
with row and column headers prove a succinct way of implicitly
displaying the @emph{ meaning} along with the @emph{value} of the
fields making up each data record.