Trailing-Edge
-
PDP-10 Archives
-
mit_emacs_170_teco_1220
-
emacs/doc.emacs
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!
EMACS
!& 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
except subroutines.
Nonzero precomma arg means do Where Is on each function listed
and do not print "Done" at the end.!
m(m.m&_Load_BARE)
[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~!
j <:s
; -2d> !* Flush any CRLFs from the filename.!
:i6 In_library_..O:
!* 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.!
ft
)+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.!
ft
!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.!
hx*[.1
[.2 :i.2* !* The * means don't list subroutines.!
ff"e :i.2'
1,m(m.m &_List_Some_Functions).1.2 !* List functions which match.!
m(m.m &_Maybe_Flush)
ff"e
1,1m(m.m List_Variables).1 !* List all relevant MM variables.!
'
ft
Done
!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.!
"E
FT The_function_ !* Unless inhibited, type function name, etc.!
Q1M(M.M&_Macro_Name)[3
FT3'
-[0
-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 '
FT_can_be_invoked_via:_'
"# FT,_'
Q0M(M.M &_Charprint) !* Mention the ones that run this function.!
>'
F[B BIND GPrefix_Char_List J
[3 [4
< .-Z;
.,(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 '
FT_can_be_invoked_via:_'
"# FT,_''
FT3_ !* Include the name of the prefix before each command.!
2,Q0M(M.M &_Charprint) !* Mention the ones that run this function.!
-2"E -1'
> >
Q2"L -2"E 0' "N '
FT_cannot_be_invoked_except_with_MM.'
FT
!Info:! !C Read documentation files using INFO.
Non-null string arg is pathname made out of Menu item names
separated by spaces.!
m(m.mRun_Library)INFO&_Info_Enter
!& 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!
< -fq8;
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.!
q8
!List Loaded Libraries:! !C List all loaded libraries' names.!
[0 [1 [4
FT Loaded_libraries_are:
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)!
ft4
q0m.m~DOC~_~FILENAME~u4 !* and its global documentation!
ft4
"N ft fq4-2:g4-doc string doesn't end with a CRLF,!
' !* type one to make up for that.!
!LOSE!
q0+fq0+4u0>
!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"_ !''!'
FT are:
' !* 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.!
FQ1"L :I1<Garbage_Name>'
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.!
%0
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+1"E :I1<Dead_Buffer>'
Q1FP"E :I1<Buffer>'
Q1FP-100"E !* IF VALUE IS PURE STRING, USE THE STRING'S NAME.!
Q1M(M.M&_MACRO_NAME)U1'
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.!
I
'' !* HACKED UP STRING READY TO PRINT.!
FQS"G Q2J :SS"E ZK OLose'' !* With arg, ignore vars not containing it.!
ZJ
!* If printing MM variables only, the first time we find a match,
print a special header.!
"N %9"E
FT Functions_defined_by_temporary_definitions_(MM_variables)
''
-Q..O"N MF HT HK ' !* If buffer temporary, print and kill text now.!
!Lose!
%0> !* Advance past the variable's comment.!
"E FT
Done
' !* 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!
1,M.M2 U1
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.
'
FT1:
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!
B,.-1T B,.K
.,(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.!
>
FT..O
!* 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
character's name.!
M(M.M &_Load_BARE)
[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'
F=1!PREFIX!-9"N
!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.!
FT _is_not_an_escape-prefix_character.
'
M.M &_Maybe_Flush[A
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.!
Q2:FCU2'
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.!
FT has_these_subcommands:
-1U1 FQ3/5<
Q:3(%1)"N !* FOR EACH ELEMENT OF THE DISPATCH TABLE,!
MA FT___
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
M.M &_Maybe_Flush[A
M(M.M &_Load_BARE)
12,13:G1U2 2*200.U2 !* Q2 gets 200 if Control, plus 400 if Meta.!
Q0:"L
Q0,Q1 M(M.M Describe) !* First, print the desc of the prefix char itself.!
FT Type_a_subcommand_to_document_(or_"*"_for_all):
!''!'
,M1U3 !* Run the bit-prefix function to read a char and metize it.!
FT
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.!
FT These_
Q2&200."N FT Control-'
Q2&400."N FT Meta-'
FT _commands_are_available:
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.!
MA FT___
Q2,Q2 M(M.M&_^R_Briefly_Describe)'''' !* If defined, describe it.!
%2 >
!^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!
!* name.!
M(M.M &_Load_BARE)
[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_'
Q1FP-99"G
F~1!BIT-PREFIX--13"E !* Detect bit-prefix characters.!
FT is_a_bit_prefix_character.
0:"E FT
It_runs_the_function_'
"# -U0'
Q0,Q1 :M(M.M &_Bit_Prefix_Describe)'
F~1!PREFIX!-9"E !* Detect subdispatching prefix chars.!
0:"E
FT is_an_escape-prefix_for_more_commands.
It_reads_a_character_(subcommand)_and_dispatches_on_it.
'
"# -U0'
Q0,Q1:M(M.M &_Prefix_Describe)
''
Q1FP-100:"L !* If definition is a string!
Q1M(M.M &_Macro_Name)"E !* which has a name,!
FT is_a_nameless_impure_string
'
FTruns_the_function_
Q0,Q1:M(M.M Describe)' !* describe that string.!
Q0U2
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.
Q0MC FT_'
Q0,Q0 :M(M.M^R_DESCRIBE)' !* THEN DESCRIBE THAT OTHER CHARACTER.!
0FS^R INIT-Q1"E
FT is_undefined
'
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_
Q0,Q1:M(M.M Describe)''
FT has_an_unrecognizable_definition.
!& ^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
0F[SAIL
Q0M(M.M &_CHAR PRINT) !* TYPE IT OUT.!
F]SAIL
FT_
Q1FP-101"E !* AN IMPURE STRING =) MIGHT BE A PREFIX CHAR!
F~1!PREFIX!-9"E
FT is_an_escape-prefix_for_more_commands.
''
Q1M(M.M&_MACRO_NAME)[2 !* Get full name in q1!
Q2"N Q2U1
FT runs_the_function_
FT1:
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.!
FT
HT FT
' !* 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.!
0[A [B
:I*C FS ECHO DIS
!Prompt! @:FT Doc_(?_for_help):_ !* Iterate until no error!
!NoPrompt!
0F[HELPMAC FI:FC UB QB-4110."E ?UB' F]HELPMAC
QB-127"E QUB'
@:FTB :OB @FG @:FT_is_meaningless_here.__ OPrompt
!A! :IB Apropos OXX
!C! :I*C Character:_FS ECHO DIS
:M(M.M ^R_Describe)
!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
!Q! !!
!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
!?! 2,M(M.M&_Read_Line_Help)
!"! FT
Type_a_Help_option_to_say_which_kind_of_help_you_want:
C___says_what_a_certain_Command_(character)_does.__You_type_the_character.
D___Describes_a_function.__You_type_the_name.
A___lists_all_functions_Apropos_a_keyword.__You_type_the_keyword.
L___tells_you_the_Last_60_characters_you_typed.
R___describes_current_Recursive_editing_level.
N___prints_a_file_of_EMACS_news.
I___runs_the_INFO_program_for_detailed_documentation.
Q_or_Rubout__Quits_--_you_don't_really_want_help.
More_advanced_options:
__T_-_run_TECDOC;_V_-_run_List_Variables;_W_-_run_Where_Is;
__M_-_print_the_contents_of_the_mode_line_(for_printing_ttys).
__SPACE_repeats_previous_A,_D,_T,_V_or_W_request.
For_a_basic_introduction_to_EMACS,_run_the_program_
fs osteco"e ft TEACHEMACS.' "# ft TEACH-EMACS.' ft
0U..H @ft
O Prompt
!_! 0FO..Q Previous_Doc_Command [B
0FO..Q Previous_Doc_Arg [A
QA"E @FG OPrompt'
@FT _B:_A
OEXECUTE
!* Read in a string arg and pass it to the command whose name is in QB.!
!* QA contains bits to pass to & Read Line.!
!XX!
QA+1,M(M.M&_Read_Line) B:_ UA
QA"E '
QA M.V Previous_Doc_Arg
QB M.V Previous_Doc_Command
!EXECUTE!
!* 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.!
:m(m.a AUXList_Redefinitions)
!Tecdoc:! !C Document TECO command.
g(m.aPURIFY~DOC~ Tecdoc)jk!
:m(m.aPURIFYTECDOC)
!^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.tyipt[1
m.m&_Charprint[2
< fs.tyinxtm2 ft_ fs.tyipt-q1@; >
0
!& 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.!
F[:EJ PAGE
F[D FILE
1,m(m.m &_Get_Library)BARE"e
:ej dsk:emacs;bare_elib'
F]D FILE
!* NO here!