1
This file documents version 2.9 of logo.el.
3
Logo.el is written for GNU Emacs 20.5 or newer, running under X11.
4
You will (of-course) need Berkeley Logo (*v5.1* or newer) installed on
7
It is *not* designed to be used with Xemacs, Gnu Emacs compiled
8
without X support or Gnu Emacs started with -nw option. The last two
9
will partly work, but I did not test it that way.
16
Installing the Berkeley Logo package installs Logo-mode also. See the
17
README file in the main ucblogo directory.
19
EACH USER who wants to use Logo-mode must run the shell command
23
------------------------------------------------
25
Description of options for fine-tuning:
27
Set this to change the size of the frame (window) for
28
Logo-inferior-process buffer. If these forms are not present, the size
29
is set to 80x24. (This will work properly only with ucblogo 5.1 or
32
(setq logo-term-columns nn)
33
(setq logo-term-rows mm)
35
Where nn and mm is whatever makes you happy.
38
By default logo-mode will indent continued lines in logo (edit) buffer
39
when RET-urn key is pressed. To insert a newline without indenting use
40
LFD (C-j) key. To reverse this behavior (reverse should probably be
41
considered "normal" behavior), add this form.
43
(setq logo-standard-indent t)
46
By default logo-mode starts with syntax highlighting enabled. If you
47
do not want it, set this:
49
(setq logo-syntax-highlight nil)
51
If you feel that the default syntax highlighting is slowing your system
54
(setq logo-lazy-lock-mode t)
57
By default logo-mode starts with novice command management enabled. If
58
you don't want it set this:
60
(setq logo-novice-management nil)
63
By default logo-mode will start Logo process in setcursor mode. To
64
change this permanently set:
66
(setq logo-setcursor-start nil)
69
Default text input mode in setcursor mode is set to overwrite. To
70
change this permanently set:
72
(setq logo-setcursor-overwrite nil)
75
By default, the old text, after recalling the previous input in
76
setcursor mode will be cleared to the end of the line. If that gets in
79
(setq logo-setcursor-spaces-old n)
81
where n is from 0 to any number. However, spaces are never pushed beyond
85
By default two spaces are pushed ahead of end of the new input in
86
setcursor mode. If that gets in your way, set this:
88
(setq logo-setcursor-spaces-new n)
90
where n is from 0 to any number. However, spaces are never pushed beyond
94
If emacs lags behind during indenting Logo procedures, or simply when
95
hitting return key (you must be working on a *very* slow system to
96
notice this last one), add this form.
98
(setq logo-unbalanced-distance 4096)
100
On a very slow machine go down to 2048. By default, this is set to
101
8192, but it is doubtful that you will ever write a single implicitly
102
continued logo line that will be 8K long.
105
If you have installed ucblogo info files translated into another language,
108
(setq logo-info-file-trans "/your-info-path/file-name.info")
110
However, for this to work - somebody has to write translation first. To the
111
best of my knowledge only Croatian translation exists. Therefore by default
112
this is set to "/usr/local/info/ucbl-hr.info" . If you change this to another
113
language you must also update the `Help' menu entry by setting this:
115
(setq logo-info-trans "(De)")
117
This "(De)" would be in case your translation is German, but you can use
118
longer words as well. By default this is set to "(Hr)".
119
If you don't care for this at all, set
121
(setq logo-info-trans nil)
123
With this set menu entry for translated manual will disappear.
126
By default emacs enables changes to Logo language through
127
Logo>>Language, and Logo>>Compiler menus. This has to do with .loops
128
initialization file. If you do not want to use this facility, set
131
(setq logo-load-language nil)
134
Logo mode automatically sets the depth of setcursor input history menu
135
to safe value for the display resolution it is running on. (20 entries
136
for 640x480, 25 for 800x600 ...) To change this set following:
138
(setq logo-dynamic-menu-depth n)
140
where n is any number (up to ... 48). However note that if you use
141
larger number, (depending on your display resolution, and emacs font
142
size) you may not be able to see nor use all menu entries.
145
If you don't want me messing with your default emacs colors, then
148
(setq dont-mess-with-logo-colors t)
151
If you don't want parens matching on cursor movement, then set this line:
153
(setq logo-flash-on-movement nil)
156
If you want to change the delay after matching parentheses on cursor
157
movement, set this to any number of seconds you wish:
159
(setq logo-matching-delay-time seconds)
161
Default delay is set to 2 seconds, but even a very long delay -- say,
162
5 seconds would be OK, as you don't have to wait for it to
163
complete. Delay will be reset if you move the cursor again.
165
By default logo-mode starts with automatic expansion of common Logo
166
abbreviations enabled, If you do not want this, set:
167
(setq logo-expand-common-abbrevs nil)
169
For those that are translating Logo primitive names into another
170
language, (I know that the translation into French is underway), add
171
this form to enable the expansion of new primitives:
173
(define-abbrev-table 'logo-mode-abbrev-table
179
of course, using your new names instead of those used here.
181
4. There are several other options settable in .emacs file, but they
182
deal mostly with problem corrections. If I have done my work properly,
183
and if you have installed ucblogo (release 5.1 or newer) as instructed
184
in ucblogo README file, they will not be necessary. Read logo.el file
185
(first five pages) for the description of other options. (For instance
186
if Emacs can't find Logo help files, debug menu doesn't work etc. ...)
190
========================================
191
USING BERKELEY LOGO WITH EMACS LOGO MODE
192
========================================
194
To start logo mode, open one Logo source file in emacs. As far as
195
emacs is concerned Logo source file is the file that ends with .lg ,
196
.lgo , or a file that has this `;;; -*- logo -*-' on a first line.
198
Start ucblogo from a `Logo-start' menu. You can start Logo in `Other
199
Frame',or `Same Window'. The *BEST* way is `Other Frame', and I
200
definitely suggest using it. (The `Same Window' is given for archaic
201
reasons only.) Due to availability of setcursor mode I insist on a
202
minimum window (frame) size when Logo starts -- 81x26 (that is if the
203
usable size is left at 80x24). Do not change frame size of Inferior
204
Logo buffer (by dragging corners with the mouse), or Logo output will
205
be garbled. On the other hand - stretching the height of Logo edit
206
frame is perfectly OK.
208
Editing and sending Logo source code:
209
=====================================
210
You write Logo code in Logo edit buffer. All standard emacs editing
211
features are supported here. The notable difference from standard
212
behavior is automatic indenting bound to RET (enter) key. You can
213
check special Logo editing features by pulling down `Logo-edit'
214
menu. All functions that are bound to a key sequence will show that
215
sequence as well. To see commands for sending source code (or parts of
216
it) to Logo, pull down `Logo-send' menu. Choices that are shaded (in
217
all of these menus) denote that this option is presently not
218
available. For instance if `Send Region' is shaded it simply means
219
that no region has been selected.
221
You can have several source files opened, but only one Logo process
222
buffer. That is the reason for all three choices on `Logo-start' menu
223
being shaded after you have started Logo.
225
Syntax highlighting is turned on by default (unless you have disabled
226
it in .emacs file). However you can always turn it off/on with `Toggle
227
Syntax Highlighting' choice in `Logo-edit' pull-down menu.
229
Following syntax classes are highlighted:
230
Comments - (red) text.
231
Strings - (brown) text.
232
Start and end of Logo procedure definition (TO .MACRO DEFINE .DEFMACRO
234
Variables (actually :var.name) - (light blue) text.
236
Highlighting of beginning and end of Logo definitions is not so
237
dependable as functions that mark procedure boundaries (used for code
238
indenting and sending). TO, .MACRO, and END will not be highlighted if
241
For `adventurous' novices (meaning mostly Emacs novices) I have
242
included novice command management feature. This simply tags
243
potentially dangerous commands, and they are not executed
244
immediately. Instead, emacs will pop a window with warning, and basic
245
instructions what to do next. You can still execute the command if you
246
decide so. If you find this disturbing (I do) then turn it off with
247
Logo-edit>>Preferences>>Toggle Novice Management choice from menu-bar,
248
or set it permanently in .emacs file.
250
Interacting with Logo:
251
======================
252
To run and test your procedures switch to Inferior Logo buffer. If you
253
have started Logo in `Same Window', to switch -- you have to use
254
`C-c l'. Otherwise simply move the mouse pointer to Logo buffer.
256
The usual goodies from Scheme (or Lisp modes) are present in Logo mode
257
as well. You can step with `M-p' / `M-n' (C-up / C-down, should also
258
work, if not trapped by your Window Manager) through the previous
259
inputs to Logo in all modes, and edit these inputs as you wish. When
260
finished with editing (input) simply hit Return key wherever you are
261
in the input line. Emacs will correctly grab the whole input and send
262
it to Logo. You can use S-down-mouse-2 (shift and press mouse-2)
263
anywhere on the Inferior Logo window to pop-up the `List Input
264
History' menu. Release mouse on any of the entries, and that input
265
will be inserted on command line.
267
Several standard editing keys work "slightly" different in Inferior
268
Logo mode. Delete and Backspace keys work only within current command
269
(input) line. Kill and yank (paste) commands work only on input line,
270
by killing or yanking the whole input. Do not bother aiming with the
271
mouse accurately. No matter where you are in Inferior Logo buffer,
272
mouse-2 will paste new input line, overwriting the old line. The old
273
input is cleared, so don't try pasting two inputs hoping they will
274
concatenate. You can not tell emacs where is the end of input line,
275
by positioning the point there. That is chosen
276
automatically. (Actually this is not entirely true -- if emacs ever
277
gets hopelessly confused about the position of logo-input-marker, you
278
can set it manually with `C-@'.) The whole purpose for this yanking
279
(pasting) business is to transfer input lines from other applications
280
running on your X display, therefore X-selection always takes
281
precedence over emacs kill-ring. (To retrieve previous inputs from
282
your current Logo/logo-mode session use `M-p' instead.)
284
Probably the *most useful* key to remember in Inferior Logo mode is
285
`C-l'. This is not bound to `recenter' as in the rest of logo-mode
286
buffers, but to `logo-find-input-end' which takes you back to the end
287
of Logo command line (in case you had wondered off).
289
To stop a "runaway" Logo hit `C-c C-c' in Inferior Logo buffer. If this
290
doesn't work use one of the choices from from `Signals' pull-down menu
292
`BREAK' (`C-c C-c') to which Logo should respond with "Stopping..."
293
`QUIT' to which Logo should respond with "Pausing..."
294
`KILL' to which emacs responds with "Process logo killed"
295
Signals menu is not part of logo.el, so there are no Logo specific
296
choices there - it is built into comint mode.
298
You do not have to worry (as you should if using Logo without
299
logo-mode) about saving your source files before you test any of
300
them. Even if Logo crashes in Inferior Logo buffer (with a message
301
like ... segmentation fault ...), your sources are still intact in
302
Logo edit buffer. Simply restart Logo with `Logo-start' menu, and
303
re-send your procedures to it with any of the choices on `Logo-send'
306
Workspace Management:
307
=====================
308
To choose procedures for tracing or stepping, use `Logo-debug'
309
sub-menu under `Logo' pull-down menu in Inferior Logo buffer. Debug
310
buffer lists all names currently defined, and lets you select
311
procedures (variables or properties) for tracing or stepping. Mouse
312
bindings are as in XFM. Mouse-1 selects only the pointed name
313
(de-selects everything else), mouse-2 toggles the selection for the
314
name, mouse-3 selects pointed name, quits debug-buffer and sends all
315
selected names to Logo. `q' key also quits debug-buffer and sends all
316
selected names to Logo. When you open `Trace...' or `Step...' menus,
317
the names that were traced or stepped before will be highlighted (and
318
placed in parentheses).
320
The last entry under `Logo>>Logo-debug' menu is `Erase'. You can mark
321
(with the same mechanism as for tracing); procedures, variables or
322
plists for erasing. After `q' key is pressed, marked names will be
323
erased from Logo workspace, and GC will run automatically. To check
324
which is the buffer you're actually working with (trace, step or
325
erase), as all three look alike -- read the buffer mode line. For
326
erase buffer it will state: `(Fundamental Logo-ERASE View)' etc.
330
Logo-mode has a very simple help system.
332
Help works in source buffers. Press mouse-3 on any valid Logo name,
333
and the help file (for that procedure) will open. To exit hit `q'. If
334
the help for the procedure doesn't exist, HELPCONTENTS file will be
335
opened. There you can choose as many help files as you want (with
336
mouse-3). Hit `q' in HELPCONTENTS to return to the source file. If you
337
want to check HELPCONTENTS, either click mouse-3 on a word which is not
338
defined in Logo, or use `Logo-help' sub-menu on emacs `Help' pull-down
339
menu. This option is available only on Logo edit frame menu bar.
341
To get better organized and more comprehensive help, browse through
342
Logo User Manual by pulling down the `Help' menu and choosing from
343
`Logo-help' sub-menu, `User Manual'. That will work if you have
344
installed ucblogo.info files (normally installed automatically). To
345
exit from Logo User Manual buffer hit `q'.
347
To get help for logo-mode itself hit `C-h m' in any of emacs logo mode
350
Although completion facilities are not part of the help system, you
351
can regard them as such. Two types of completion are available in logo
352
edit buffers. Completion for Logo keywords (actually standardly
353
defined names of Logo primitive and library procedures) and completion
354
for words that were already used in any of opened logo edit buffers.
356
To perform completion for Logo keywords write a few starting letters
357
and hit ESC TAB. This will open a window with a list of all possible
358
Logo keyword completions. Click mouse-2 on the one you want, and your
359
keyword will be completed in edit buffer.
361
To perform completion on a word that is not standardly defined Logo
362
name (this works both in edit and Logo process buffers), write a few
363
letters, and hit M-/ (Alt-/). If possible, emacs will complete the
364
word with the word you have used before in this, or any other Logo
365
buffer currently opened. If there are more possible completions,
366
cycle through them by repeatedly pressing M-/, until you find the one
367
you want. The other way to accomplish the same result is to hit C-M-/
368
(Ctrl-Alt-/) and emacs will open a window with all available
369
completions listed. Click mouse-2 on the one you want.
371
Logo common abbreviations are expanded when one of these characters
372
is entered after the word that constitutes abbreviation: space,
373
newline, ], }, and ). To disable this in the current session click on
374
Logo-Edit>>Preferences>>Toggle Abbreviation Expansion. You can
375
reactivate expansion using the same menu. Current state of
376
abbreviation expansion is visible on the mode line; if it reads
377
(Logo), expansion is disabled, if it reads (Logo Abbrev) it is
378
enabled. If you want to disable the expansion only on the current
379
word, escape the character that triggers the expansion. E.g.: if you
380
do not want to expand OP to OUTPUT after hitting space key, press
381
escape key, and then the space key. The expansion will not occur this
382
time, but next time you hit space after the abbreviation, the
383
expansion will be carried out.
385
Obvious *NOT To DOs* when running Logo in Logo mode:
386
====================================================
387
Entering `edit "whatever' in Inferior Logo buffer defeats the purpose
388
of using Logo mode. Whatever you edit this way will be lost (unless you
389
save it manually). You will not be able to use logo-mode editing
390
features this way, even if your EDITOR environment variable is set to
391
emacs. This will also block Logo -- no interaction from other
392
logo-mode buffers will be possible.
394
Entering `load "whatever' in Inferior Logo buffer is not the right way
395
to do it. Use `Open Logo File...' choice from `Files>>Logo-mode Files'
396
pull-down menu in Logo edit buffer. Emacs will pop-up a new frame
397
(that is, if you started Logo with `Run Logo Other Frame') and drop it
398
in a `Dired' mode, with default directory (the directory where the
399
first source file resides) displayed. Then choose (mouse-2) the
400
desired file. This way you can see both source files at the same
401
time. To send this file to Logo, simply hit `C-c b'. If you opened
402
Logo source file that neither has the `.lg' extension, nor Logo
403
mode-line as the first line, use `Files>>Logo-mode Files>>Convert to
404
Logo-mode' choice from the pull-down menu. (Only files opened in
405
fundamental mode can be converted.)
407
If you started Logo with `Run Logo Same Window' choice, you can still
408
have several source files opened. Switch between them with `C-c l' key
409
using prefix. (If you have three files opened `C-u 1 C-c l' switches
410
from Inferior Logo buffer to the newest source buffer, and `C-u 3 C-c
411
l' switches to the oldest buffer -- or just use emacs `Buffers' menu
414
There is no need to use help, trace or step Logo commands
415
manually. They can't hurt, but logo-mode provides interactive, mouse
416
driven interface, which is easier to use.
418
Do not define Logo procedures by typing them directly to Logo in
419
Inferior Logo buffer. This will work OK, but you will not be able to
420
change them later on. `M-p' will retrieve them line by line, and not
421
as a whole definition. Instead, simply enter definitions in Logo edit
422
buffer and send them over with `C-M-x'. The key-chord C-M-x
423
(Ctrl-Alt-x) will not always work, and as it is the most frequently
424
used keyboard shortcut (much faster than using Send Definition from
425
Logo-send menu), additional instructions are in order. Some window
426
managers (KDE 2.1 for instance) use this same combination for their
427
own purposes, and will therefore intercept this key-chord. You can
428
still use Esc C-x combination (Esc always works in the place of Meta
429
or Alt key), but this is much slower that C-M-x. The only way to
430
restore the functionality of C-M-x in logo mode is to disable this key
431
combination in the KDE Control Center.
433
If you have been using SETCURSOR command in Inferior Logo mode, and
434
Inferior Logo buffer is cluttered with old text, do *not* try to clear
435
the buffer using emacs. Instead, use Logo to do the job -- enter `ct'
436
(CLEARTEXT) command on Logo input line.
438
Not so obvious *NOT To DOs*:
439
============================
440
Do not leave blank lines (spaces only) inside Logo string
441
constants. Indenting and procedure sending functions in logo-mode depend
442
on this. If you really need a blank line in Logo string, you can use this:
454
As far as Logo is concerned, result is the same. Logo-mode, however will
455
malfunction on the second.
457
Although you can leave blank lines and comment lines (comments only)
458
inside procedure definitions in Logo edit buffer, their use is
459
restricted to areas between lines that are not continued, or are
460
implicitly continued (Lisp style). Do not use blank lines between
461
explicitly continued Logo lines (lines that end with `~'). Neither
462
Logo, nor logo-mode function properly in these circumstances. You can
463
use comment only lines between two explicitly continued Logo lines, but
464
you must end them with `~'. However, you are on your own here -- in
465
some cases Logo will reject those.
467
This is what I was talking about:
477
(tree "France leaves [Paris Dijon Avignon])
480
(tree "China leaves [Beijing Shanghai Guangzhou Suzhou])
483
This works OK. However if you try to insert a comment line between
488
lines, Logo will print error message when worldtree is run.
491
Do not use names like `x\;y' `x\(y' `x| |y' `x|;|y' `x\\y' or some
492
such for your procedures and variables. Although Logo will accept
493
this, you will not be able to mark these names in Workspace Management
494
(Debug) buffer. I have allowed some rather weird characters to
495
accommodate Brian's MATCH program, but that's as far as I'll go.
498
Do not use yank (paste) facility to paste procedure definitions
499
directly to Inferior Logo buffer -- this will not work. Yank can be
500
used only to paste the command line (input) directly to Logo. This
501
probably sounds ambiguous, therefore one small example:
503
Let's say that you have in another editor window (it can be another
504
copy of emacs, or whatever) this procedure:
507
op filter [[x] [op or not equalp :e :x memberp :x ?rest]] :l
510
and you want to test it in current Logo/logo-mode session. If you yank
511
it directly to Inferior Logo buffer, it will arrive as one line
512
(setcursor mode), and Logo will not accept this as a procedure
513
definition. Instead, yank it to Logo edit buffer, and use `C-M-x'
516
On the other hand (once Logo has received the procedure definition),
517
you can use yank to paste from other editor test inputs to procedure
518
remove1. For instance, you can yank:
519
`show remove1 2 [1 2 3 1 2 3 1 2 3]'
520
directly to Inferior Logo buffer and hit return. Logo should respond
521
by printing following:
523
? show remove1 2 [1 2 3 1 2 3 1 2 3]
527
This is an oversimplified example, but, there will be times (when
528
testing tree recursive procedures -- for instance) where the test input
529
will be several lines long elaborately constructed tree list...
532
Do *not* try to close Logo by clicking on X in the upper right corner
533
of *logo* frame (or by using close option on the upper left corner of
534
the *logo* frame). This will close that frame, and make Logo
535
unaccessible to you, but it will *not* kill Logo. If you want to kill
536
Logo, type `bye' in *logo* buffer.
539
Not so obvious *To DOs*:
540
========================
541
One of the facilities built into logo-mode is automatic loading of
542
.loops initialization file from your home directory - if it exists. The
543
idea here is not so much to write additions to Logo library (although
544
it can be used for that as well), but to alter the standard behavior
545
of Logo interpreter. The last version (v.0.9) adds LOOPS, a rudimentary
546
Logo Object Oriented Programming System (just an experiment).
548
As an example of what can be done with initialization file, copy the
549
included .loops (dot.loops) file to your home directory, and start
550
Logo. Click on `LOOPS>>Language>>Ucblogo + LOOPS' menu, and emacs will
551
load .loops extensions into Logo.
553
The Compiler sub-menu on Logo pull-down menu in Inferior Logo buffer
554
is LOOPS specific. To understand what it does, and -- indeed, how to
555
use LOOPS extensions click on `Help>>Logo-help>>LOOPS User Manual'.
556
*(Part of the LOOPS User Manual needs updating.)*
559
===============================
560
COMMENTS BUG REPORTS AND To-DOs
561
===============================
563
Logo-mode is tested only on Intel machines running Linux and
564
FreeBSD. I have no access to anything else. The original work started
565
on emacs 19.34.1(b), but that version is no longer supported.
566
Logo-mode v2.9 will work only with emacs 20.5 and newer. Your safest
567
bet is to upgrade to the latest version.
569
Right now I have a lot "To-DO", but am willing to listen to
570
"reasonable" suggestions.
573
For more information, comments, or bug reports, send e-mail to