-
Notifications
You must be signed in to change notification settings - Fork 8
/
flisp.html
462 lines (394 loc) · 27 KB
/
flisp.html
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<!DOCTYPE html>
<html lang="en" xml:lang="en">
<head>
<title>fLisp Manual</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" /><meta content="Emacs, editor, Lisp, tiny, reference, manual" name="keywords" /><meta content="Reference and user manual for the fLisp programming language and interpreter" name="description" /><meta content="Georg Lehner <jorge@magma-soft.at>" name="author" /><meta content="2023" name="copyright" />
</head>
<body>
<h1>fLisp Manual</h1>
<h3>Introduction</h3>
<p><i>fLisp</i> is a tiny yet practical interpreter for a dialect of the Lisp programming language. It is used as extension language for the <a href="https://github.com/matp/tiny-lisp">Femto</a> text editor.</p>
<p><i>fLisp</i> originates from <a href="https://github.com/matp/tiny-lisp">Tiny-Lisp by matp </a>(pre 2014), was integrated into <a href="https://github.com/hughbarney/femto">Femto</a> by Hugh Barnes (pre 2016) and compacted by Georg Lehner in 2023.</p>
<blockquote>
<p>A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.</p>
<p>— Antoine de Saint-Exupery</p>
</blockquote>
<h3>Lisp</h3>
<h4>Notation Convention</h4>
<p>fLisp fancies to converge toward Emacs Lisp. Functions descriptions are annoted with a compatibility scale:</p>
<dl>
<dt><u>C</u></dt>
<dd>Interface compatible, though probably less featureful.</dd>
<dt><u>D</u></dt>
<dd>Same name, but different behavior.</dd>
<dt><u>S: <var>name</var></u></dt>
<dd><var>name</var> is a similar but not compatible function in Emacs Lisp.</dd>
<dt><u>B</u></dt>
<dd>Buggy/incompatible implementation.</dd>
</dl>
<p>Annotation is omitted if the function does not exist in Emacs Lisp.</p>
<h4>fLisp Interpreter</h4>
<p>When <i>fLisp</i> is invoked it follows a three step process:</p>
<ol>
<li>Read: program text is read in and converted into an internal representation.</li>
<li>Evaluate: the internal representation is evaluated</li>
<li>Print: the result of the evaluation is returned to the invoker.</li>
</ol>
<p>Core functions of the language operate on internal objects only. The interpreter is extended with additional functions in order to interact with external objects. With respect to the interpreter, extension functions behave the same as core functions.</p>
<h4>Syntax</h4>
<p>Program text is written as a sequence of symbolic expressions - <abbr><dfn>sexp</dfn></abbr>'s in parenthesized form. A sexp is either a single object or a function invocation enclosed in parens. Function invocations can be infinitely nested.</p>
<p>The following characters are special to the reader:</p>
<dl>
<dt><code>(</code></dt>
<dd>Starts a function invocation, <i>list</i> or <i>cons</i> object (see "Objects and Data Types").<br />
</dd>
<dt><code>)</code></dt>
<dd>Finishes a function invocation, <i>list</i> or <i>cons</i> object.<br />
</dd>
<dt><code>"</code></dt>
<dd>Encloses strings.<br />
</dd>
<dt><code>'</code></dt>
<dd>With a single quote prefix before a <i>sexp</i>, the <i>sexp</i> is expanded to <code>(quote <var>sexp</var>)</code> before it is evaluated.</dd>
<dt><code>.</code></dt>
<dd>The expresion<code> (<var>a</var> . <var>b</var>)</code> evaluates to a <i>cons</i> object, holding the objects <var>a</var> and <var>b</var>.</dd>
</dl>
<p>Numbers are represented in decimal notation.</p>
<p>A list of objects has the form:</p>
<blockquote>
<p><code><font face="monospace">(</font></code><font face="monospace">[</font><code><font face="monospace"><var>element</var></font></code><font face="monospace"> ..]</font><code><font face="monospace">)</font></code></p>
</blockquote>
<p>A function invocation has the form:</p>
<blockquote>
<p><code>(<var>name</var> </code>[<code><var>param</var> </code>..]<code>)</code></p>
</blockquote>
<p>There are two predefined objects. Their symbols are:</p>
<dl>
<dt><code>nil</code></dt>
<dd>represents: the empty list: (), the end of a list marker or the false value in logical operations.<br />
</dd>
<dt><code>t</code></dt>
<dd>a fixed, non-false value.</dd>
</dl>
<h4>Objects and Data Types</h4>
<p><i>fLisp</i> objects have exactly one of the following data types:</p>
<dl>
<dt><dfn>number</dfn></dt>
<dd><a href="https://en.wikipedia.org/wiki/Double-precision_floating-point_format">double precision floating point number.</a></dd>
<dt><dfn>string</dfn></dt>
<dd>character array.</dd>
<dt><dfn>cons</dfn></dt>
<dd>object holding two pointers to objects.</dd>
<dt><dfn>symbol</dfn></dt>
<dd>string with restricted character set: <code>[A-Z][0-9][a-z]!#$%&*+-./:<=>?@^_~</code></dd>
<dt><dfn>lambda</dfn></dt>
<dd>anonymous function with parameter evaluation</dd>
<dt><dfn>macro</dfn></dt>
<dd>anonymous function without parameter evaluation</dd>
</dl>
<p>Objects are unmutable, all fLisp functions create new objects from existing ones.</p>
<p>Characters do not have their own type. A single character is represented by a <i>string</i> with length 1.</p>
<h4>Symbols, Environments and Functions</h4>
<p>All operations of the interpreter take place in a root environment. An <dfn>environment</dfn> is a collection of named objects. The object names have the <var>symbol</var> datatype.</p>
<p><var>lambda</var> and <var>macro</var> objects are functions. They have a parameter list and a body. When they are invoked, they receive zero or more named objects, bind them one by one to the symbols in the paramter list, evaluate the body and return a result.</p>
<p>When a function executed within the function body want's to use a named object it is first looked up in the new environment, and then recursively in the environments from which the <var>lambda</var> or <var>macro</var> was invoked.</p>
<p><var>lambda</var>s evaluate each parameter then create a new environment containing the parameters before evaluating the body.</p>
<p><i>macros</i> evaluate the body which typically returns a new expresions in terms of the parameters. The expression is then evaluated in a new environment containing the parameters.</p>
<h4>Functions</h4>
<h5>Interpreter</h5>
<dl>
<dt><code>(progn</code> [<code><var>expr</var></code> ..]<code>)</code></dt>
<dd>Each <var>expr</var> is evaluated, the value of the last is returned.<br />
</dd>
<dt><code>(cond</code> [<code><var>clause</var></code> ..]<code>)</code></dt>
<dd>Each <var>clause</var> is of the form <code>(<var>pred</var> [<var>action</var>])</code>. <code>cond</code> evaluates each <var>clause</var> in turn: if <var>pred</var> evaluates to <code>nil</code>, the next <var>clause</var> is tested. Otherwise: if there is no <var>action</var> the value of <var>pred</var> is returned, otherwise <code>(progn <var>action</var>)</code> is returned and no more <var>clause</var>s are evaluated.</dd>
<dt><code>(setq <var>symbol</var> <var>value</var></code> [<code><var>symbol</var> <var>value</var></code>]..<code>)</code></dt>
<dd>Create or update named objects: If <var>symbol</var> is the name of an existing named object in the current or a parent environment the named object is set to <var>value</var>, if no symbol with this name exists, a new one is created in the current environment. <code>setq</code> returns the last <var>value</var>.</dd>
<dt><code>(lambda <var>params</var> <var>body</var>)</code></dt>
<dd>Returns a <var>lambda</var> function which accepts 0 or more arguments, which are passed as list in the parameter <var>params</var>.</dd>
<dt><code>(lambda (</code>[<code><var>param</var></code> ..]<code>) <var>body</var>)</code></dt>
<dd>Returns a <var>lambda</var> function which accepts the exact number of arguments given in the list of <var>param</var>s.</dd>
<dt><code>(lambda (<var>param</var></code> [<code><var>param</var></code> ..]<code> . opt)</code></dt>
<dd>Returns a <var>lambda</var> function which requires at least the exact number of arguments given in the list of <var>param</var>s. All extra arguments are passed as a list in the parameter <var>opt</var>.</dd>
<dt><code>(macro <var>params</var> <var>body</var>)</code></dt>
<dd>
<p>These forms return a <var>macro</var> function with the same parameter handling as with <var>lambda</var>.</p>
</dd>
<dt><code>(macro (</code>[<code><var>param</var></code> ..]<code>) <var>body</var>)</code></dt>
<dd>
<p>-</p>
</dd>
<dt><code>(macro (<var>param</var></code> [<code><var>param</var></code> ..]<code> . opt)</code></dt>
<dd>
<p>-</p>
</dd>
<dt><code>(quote <var>expr</var>)</code></dt>
<dd>quote returns <var>expr</var> without evaluating it.<br />
</dd>
<dt>(signal symbol list)</dt>
<dd>tbd</dd>
<dt>(trap list)</dt>
<dd>tbd</dd>
<dt> </dt>
<dd> </dd>
</dl>
<h5>Objects</h5>
<dl>
<dt><code>(null <var>object</var>)</code></dt>
<dd>Returns <code>t</code> if <var>object</var> is <code>nil</code>, otherwise <code>nil</code>.</dd>
<dt><code>(symbolp <var>object</var>)</code><span style="display: none;"> </span><span style="display: none;"> </span></dt>
<dd>Returns <code>t</code> if <var>object</var> is of type <i>symbol, </i>otherwise <code>nil</code>.</dd>
<dt><code>(symbol-name <var>object</var>)</code></dt>
<dd>If <var>object</var> is of type <i>symbol</i> return its value as string.</dd>
<dt><code>(numberp <var>object</var>)</code></dt>
<dd>Returns <code>t</code> if <var>object</var> is of type <i>number</i>, otherwise <code>nil</code>.</dd>
<dt><code>(stringp <var>object</var>)</code> Returns <code>t</code> if <var>object</var> is of type <i>string</i>, otherwise <code>nil</code>.</dt>
<dd> </dd>
<dt><code>(consp <var>object</var>)</code></dt>
<dd>Returns <code>t</code> if <var>object</var> is of type <i>cons</i>, otherwise <code>nil</code>.</dd>
<dt><code>(cons <var>car</var> <var>cdr</var>)</code></dt>
<dd>Returns a new <i>cons</i> with the first object set to the value of <var>car</var> and the second to the value of <var>cdr</var>.</dd>
<dt><code>(car <var>cons</var>)</code></dt>
<dd>Returns the first object of <var>cons</var>.</dd>
<dt><code>(cdr <var>cons</var>)</code></dt>
<dd>Returns the second object of <var>cons</var>.</dd>
<dt><code>(eq <var>a</var> <var>b</var>)</code></dt>
<dd>Returns <code>t</code> if <var>a</var> and <var>b</var> evaluate to the same object, <code>nil</code> otherwise.</dd>
<dt><code>(print <var>object</var>)</code></dt>
<dd>Formats <var>object</var> into a string which can be read by the reader and returns it. As a side effect, the string is printed to the output stream with a leading and a closing newline. <code>print</code> escapes quotes in strings with a backslash.</dd>
<dt><code>(princ <var>object</var>)</code></dt>
<dt>Formats <var>object</var> into a string and returns it, As a side effect, the string is printed to the output stream.</dt>
</dl>
<h5>String operations</h5>
<dl>
<dt><code>(string.length <var>string</var>)</code></dt>
<dd>Returns the length of <var>string</var> as a <i>number</i>.</dd>
<dd> </dd>
<dt><code>(string.substring <var>string</var> <var>start</var> <var>end</var>)</code></dt>
<dd>Returns the substring from <var>string</var> which starts with the character at index <var>start</var> and ends with index <var>end</var>. String indexes are zero based.</dd>
<dt><code>(string.append <var>string1</var> <var>string2</var>)</code></dt>
<dd>Returns a new string consisting of the concatenation of <var>string1</var> with <var>string2</var>.<br />
</dd>
<dt><code>(string-to-number <var>string</var>)</code></dt>
<dd>Converts <var>string</var> into a corresponding <i>number</i> object. String is interpreted as decimal based integer.</dd>
<dt><var><code>(number-to-string number)</code></var></dt>
<dd>Converts <var>number</var> into a <i>string</i> object.<br />
</dd>
<dt><code>(ascii <var>number</var>)</code></dt>
<dd>Converts <var>number</var> into a <i>string</i> with one character, which corresponds to the ASCII representation of <var>number</var>.<br />
</dd>
<dt><code>(ascii->number <var>string</var>)</code></dt>
<dd>Converts the first character of <var>string</var> into a <i>number</i> which corresponds to its ASCII value.</dd>
<dt> </dt>
</dl>
<h5>Arithmetic Operations</h5>
<dl>
<dt><code>(+</code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>Returns the sum of all <var>arg</var>s or <code>0</code> if none given.</dd>
<dt><code>(*</code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>Returns the product of all <var>arg</var>s or <code>1</code> if none given.</dd>
<dt><code>(-</code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>Returns 0 if no <var>arg</var> is given, -<var>arg</var> if only one is given, <var>arg</var> minus the sum of all others otherwise.</dd>
<dt><code>(/ <var>arg</var></code> [<code><var>div</var></code> ..]<code>)</code></dt>
<dd>Returns 1/<var>arg</var> if no <var>div</var> is given, <var>arg</var>/<var>div</var>[/<var>div</var>../] if one or more <var>div</var>s are given, <code>inf</code> if one of the <var>div</var>s is <code>0</code> and the sum of the signs of all operands is even, <code>-inf</code> if it is odd.</dd>
<dt><code>(% <var>arg</var></code> [<code><var>div</var></code> ..]<code>)</code></dt>
<dd>Returns <code>1</code> if no <var>div</var> is given, <var>arg</var>%<var>div</var>[%<var>div</var> ..] if one or more <var>div</var>s are given. If one of the divs is <code>0</code>, the program exits with an arithmetic exception.</dd>
<dt><code>(= <var>arg</var></code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>-<br />
</dd>
<dt><code>(< <var>arg</var></code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>-<br />
</dd>
<dt><code>(> <var>arg</var></code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>-<br />
</dd>
<dt><code>(<= <var>arg</var></code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>-<br />
</dd>
<dt><code>(>= <var>arg</var></code> [<code><var>arg</var></code> ..]<code>)</code></dt>
<dd>These predicate functions apply the respective comparison operator between all <var>arg</var>s and return the respective result as <code>t</code> or <code>nil</code>.</dd>
</dl>
<h3>Editor Extensions</h3>
<h4>Buffers</h4>
<p>Buffers store text and allow to manipulate it. A buffer has the following properties:</p>
<dl>
<dt><var>Name</var></dt>
<dd>Buffers are identified by their name. If a buffer name is enclosed in *asterisks* the buffer receives special treatment.</dd>
<dt><var>Text</var></dt>
<dd>0 or more characters.</dd>
<dt><var>Point</var></dt>
<dd>The position in the text where text manipulation takes place.</dd>
<dt><var>Mark</var></dt>
<dd>An optional second position in the text. If the <var>mark</var> is set, the text between <var>point</var> and <var>mark</var> is called the <dfn>selection</dfn> or <dfn>region</dfn>.</dd>
<dt><var>Filename</var></dt>
<dd>A buffer can be associated with a file.</dd>
<dt><var>Flags</var></dt>
<dd>Different flags determine the behaviour of the buffer.</dd>
</dl>
<p>This section describes the buffer related functions added by Femto to fLisp. The description is separated in function related to buffer management and text manipulation. Buffer management creates, deletes buffers, or selects one of the existing buffers as the <q>current</q> buffer. Text manipulation always operates on the current buffer.</p>
<p>Femto provides a single temporary string storage named <dfn>clipboard</dfn> to support text manipulation.</p>
<h5>Text manipulation</h5>
<dl>
<dt><code>(insert-string <var>string</var>)</code></dt>
<dd>Inserts <var>string</var> at <i>point</i>. <u>S: insert</u>.</dd>
<dt><code>(insert-file-contents-literally <var>string</var> </code>[<code><var>flag</var></code>]<code>)</code></dt>
<dd>
<p>Inserts the file <var>string</var> after <i>point</i>. If <var>flag</var> is not nil the buffer is marked as not modified. <u>B</u></p>
</dd>
<dd>
<p>Note: Currently the flag is forced to nil. The function should return <code>(<var>filename</var> <var>count</var>)</code> but it returns a flag indicating if the operation succeeded.</p>
</dd>
<dt><code>(erase-buffer)</code></dt>
<dd>Erases all text in the current buffer. <u>C</u></dd>
<dt><code>(delete)</code></dt>
<dd>Deletes the character after <i>point</i>. <u>S: delete-char</u></dd>
<dt><code>(backspace)</code></dt>
<dd>Deletes the character to the left of <i>point</i>. <u>S: delete-backward-char</u></dd>
<dt><code>(get-char)</code></dt>
<dd>Returns the character to the left of <i>point</i>. <u>S: get-byte</u></dd>
<dt><code>(copy-region)</code></dt>
<dd>Copies <i>region</i> to the <i>clipboard</i>. <u>S: copy-region-as-kill</u></dd>
<dt><code>(kill-region)</code></dt>
<dd>Deletes the text in the <i>region</i> and copies it to the <i>clipboard</i>. <u>D</u></dd>
<dt><code>(yank)</code></dt>
<dd>Pastes the <i>clipboard</i> before <i>point</i>. <u>C</u></dd>
</dl>
<h5>Selection</h5>
<dl>
<dt>(set-mark)</dt>
<dd>Sets <var>mark</var> to <var>point</var>. <u>D</u></dd>
<dt>(get-mark)</dt>
<dd>Returns the position of <var>mark</var>, -1 if <var>mark</var> is unset. <u>S: mark</u></dd>
<dt>(get-point)</dt>
<dd>Returns the position of <var>point</var>. <u>S: point</u></dd>
<dt>(get-point-max)</dt>
<dd>Returns the maximum accessible value of point in the current buffer. <u>S: point-max</u></dd>
<dt><code>(set-clipboard <var>variable</var>)</code></dt>
<dd><code>Sets <i>clipboard</i> to the contents of <var>variable</var>.</code> <u>S: gui-set-selection</u></dd>
<dt><code>(get-clipboard)</code></dt>
<dd>Returns the <i>clipboard</i> contents. <u>S: gui-get-selection</u></dd>
</dl>
<h5>Cursor Movement</h5>
<dl>
<dt><code>(set-point <var>number</var>)</code></dt>
<dd>Sets the point to in the current buffer to the position <var>number</var>. <u>S: goto-char</u></dd>
<dt><code>(goto-line <var>number</var>)</code></dt>
<dd>Sets the point in the current buffer to the first character on line <var>number</var>. <u>S: goto-line</u>, not an Elisp function.</dd>
<dt><code>(search-forward <var>string</var>)</code></dt>
<dd>Searches for <var>string</var> in the current buffer, starting from point forward. If string is found, sets the point after the first occurrence of <var>string</var> and returns <samp>t</samp>, otherwise leaves point alone and returns <samp>nil</samp>. <u>D</u></dd>
<dt><code>(search-backward <var>string</var>)</code></dt>
<dd>Searches for <var>string</var> in the current buffer, starting from point backwards. If string is found, sets the point before the first occurrence of <var>string</var> and returns <samp>t</samp>, otherwise leaves point alone and returns <samp>nil</samp>. <u>D</u></dd>
<dt><code>(beginning-of-buffer)</code></dt>
<dd>Sets the point in the current buffer to the first buffer position, leaving mark in its current position. <u>C</u></dd>
<dt><code>(end-of-buffer)</code></dt>
<dd>Sets the point in the current buffer to the last buffer position, leaving mark in its current position. <u>C</u></dd>
<dt><code>(beginning-of-line)</code></dt>
<dd>Sets point before the first character of the current line, leaving mark in its current position. <u>S: move-beginning-of-line</u></dd>
<dt><code>(end-of-line)</code></dt>
<dd>Sets point after the last character of the current line, i.e. before the end-of-line character sequence, leaving mark in its current position. <u>S: move-end-of-line</u></dd>
<dt><code>(forward-word)</code></dt>
<dd>Moves the point in the current buffer forward before the first char of the next word. If there is no word left the point is set to the end of the buffer. If the point is already at the start or within a word, the current word is skipped. <u>D</u>: <b>Note</b>: Elisp moves to the <em>end</em> of the the next word.</dd>
<dt><code>(backward-word)</code></dt>
<dd>Moves the point in the current buffer backward after the last char of the previous word. If there is no word left the point is set to the beginning of the buffer. If the point is already at the end or within a word, the current word is skipped. <u>D</u>: <b>Note</b>: Elisp moves to the <em>beginning</em> of the previous word.</dd>
<dt><code>(forward-char)</code></dt>
<dd>Moves the point in the current buffer one character forward, but not past the end of the buffer. <u>C</u></dd>
<dt><code>(backward-char)</code></dt>
<dd>Moves the point in the current buffer one character backward, but not before the end of the buffer. <u>C</u></dd>
<dt><code>(forward-page)</code></dt>
<dd>Moves the point of the current buffer to the beginning of the last visible line of the associated screen and scrolls the screen up to show it as the first line. <u>S: scroll-up</u></dd>
<dt><code>(backward-page)</code></dt>
<dd>Moves the point of the current buffer to the beginning of the first visible line of the associoated screen and scrolls the screen down to show it as the last line. <u>S: scroll-down</u></dd>
<dt><code>(next-line)</code></dt>
<dd>Moves the point in the current buffer to the same character position in the next line, or to the end of the next line if there are not enough characters. In the last line of the buffer moves the point to the end of the buffer. <u>C</u></dd>
<dt><code>(previous-line)</code></dt>
<dd>Movest the point in the current buffer to the same character position in the previous line, or to the end of the previous line if there are not enough characters. In the first line of the buffer the point is not moved. <u>C</u></dd>
</dl>
<h5>Buffer management</h5>
<dl>
<dt><code>(list-buffers)</code></dt>
<dd>Lists all the buffers in a buffer called <samp>*buffers*</samp>.</dd>
<dt><code>(get-buffer-count)</code></dt>
<dd>Returns the number of buffers, includes all special buffers and <samp>*buffers*</samp>.</dd>
<dt><code>(select-buffer <var>string</var>)</code></dt>
<dd>Makes the buffer named <var>string</var> the current buffer. Note: <u>C</u> to <code>set-buffer</code> in Elisp.</dd>
<dt><code>(rename-buffer <var>string</var>)</code></dt>
<dd>Rename the current buffer to <var>string</var>. <u>C</u></dd>
<dt><code>(kill-buffer <var>string</var>)</code></dt>
<dd>Kill the buffer names <var>string</var>. Unsaved changes are discarded. <u>C</u></dd>
<dt><code>(get-buffer-name)</code></dt>
<dd>Return the name of the current buffer. Note: <u>C</u> to <code>buffer-name</code> in Elisp.</dd>
<dt><code>(add-mode-global <var>string</var>)</code></dt>
<dd>Sets global mode <var>string</var> for all buffers. Currently the only global mode is <kbd>undo</kbd>.</dd>
<dt><code>(find-file <var>string</var>)</code></dt>
<dd>Loads file with path string into a new buffer. <u>C</u></dd>
<dt><code>(save-buffer <var>string</var>)</code></dt>
<dd>Saves the buffer named <var>string</var> to disk. <u>C</u></dd>
</dl>
<h4>User Interaction</h4>
<dl>
<dt><code>(message <var>string</var>)</code></dt>
<dd>Displays <var>string</var> in the message line. <u>D</u> </dd>
<dt><code>(clear-message-line)</code></dt>
<dd>Displays the empty string in the message line.</dd>
<dt><code>(prompt <var>prompt</var> <var>default</var>)</code></dt>
<dd>Displays <var>prompt</var> in the command line and sets <var>default</var> as initial value for the user respones. The user can edit the response. When hitting return, the final response is returned.</dd>
<dt><code>(show-prompt <var>prompt</var> <var>default</var>)</code></dt>
<dd>Displays <var>prompt</var> and <var>default</var> in the commandline, but does not allow editing. Returns <samp>t</samp>.</dd>
<dt><code>(prompt-filename <var>prompt</var>)</code></dt>
<dd>Displays <var>prompt</var> in the commandline and allows to enter or search for a file name. Returns the relative path to the selected file name or the response typed by the user.</dd>
<dt><code>(getch)</code></dt>
<dd>Waits for a key to be pressed and returns the key as string. See also <code>get-key-name</code>, <code>get-key-funcname</code> and <code>execute-key</code>.</dd>
<dt>(exit)</dt>
<dd>Exit Femto without saving modified buffers.</dd>
</dl>
<h5>Keyboard Handling</h5>
<dl>
<dt><code>(set-key <var>key-name</var> <var>lisp-func</var>)</code></dt>
<dd>Binds key key-name to the lisp function <var>lisp-func</var>.</dd>
<dt><code>(get-key-name)</code></dt>
<dd>Returns the name of the currently pressed key, eg: <samp>c-k</samp> for control-k.</dd>
<dt><code>(get-key-funcname)</code></dt>
<dd>Return the name of the function bound to the currently pressed key.</dd>
<dt><code>(execute-key)</code></dt>
<dd>Executes the function of the last bound key. <mark>Tbd. bound or pressed?</mark></dd>
<dt><code>(describe-bindings)</code></dt>
<dd>Creates a listing of all current key bindings, in a buffer named <samp>*help*</samp> and displays it in a new window. <u>C</u></dd>
<dt><code>(describe-functions)</code></dt>
<dd>Creates a listing of all functions bound to keys in a buffer named <samp>*help*</samp> and displays it in a new window.</dd>
</dl>
<h5>Window Handling</h5>
<dl>
<dt><code>(delete-other-windows)</code></dt>
<dt> Make current window the only window. <u>C</u></dt>
<dd> </dd>
<dt><code>(split-window)</code></dt>
<dd>Splits the current window. Creates a new window for the current buffer. <u>C</u></dd>
<dt><code>(other-window)</code></dt>
<dd>Moves the cursor to the next window down on the screen. Makes the buffer in that window the current buffer. <u>D</u></dd>
<dd>Note: Elisp <code>other-window</code> has a required parameter <var>count</var>, which specifies the number of windows to move down or up.</dd>
<dt><code>(update-display)</code></dt>
<dd>Updates all modified windows.</dd>
<dt><code>(refresh)</code></dt>
<dd>Updates all windows by marking them modified and calling <code>update-display</code>.</dd>
</dl>
<h5>Programming and System Interaction</h5>
<dl>
<dt><code>(eval-block)</code></dt>
<dd>Evaluates the <var>region</var> in the current buffer, inserts the result at <var>point</var> and returns it. If <var>mark</var> in the current buffer is before <var>point</var> <code>eval-block</code> evaluates this <var>region</var> and inserts the result at <var>point</var>. If <var>point</var> is before <var>mark</var> <code>eval-block</code> does nothing but returning <samp>t</samp>.</dd>
<dt><code>(system <var>string</var>)</code></dt>
<dd>Executes the <a href="https://man7.org/linux/man-pages/man3/system.3.html">system(1)</a> function with <var>string</var> as parameter.</dd>
<dt><code>(os.getenv <var>string</var>) </code></dt>
<dd>Returns the value of the environment variable named <var>string</var>.</dd>
<dt><code>(log-message <var>string</var>)</code></dt>
<dd>Logs <var>string</var> to the <samp>*messages*</samp> buffer. </dd>
<dt><code>(log-debug <var>string</var>)</code></dt>
<dd>Logs string to the file <code>debug.out</code>.</dd>
<dt><code>(get-version-string)</code></dt>
<dd>Returns the complete version string of Femto, including the copyright.</dd>
<dt>
<h3>Implementation Details</h3>
<p><mark>Tbd.: Memory consumption, limits, hacking, ...</mark></p>
</dt>
</dl>
</body>
</html>