There are no other files named doc.emacs in the archive.
!* -*-TECO-*- EMACS;DOC >!
!* [toed.xkl.com]DXX:<EMACS>DOC.EMACS.160, 5-Apr-96 17:35:08, Edit by ALDERSON!
!* Change naming convention for libraries from FOO.:EJ to FOO.ELIB on Tops-20!
!* functions for printing documentation and status information!
!~Filename~:! !This file contains EMACS's normally used functions!
!& List Some Functions:! !S List all loaded functions of a given class.
Takes two string arguments: name substring, and doc prefix
(function class). "*" as the doc prefix means list everything
Nonzero precomma arg means do Where Is on each function listed
and do not print "Done" at the end.!
[7 :i7 !* Get Name prefix in q7!
[8 [9 :i9 !* Get "class' (doc prefix) in q9!
fs:ejpage*5120+400000000000.u8 !* 1st file in q8!
< -fq8; !* Stop if no more files.!
m(m.m &_Maybe_Flush) !* Give up if user has flushed output.!
,q8m( m.m &_List_One_File)79 !* List functions of this class in one file!
q8+fq8+4u8> !* Advance to next file.!
"n ft Done
!& List One File:! !S List some of the functions in a specific library.
Takes string pointer to library as numeric arg, plus two string args
just like & List Some Functions. Nonzero precomma arg says to do Where Is
on each function listed.!
[9 [8 :i8 :i9 !* Q9 gets doc prefix, Q8 gets name prefix!
[0 [1 [2 [6 [7
m.m &_Maybe_Flush[a !* MA returns if output flushed.!
f[b bind !* Make a buffer for temporary use!
f[s string f[ window !* Doing T commands can set window if get --more--!
g(1,m.m~Filename~) !* get this files name!
hf=0"e hk i(( Anonymous ))' !* Some files may not have a ~filename~!
; -2d> !* Flush any CRLFs from the filename.!
!* Prepare the header for this file, in case needed.!
hk !* Print the header if we mention something in this file.!
fswidth-60"l -1f[truncate' !* Truncate the documentation at screen end!
g(m.m~DIRECTORY~) j !* Get the list of function names!
< .-z; !* Find the next function name.!
:f @:fb/8/"e k !<!>' !* Ignore functions whose names dont contain the name prefix!
0l :x2 m.m~DOC~_2u0 !* Get its documentation!
f=9 *"e f~0 S_ -2"g k !<!>'' !* If "*" is specified, ignore all subroutines.!
"# f~0 9 -fq9:"g k !<!>'' !* Else ignore if prefix doesn't match spec'd one.!
ma w0; !* (Before typing, check for output flushed)!
ft6 :i6 !* The first time, print the header.!
:l 24-.f"g,_i'w _i !* Put space after name, to column 25.!
g0 .-z( !* Get documentation after spaces.!
fkc :@f_k d !* Kill the function class.!
j :@l 0t !* Type just first line.!
)+zj b,.k k !* Kill to next function name.!
!*** Note that we do Where Is on the currently accessible definition of the name,
not on the definition in this library. This is bad for hairy situations,
but good for the case where EPATCH has been used to patch something.!
"n 1,(m.m2) m(m.m Where_Is)' !* Say which ^R commands run the function, if desired.!
fq6"g ' !* If we generated any output, follow it with CRLF.!
!Apropos:! !C M-X AproposFOO<cr> lists functions with names containing FOO.
If you supply a numeric argument, subroutines and
MM ... variables are not mentioned.!
f[b bind g(1,FSubstring:_) !* Get string to match.!
j @f_k zj -@f_k !* Flush leading and trailing spaces.!
[.2 :i.2* !* The * means don't list subroutines.!
1,m(m.m &_List_Some_Functions).1.2 !* List functions which match.!
1,1m(m.m List_Variables).1 !* List all relevant MM variables.!
!Where Is:! !C List the commands that run a given function.
M-X Where Is^R Forward Word<cr> will tell which character
moves forward one word. You can supply the function as a
numeric arg instead of the name as a string arg.!
!* A precomma arg of 1 means don't mention the function name.!
!* Just say "can be invoked via ...".!
!* A precomma arg of 2 means also give only the first character found,!
!* consider control characters last, and return nonzero iff a char was found.!
FF&1"N [1' !* Get the function given as a numeric arg,!
"# 9,FFunction:_[1W M.M1U1' !* or the function named by our string arg.!
Q1:"L M(M.M &_Load_BARE)' !* Load BARE if function is not a string.!
-[2 !* Q2 counts number found. Return after 5.!
FT The_function_ !* Unless inhibited, type function name, etc.!
-2"E !* If called by MM Describe, process control chars last.!
400.,Q1:FU0 !* Do Meta and C-M- first.!
Q0"L 0,Q1:FU0' !* If nothing there, do normal and control.!
Q0:"L Q0M(M.M &_Charprint) -1'' !* if found something, print just the character!
!* and return -1.!
< %0,Q1:FU0 Q0:; !* Starting at char in Q0, find next whose defn is Q1.!
Q2-4"G FT ,_etc.
%2"E "N FT__which '
Q0M(M.M &_Charprint) !* Mention the ones that run this function.!
F[B BIND GPrefix_Char_List J
.,(FB__ 2R .)X3 !* Q3 gets name of next prefix character.!
M(:X*)U4 L !* Q4 gets dispatch table; skip the line.!
-1U0 !* Q0 counts subcharacters.!
< %0,Q1F4 U0 Q0:; !* Starting at char in Q0, find next whose defn is Q1.!
Q2-4"G FT ,_etc.
-2"N %2"E "N FT__which '
FT3_ !* Include the name of the prefix before each command.!
2,Q0M(M.M &_Charprint) !* Mention the ones that run this function.!
Q2"L -2"E 0' "N '
!Info:! !C Read documentation files using INFO.
Non-null string arg is pathname made out of Menu item names
separated by spaces.!
!& Get Library Pointer:! !S Returns pointer to already loaded library.
Takes libary name as a string argument, or as string object as prefix argument.
Abbreviations are allowed.
A nonzero pre-comma argument means return 0 instead of error
if the library is not loaded.!
[8 [9 [7 "e :i7'
fs:ejpage*5120+400000000000.u8 !* 1st file in q8!
1,q8m.m~filename~u9 !* Get next files name!
q9"l f~97~~~ -fq7-1@;' !* Return if arg abbreviates it.!
q8+fq8+4u8> !* Else try next file.!
fq8"l "N 0'
:I*NSL No_such_library_loaded FSERR' !* Error if no such file.!
!List Loaded Libraries:! !C List all loaded libraries' names.!
[0 [1 [4
fs:ejpage*5120+400000000000.u0 !* 1st file in q0!
< -fq0; 1,q0m.m~filename~u4 !* Type next files name!
Q4+1"G OLOSE' !* (Ignoring files that don't know their names)!
q0m.m~DOC~_~FILENAME~u4 !* and its global documentation!
"N ft fq4-2:g4-doc string doesn't end with a CRLF,!
' !* type one to make up for that.!
!List Variables:! !C List names and values of all or some variables.
A suffix string argument is a substring to filter variable names with.
Given a buffer as a prefix argument, we insert the list into it.
Any postcomma arg inhibits the initial header and final "Done".
A nonzero precomma arg says consider only vars whose names start
with "MM ".!
0[0 [1[2[3[4 -1[9
M.M &_Maybe_FlushUF !* MF to exit if output flushed.!
FP"N F[ B BIND ' !* Arg not buffer => create a temp buffer.!
"# [..O F[ VB F[VZ !* Buffer arg, select it as buffer and narrow down bounds.!
.,. FS BOUND '
1,f Substring:_[S !* QS gets substring to check for.!
"E :FT Defined_variables_
FQS"G FT containing_"S"_ !''!'
' !* Provide a header, if no arg.!
FQ..Q-5/15< !* REPEAT OVER ALL VARIABLES IN SYMTAB!
Q:..Q(%0) U1 !* GET NEXT VARS NAME!
"N F~(0,3:G1)MM_"N %0 O Lose'' !* Precomma arg says look only at MM... vars.!
.U2 !* Remeber addr in buffer of start of info on this var.!
G1 I_ !* TYPE IT, THEN GO TO COLUMN 25.!
25-(0F ) F"G,32I'
"N !* If screening for MM vars,!
q2j 3d .,z-1x1 zj !* Flush "MM". Get function name in Q1.!
g(1,m.m~DOC~_1) z-.u1 !* next get first line only of function's documentation.!
fkc :@f_k 1 k !* Kill the function class.!
:@l .,z-q1k i
Q:..Q(%0) U1 !* NOW GET VALUE OF VARIABLE.!
Q1FP-1"E :I1<Q-vector>' !* IF IT IS FUNNY, SAY SO!
Q1FP-100"E !* IF VALUE IS PURE STRING, USE THE STRING'S NAME.!
Q1FP"L Q1\ I !* IF NUMBER, INSERT VALUE.!
"# !* IF STRING , MUST STILL HACK SOME.!
.U3 G1 !* GET THE STRING.!
Q3J <.-z; @f :@; 2d> !* Kill leading empty lines.!
ZJ <q3-.; 0@f :@; -2d> !* Kill trailing CRLFs.!
:L .-Q3-30"G Q3+30j' !* Keep no more than 1st 30 chars, no more than 1st line.!
.-Z"N ZK I_...' !* NO MORE THAN FIRST LINE.!
'' !* HACKED UP STRING READY TO PRINT.!
FQS"G Q2J :SS"E ZK OLose'' !* With arg, ignore vars not containing it.!
!* If printing MM variables only, the first time we find a match,
print a special header.!
-Q..O"N MF HT HK ' !* If buffer temporary, print and kill text now.!
%0> !* Advance past the variable's comment.!
' !* If no arg, type Done at end.!
"# ' !* If inserting, return the buffer we were given.!
!Describe:! !C M-X DescribeFOO<cr> documents function FOO.
Prints the full name and full documentation
of the specified function or variable name.
The function to be described can also be given as a prefix arg
in TECO code, as in M.MFOO MMDescribe, and if a character is being
described, it can be specified by the pre-comma prefix arg, either
as a 9-bit number or a string giving a q-register name.!
m(m.m &_Load_BARE) !* Make names of built-in fns accessible.!
[1[2 ff"N U1' !* Prefix arg =) it is function to describe!
"# 8,fFunction:_u2 !* Else read string arg and get its value!
Q1"E :FO..Q2"G !* No such function and there is such a variable =>!
M(M.M View_Q-register)2 ' !* describe that variable.!
1,M.M^R_2U1 !* Maybe function exists if "^R" added to name.!
Q1"E M.M2''' !* No function or variable => barf.!
Q1M(M.M&_Macro_Name)U1 !* Get full name in q1!
Q1"E FT A_nameless_impure_function.
M.M~DOC~_1 U1 !* Get the documentation string in q1!
F[ B BIND
G1 J :@F_K D [0 !* Flush the "Class"!
< :S; !* Search for function names to replace!
.,(S -D).FX1 !* with command char. get name in Q1 and kill.!
0:G1-"E FM1' !* If string starts with Altmode, macro!
!* it, passing it our arguments.!
"# 2,M(M.M Where_Is)1"E !* Else it is function name; print a char that!
FT 1 '' !* invokes it. If no character, print function name.!
!* Type out any text still left.!
!& Prefix Describe:! !S Describes the subcommands of an escape-prefix command.!
!* Reads the prefix character from the terminal, or can be
given the definition as a numeric arg or the character
as a precomma arg. If there is an arg, we do not print the
[0 [1 [2 [3 [4
FF"E 1,M.I @FIU0' !* Q0 gets character to describe.!
Q0"G Q0 FS ^R INDIRECTU0
Q0U1' !* Q1 gets definition.!
Q1FP-101"N O NOT PREFIX'
!NOT PREFIX! !* Assume that we don't get a non-prefix defn!
Q0 M(M.M&_CHAR PRINT) !* if we are called with defn as an argument.!
F[ S STRING !* NOW SEE WHICH QREG THIS PREFIX DISPATCHES THRU!
F[ B BIND
G1 !* LOOK AT THE PREFIX-MACRO.!
JSQ 0K SM.P 3R .,ZK !* EXTRACT THE QREG NAME IT DISPATCHES THROUGH.!
hx4 q4u3 !* Get the q-vector name in Q4, the!
!* q-vector in Q3.!
F] B BIND
FF"E FT Here_is_info_on_the_prefix_command_
Q0M(M.M&_CHAR PRINT) FT.
FS LISTEN"E FT Type_a_subcommand_to_document_(or_"*"_for_all):
M.I @:FIU1 FI U2
Q0"G Q0M(M.M&_CHAR PRINT) FT_'
Q2-*"N !* IF HE WANTS SPECIFIC SUBCOMMAND,!
FQ3/5-Q2"G Q:3(Q2)' "# 0'"E !* If char is not defined, upcase it.!
Q1M(M.M&_CHAR PRINT) FT_ !* Print prefix and subcommand,!
Q2*5-FQ3+1"G FT is_not_defined.
Q:3(Q2)"E FT is_not_defined.
:i*:4(2),Q:3(Q2) :M(M.M ^R_DESCRIBE)'
!* THEN DESCRIBE THAT SUBCOMMAND.!
Q:3(%1)"N !* FOR EACH ELEMENT OF THE DISPATCH TABLE,!
Q1,Q:3(Q1) M(M.M&_^R_Briefly_Describe)' !* IF DEFINED, DESCRIBE IT.!
!& Bit Prefix Describe:! !S Describes one or several commands with a certain meta-bit.!
!* Takes the bit prefix character as its first argument,
and its definition as its second argument.!
[0 [1 [2 [3
12,13:G1U2 2*200.U2 !* Q2 gets 200 if Control, plus 400 if Meta.!
Q0,Q1 M(M.M Describe) !* First, print the desc of the prefix char itself.!
,M1U3 !* Run the bit-prefix function to read a char and metize it.!
Q3&177.-*"N !* If he wants specific subcommand,!
Q3M(M.M&_CHAR PRINT) FT_ !* Print the metized character, and describe it,!
Q3,Q3 :M(M.M ^R_DESCRIBE)' !* then describe that subcommand.!
Q2&200."N FT Control-'
Q2&400."N FT Meta-'
200.@FS ^R INITU0
101.@FS ^R INITU1
341.@FS ^R INITU3
200.< !* Type each character of this quadrant,!
Q2#Q3&777777."N !* but don't mention aliases!
Q2#Q0"N !* Don't mention self-inserting characters.!
Q2#Q1"N !* Don't mention undefined characters.!
Q2,Q2 M(M.M&_^R_Briefly_Describe)'''' !* If defined, describe it.!
!^R Describe:! !^R Prints the documentation of a command (not a function).
The command character is read from the terminal.
Alternatively, the command char and definition may be fed as
numeric args, in which case the character's name is not printed.!
!* Note that sometimes -1 is passed as the "character", just to turn off the!
!* character name printing. Sometimes a string is passed, the q-register!
[0 [1 [2 U0 U1
M.M &_Charprint[C !* MC is & CharPrint.!
FF"E !* Unless char and defn already supplied,!
1,M.I @FIU0 Q0U1 !* Read char into Q0; Q1 gets its defn.!
FT The_command_ Q0MC FT_'
F~1!BIT-PREFIX--13"E !* Detect bit-prefix characters.!
Q0,Q1 :M(M.M &_Bit_Prefix_Describe)'
F~1!PREFIX!-9"E !* Detect subdispatching prefix chars.!
Q1FP-100:"L !* If definition is a string!
Q1M(M.M &_Macro_Name)"E !* which has a name,!
Q0,Q1:M(M.M Describe)' !* describe that string.!
Q0-(Q0:f"lFS ^R INDIR'U0 Q0)"N !* If this is an indirect character,!
Q2:FC-Q0"N !* then say of what - unless it's just!
!* upcasing. The conditional around the!
!* indirection is to beware of a!
!* q-register-name string in Q0.!
FT is_an_alias_of_ Q0MC FT.
Q0,Q0 :M(M.M^R_DESCRIBE)' !* THEN DESCRIBE THAT OTHER CHARACTER.!
Q1FP+4"E !* Not string or number => you lose.!
Q1M(M.M &_Macro_Name)U2 !* See if char is known in the BARE library.!
Q2"N FT is_the_built-in_TECO_command_
!& ^R Briefly Describe:! !& Briefly describes a command.
The command character and command definition should be
given as prefix numeric args. We don't handle indirect
definitions; the caller should do that. (This is so we
win when dealing with subcommands of prefix characters).!
[0 [1 U0 U1
Q0M(M.M &_CHAR PRINT) !* TYPE IT OUT.!
Q1FP-101"E !* AN IMPURE STRING =) MIGHT BE A PREFIX CHAR!
Q1M(M.M&_MACRO_NAME)[2 !* Get full name in q1!
M.M~DOC~_1 U1 !* Get the documentation string in q1!
F[ B BIND
G1 J FWKD :@L .,ZK !* GET JUST ITS 1ST LINE, SANS CLASS NAME.!
' !* AND PRINT IT.!
!*** IT IS NOT ONE OF THE THINGS WHOSE BRIEF DESCRIPTION IS DIFFERENT!
!*** FROM ITS FULL DSECRIPTION, SO GET THE FULL ONE.!
F :M(M.M ^R_DESCRIBE)
!^R Documentation:! !^R General source of helpful information.!
:I*C FS ECHO DIS
!Prompt! @:FT Doc_(?_for_help):_ !* Iterate until no error!
0F[HELPMAC FI:FC UB QB-4110."E ?UB' F]HELPMAC
@:FTB :OB @FG @:FT_is_meaningless_here.__ OPrompt
!A! :IB Apropos OXX
!C! :I*C Character:_FS ECHO DIS
!D! :IB Describe 8UA OXX
!H! O No Prompt !* For those who type ^_H on Twenex.!
!I! :M(M.M ^R_Info)
!L! :M(M.M ^R_What_Lossage)
!M! .*100/(FS Z):\UB :FT..J--B%-- FS MODIF"N FT_*' FT
!N! F[D FILE M(M.M View_File)EMACS;EMACS_NEWS
!R! 0[D 1,M(M.M &_Read_Line_Help) !* QD is an arg for this function.!
!T! :IB Tecdoc OXX
!V! :IB List_Variables OXX
!W! :IB Where_Is 8UA OXX
fs osteco"e ft TEACHEMACS.' "# ft TEACH-EMACS.' ft
!_! 0FO..Q Previous_Doc_Command [B
0FO..Q Previous_Doc_Arg [A
QA"E @FG OPrompt'
!* Read in a string arg and pass it to the command whose name is in QB.!
!* QA contains bits to pass to & Read Line.!
QA+1,M(M.M&_Read_Line) B:_ UA
QA M.V Previous_Doc_Arg
QB M.V Previous_Doc_Command
!* Apropos should get a numeric argument to suppress subroutines.!
F~B Apropos"E 1'M(M.M B ) A
!List Redefinitions:! !C Describe how current mode differs from fundamental.
All variables and commands which are redefined locally
in this buffer are described briefly.!
!Tecdoc:! !C Document TECO command.
!^R What Lossage:! !^R What commands did I type to cause this lossage?
Prints out descriptions of the last sixty characters typed on the keyboard.!
< fs.tyinxtm2 ft_ fs.tyipt-q1@; >
!& Load BARE:! !S Load the BARE library if not loaded.
Leaves FS :EJ PAGE pushed on the stack on return,
so that BARE will go away when the caller returns.!
!* NO here!