mirror of
https://github.com/PDP-10/its.git
synced 2026-05-01 05:59:11 +00:00
Except IVORY, there's also WORDAB and TMACS. IVORY needs go be generated with itself, so include the :EJ for bootstrapping.
1680 lines
69 KiB
Plaintext
Executable File
1680 lines
69 KiB
Plaintext
Executable File
!* -*-TECO-*- *!
|
||
!* This source is compiled with IVORY, not PURIFY!
|
||
!* Recent modifications:
|
||
11/4/83 622 ECC Improve ^R Unexpand Last Word so that when it tells
|
||
Teco of the changed area, it tries to trim away any
|
||
prefix part that is the same. Typical case since the
|
||
whole line is kept for unexpanding.
|
||
8/14/82 621 KRONJ Fix tab-expander to not get NIB (0, before q1-.a)
|
||
4/24/82 619 ECC 1. Fix tab-expander installation to check the function
|
||
being replaced in the same way the others do, by
|
||
looking at the first n characters. This allows
|
||
loading WORDAB twice without tab exploding, or test
|
||
loading. 2. STL (if word too long) bug fixed. 3. Fix
|
||
Define.. to not rely on user ..d to define lispy ().
|
||
3/21/82 618 ECC 1. Merge in the active-documentation code written long
|
||
ago and kept in WABDOC. Remove Old... user command.
|
||
2. Change & WRDAB Process Options Hook to not bind any
|
||
keys to expanders if in a recursive edit level.
|
||
This allows unbinding when exit levels to work --
|
||
otherwise WRDAB Old nnn variables are smashed and
|
||
cannot be restored.
|
||
3. Change ^R Abbrev Expand for Tab to allow any kind
|
||
of insert at point, not just whitespace. Checks
|
||
old tab's return values more carefully to decide.
|
||
9/04/81 615 ECC Removed spurious ; in tab expander. Made WORDAB All
|
||
Caps be a option variable, so Edit Options will see
|
||
it, as will Help-V etc.
|
||
*!
|
||
!~FILENAME~:! !Word Abbrev Mode package. Documentation in INFO under EMACS.!
|
||
WORDAB
|
||
|
||
!& Setup WORDAB Library:! !S Run when WORDAB is loaded.
|
||
If you do non-trivial hacking of Word Abbrev mode, you should be on
|
||
the WORDAB@MIT-AI mailing list.
|
||
Calls variable WORDAB Setup Hook, if it exists. That can do things
|
||
like auto-loading a file of abbreviations. It must also connect
|
||
keys.
|
||
If the hook does not exist (or is 0), we will connect the standard
|
||
Word Abbrev mode keys:
|
||
C-X C-A runs ^R Add Mode Word Abbrev,
|
||
C-X C-H runs ^R Inverse Add Mode Word Abbrev,
|
||
C-X + runs ^R Add Global Word Abbrev,
|
||
C-X - runs ^R Inverse Add Global Word Abbrev,
|
||
M-' runs ^R Word Abbrev Prefix Mark,
|
||
C-M-Space runs ^R Abbrev Expand Only, and
|
||
C-X U runs ^R Unexpand Last Word.
|
||
Appends to variables Set Mode Line Hook and Exit Hook.!
|
||
|
||
m(m.m& Declare Load-Time Defaults)
|
||
Word Abbrevs Modified, Non0 means definitions have changed: 0
|
||
Save Word Abbrevs,
|
||
* 1 => save all abbrevs on exit, -1 => just save incrementals: 0
|
||
Additional Abbrev Expanders,: 0
|
||
Only Global Abbrevs,: 0
|
||
Word Abbrev Mode,: 0
|
||
WORDAB Setup Hook,
|
||
If non0 is Teco code to run when WORDAB loaded (it must set keys): 0
|
||
|
||
|
||
[1[2 !* save regs!
|
||
6*5fsQVectoru.e !* .E: QVector of random WORDAB!
|
||
!* variables.!
|
||
qOnly Global Abbrevs"e !* Both globals and modals.!
|
||
m.m& WRDAB Mode or Global Expandu:.e(0)' !* .E(0): abbrev lookup!
|
||
!* subroutine!
|
||
"# !* Only globals.!
|
||
m.m& Global Expandu:.e(0)' !* .E(0): abbrev lookup subroutine.!
|
||
|
||
m.m& Expandu:.e(1) !* .E(1): & Expand subroutine.!
|
||
0u:.e(2) !* .E(2): old string.!
|
||
0u:.e(3) !* .E(3): new string.!
|
||
0u:.e(4) !* .E(4): new string end.!
|
||
|
||
|
||
@:i1|( !* 1: Our SML hook.!
|
||
!* The parenthesis passes along!
|
||
!* any value since we are appending.!
|
||
|
||
!* Inserts " Abbrev", and passes along any given string (old style!
|
||
!* hooks accumulated a string of mode line things instead of!
|
||
!* inserting). Call & WRDAB Process Options Hook to do the expander!
|
||
!* character reconnecting.!
|
||
|
||
m(m.m& WRDAB Process Options Hook) !* Set characters if necessary.!
|
||
0fo..qWord Abbrev Mode"n !* In Word Abbrev Mode.!
|
||
i Abbrev' !* so put that into mode line.!
|
||
)| !* End of our SML hook.!
|
||
|
||
0fo..qSet Mode Line Hooku2 !* 2: Old SML hook.!
|
||
q2"e q1'"# :i*21'm.vSet Mode Line Hookw
|
||
!* Install our SML hook if none!
|
||
!* previous, otherwise append to!
|
||
!* SML hook.!
|
||
|
||
|
||
0fo..qExit Hookf"ew :i*'u1 !* 1: Old exit hook.!
|
||
@:i*|1 !* Old stuff.!
|
||
qWord Abbrevs Modified"n !* New hook.!
|
||
qSave Word Abbrevsf"gw !* ...!
|
||
m(m.mWrite Word Abbrev File)' !* ...!
|
||
"#"l m(m.mWrite Incremental Word Abbrev File)''' !* ...!
|
||
|m.vExit Hookw !* ...!
|
||
|
||
|
||
!* Set up Word Abbrev Mode fsVarMacros so setting variables causes action!
|
||
!* Note that the value passed to a fsVarMacro is the new value, and the!
|
||
!* current value of the variable is still available in the variable itself --!
|
||
!* i.e. the variable value isnt changed until after the macro.!
|
||
|
||
:fo..qWord Abbrev Modeu1 !* 1: ..Q index of mode variable.!
|
||
@:i:..q(q1+2)|!* 1 => turn on Word Abbrev Mode, 0 => turn it off!
|
||
!* This variable is an option too.!
|
||
!* Now the fsVarMacro part. NUMARG is the new value of the!
|
||
!* variable: positive if the mode shoud be turned on, 0 or!
|
||
!* negative if should be turned off. Old value is still in the!
|
||
!* variable. Make sure we run & Set Mode Line to (1) put "Abbrev"!
|
||
!* in the mode line, and (2) set all the expander keys.!
|
||
|
||
1fsModeChangew | !* The fsVarMacro. A shortie.!
|
||
|
||
|
||
:fo..qOnly Global Abbrevsu1 !* 1: ..q index.!
|
||
@:i:..q(q1+2)|!* 1=> use only global word abbrevs, 0 => both kinds!
|
||
!* This variable is an option too.!
|
||
|
||
!* Now the fsVarMacro part. NUMARG is new value, old is still in!
|
||
!* variable. Sets C-X C-A and C-X C-H unless user has a WORDAB!
|
||
!* Setup Hook. Changes the abbrev-checker.!
|
||
|
||
qWORDAB Setup Hook[1 !* 1: 0 or hook.!
|
||
"n m.m& Global Expandu:.e(0) !* 1, just global abbrevs.!
|
||
q1"e m.m^R Add Global Word Abbrevu:.x() !* C-X C-A.!
|
||
m.m^R Inverse Add Global Word Abbrevu:.x()'' !* C-X C-H.!
|
||
"# m.m& WRDAB Mode or Global Expandu:.e(0) !* 0, both kinds.!
|
||
q1"e m.m^R Add Mode Word Abbrevu:.x() !* C-X C-A.!
|
||
m.m^R Inverse Add Mode Word Abbrevu:.x()'' !* C-X C-H.!
|
||
| !* End of the fsVarMacro.!
|
||
|
||
|
||
:fo..qAdditional Abbrev Expandersu1 !* 1: ..Q index of expander list.!
|
||
q:..q(q1+1)f"n,m(m.mMake These Characters Expand)'w !* Check if any.!
|
||
@:i:..q(q1+2)|!Non-standard characters that should cause expansion.!
|
||
,:m(m.mMake These Characters Expand) !* Give the!
|
||
| !* list a varMacro comment.!
|
||
|
||
!* Note that it isnt an option. If we decide to make it one,!
|
||
!* then the fsVarMacro will have to worry about repeatedly!
|
||
!* appending the same characters, e.g. because Edit Options!
|
||
!* will reset the variable upon exit even if unchanged.!
|
||
|
||
!* Finally, we do key-setting unless the user has a setup hook. In that!
|
||
!* case the hook must set any keys, along with whatever else it wants to!
|
||
!* do.!
|
||
|
||
0fo..qWORDAB Setup Hooku1 !* 1: Setup Hook or 0.!
|
||
q1"n m1' !* Call the hook if there is one.!
|
||
"# !* No hook, so we connect the standard keys. Note that regardless of!
|
||
!* Only Global Abbrevs, C-X + and C-X - will always be global hacking!
|
||
!* definers. The variable only affects C-X C-A and C-X C-H.!
|
||
|
||
m.m^R Unexpand Last Wordu:.x(U) !* C-X U.!
|
||
m.m^R Abbrev Expand Onlyu... w !* C-M-Space.!
|
||
m.m^R Word Abbrev Prefix Mark!"!u..' !* M-Apos.!
|
||
m.m^R Add Global Word Abbrevu:.x(+) !* C-X +.!
|
||
m.m^R Inverse Add Global Word Abbrevu:.x(-) !* C-X -.!
|
||
qOnly Global Abbrevs"n !* Globals only.!
|
||
m.m^R Add Global Word Abbrevu:.x() !* C-X C-A.!
|
||
m.m^R Inverse Add Global Word Abbrevu:.x()' !* C-X C-H.!
|
||
"# !* Modals and globals.!
|
||
m.m^R Add Mode Word Abbrevu:.x() !* C-X C-A.!
|
||
m.m^R Inverse Add Mode Word Abbrevu:.x()'' !* C-X C-H.!
|
||
|
||
1fsModeChangew !* Go into Word Abbrev mode if its!
|
||
!* variable says to.!
|
||
|
||
!Expand Word Abbrevs in Region:! !C Finds abbrevs in region; offers to expand each.
|
||
Searches region for word abbrevs. When one is found, the buffer is
|
||
displayed with the cursor just after the abbrev. The character
|
||
you then type determines what action is taken:
|
||
Space expands the abbrev and goes on to the next one.
|
||
Rubout goes on to the next one without expanding.
|
||
Altmode exits this command without expanding.
|
||
Period expands and then exit.
|
||
Comma expands and stays so you can look it over. Then type one
|
||
of these characters again.
|
||
Exclamation mark expands this and each remaining abbrev without
|
||
asking.
|
||
Hyphen expands and glues to a prefix and stays. The prefix and
|
||
abbrev should be separated by a "-".
|
||
F causes this paragraph to be filled.
|
||
C-R enters a recursive edit level, so you can move point or do
|
||
minor editing.
|
||
C-L clears and redisplays the screen and stays.!
|
||
|
||
!* Note the s used below to bound the WORDAB Ins Chars string value.!
|
||
m(m.m& Declare Load-Time Defaults)
|
||
WORDAB Ins Chars, Self-inserting expanders: !~@#;$%^&*-_=+[]()\|:`"'{},<.>/?
|
||
|
||
WORDAB Old Chars, Hairy expanders: ||
|
||
Word Abbrev Prefix Mark, Point of prefix mark: 0
|
||
|
||
|
||
[0[1[2[3[4[5 0[6 !* 6: 0 iff should ask.!
|
||
0[..f !* ..F: Disallow file hacking.!
|
||
:,.f |