home *** CD-ROM | disk | FTP | other *** search
- Date: Tue, 10 Apr 90 11:54:10 EDT
- From: mitchell@euler.math.psu.edu (William J. Mitchell)
- To: freemacs@sun.soe.clarkson.edu
- Subject: Some useful functions
-
-
- The first section below is some code which uses the new "dflta"
- feature of version 1.6a to warn of undefined functions. This is useful
- in debugging new code. In particular it has been useful in updating old
- code to work with 1.6a, in which several functions have quietly
- disappeared.
-
- [ sorry about that. The worst offender is that Fmodename was
- renamed to Fset-modename. -russ ]
-
- The final section permits the use of arguments with meaningful names
- in .min files. An example of it's use is given in the function
- "Uanw".
-
- [I edited this slightly to optimize a little bit of code. I also
- fixed a long-standing bug of mine which let you define code in a new
- library without first defining a filename to store it in. Also takes
- care of autoloading libraries before defining functions in it. I
- also moved M-x warn-undefined to the M library. -russ ]
-
- ................................................................
-
- Name:Mdflta
- Like Fdflta, except that it gives a warning if the function is
- undefined.
- [wjm 4/1/90] -- BUG: warns only when LIB is undefined, which
- is to say only for things in libs emacs & key &
- user.
- [4/4/90] -- above fixed. Also don't complain about Fvisit-hook
- and such.
- [*]
- #(ds,dflta-n,SELF)
- #(ds,dflta-n,##(go,dflta-n))
- #(Fisupper,##(bc,##(dflta-n),a,d),(
- #(ds,dflta-n,Fautoload-##(dflta-n))
- #(n?,##(dflta-n),(
- #(an,Autoloading ##(##(dflta-n)))
- #(Fload-lib,##(##(dflta-n)))
- ))
- #(n?,SELF,(
- #(gs,SELF,(SELF),(arg1),(arg2),(arg3),(arg4),(arg5),(arg6),(arg7),(arg8),(arg9))
- ),(
- #(==,#(Fright,SELF,5),-hook,,(
- #(bl)#(an,"SELF" is undefined)#(it,100)
- ))
- ))
- ))
- [*]
-
- Name:M:warn-undefined
- If turned on, give an announcement when a nonexistent function is
- activated. Turned on if (arg1 != ""), else turned off.
- [*]
- #(ds,dflta,##(gs,#(==,arg1,,Fdflta,Mdflta),#(Farglist)))
- #(mp,dflta,#(Farglist))
- [*]
-
-
- ................................................................
-
- Name:Uanw
- Args:(what,how-long)
- Like #(an), but waits before continuing.
- [*]
- #(an,what)
- #(it,#(==,how-long,,10000,how-long))
- [*]
- ................................................................
-
-
-
-
- Name:Mstrings-read
- Read all the strings out of the text buffer.
- WJM: modifications --
- Looks for "Name:" only at start of line.
- New keyword "Args:". If this is given on the second
- line, following the line with "Name:",
- followed by a paranthesised argument list then
- those argument names are used instead of
- "arg1,arg2,...".
- [*]#(pm,2)
- #(lp,(
- )Name:)
- #(l?,.,],,0,(
- #(sp,0$>>>>>>)
- #(ds,arglist,##(Farglist))
- #(==,##(rm,^),Args:,(
- #(sp,>)#(sm,1)#(sp,$<)
- #(ds,arglist,SEL(F,)##(rm,1))
- ))
- #(sp,0)
- #(pm)
- #(SELF-do,##(rm,>),#(rm,$))
- #(SELF)
- ),(
- #(an)
- #(pm)
- ))[*]
-
-
- Name:Mstrings-read-do
- Read the string arg2 out of the text buffer. The string belongs in the library
- whose lib letter is arg1. Note that this function will autoload libraries
- that are autoloadable.
- [*]#(an, [Reading arg2])
- #(==,#(arg1filename),,(
- #(==,arg2,arg1filename,,(
- #(Ferror,You should define arg1filename first, or else load the library)
- #(an)
- ))
- ))
- #(sp,$>)
- #(pm,3)
- #(lp,#(Mstrings-delimiter))
- #(l?,.,],0,1)
- #(sp,1)
- #(l?,1,],1)
- #(ds,temp,##(rm,1))
- #(sp,1)
- #(==,##(temp),***,(
- #(n?,arg2,(
- #(es,arg2)
- #(Fisupper,##(bc,arg1),(#(ds,arg1modified)))
- ))
- ),(
- #(==,##(temp),##(gs,arg2,#(arglist)),(
- #(n?,arg2,,(#(ds,arg2)))
- ),(
- #(Fisupper,##(bc,arg1),(#(ds,arg1modified)))
- #(ds,arg2,##(temp))
- #(mp,arg2,#(arglist))
- ))
- ))
- #(sp,2)
- #(ds,documentation,##(rm,0))
- #(Mstore-documentation,arg1,arg2)
- #(Fexit-mode)
- #(sp,1)
- #(pm)
- [*]
-
-
- Name:Mstrings-edit-do-do
- Args:(cmd-name)
- Insert one string into the buffer for editing.
- Modified (WJM): parallel to the above changes for M:done-editing,
- I changed this so that M:ef will recognize the Arg: line
- in the documentation and use those arguments.
- (3/11) fixed my bug: had #(rm,0) instead of ##(rm,0) when looking
- for 'Args:'. This raised hell when there was no Arg1, but
- '#(Fmu)' instead.
-
- [*]
- #(pm,2)
- #(an,[arg1])
- #(Fcrlf)
- #(Fcrlf)
- #(Fcrlf)
- #(is,Name:arg1)
- #(Fcrlf)
- #(sm,0,<)
- #(ds,temp,arg1)
- #(is,
- #(Mfind-documentation,##(go,temp),arg1)
- #(Fexit-mode)
- #(Mstrings-delimiter)
- )
- #(sp,0>)
- #(sp,>>>>>)
- #(==,##(rm,^),Args:,(
- #(sp,>)#(sm,0)#(sp,$<)
- #(is,##(gs,arg1,SE LF,#(rm,0)#(sp,])))
- ),(
- #(sp,])
- #(is,##(gs,arg1,#(Farglist)))
- ))
- #(is,#(Mstrings-delimiter))
- #(pm)
- #(es,temp)
- [*]
-
-