home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / EMACSPAT.ZIP / NAMEDARG.MIN < prev    next >
Encoding:
Internet Message Format  |  1990-04-15  |  4.6 KB

  1. Date: Tue, 10 Apr 90 11:54:10 EDT
  2. From: mitchell@euler.math.psu.edu (William J. Mitchell)
  3. To: freemacs@sun.soe.clarkson.edu
  4. Subject: Some useful functions
  5.  
  6.  
  7. The first section below is some code which uses the new "dflta"
  8. feature of version 1.6a to warn of undefined functions. This is useful
  9. in debugging new code. In particular it has been useful in updating old
  10. code to work with 1.6a, in which several functions have quietly
  11. disappeared.
  12.  
  13. [ sorry about that.  The worst offender is that Fmodename was
  14. renamed to Fset-modename. -russ ]
  15.  
  16. The  final section permits the use of arguments with meaningful names
  17. in .min files.  An example of it's use is given in the function
  18. "Uanw".
  19.  
  20. [I edited this slightly to optimize a little bit of code.  I also
  21. fixed a long-standing bug of mine which let you define code in a new
  22. library without first defining a filename to store it in.  Also takes
  23. care of autoloading libraries before defining functions in it.  I
  24. also moved M-x warn-undefined to the M library.  -russ ]
  25.  
  26. ................................................................
  27.  
  28. Name:Mdflta
  29.     Like Fdflta, except that it gives a warning if the function is 
  30. undefined.
  31.     [wjm 4/1/90] -- BUG: warns only when LIB is undefined, which
  32.                     is to say only for things in libs emacs & key &
  33.                     user.
  34.     [4/4/90] -- above fixed. Also don't complain about Fvisit-hook
  35.             and such.
  36. [*]
  37. #(ds,dflta-n,SELF)
  38. #(ds,dflta-n,##(go,dflta-n))
  39. #(Fisupper,##(bc,##(dflta-n),a,d),(
  40.     #(ds,dflta-n,Fautoload-##(dflta-n))
  41.     #(n?,##(dflta-n),(
  42.         #(an,Autoloading ##(##(dflta-n)))
  43.         #(Fload-lib,##(##(dflta-n)))
  44.     ))
  45.     #(n?,SELF,(
  46. #(gs,SELF,(SELF),(arg1),(arg2),(arg3),(arg4),(arg5),(arg6),(arg7),(arg8),(arg9))
  47.     ),(
  48.         #(==,#(Fright,SELF,5),-hook,,(
  49.                 #(bl)#(an,"SELF" is undefined)#(it,100)
  50.         ))
  51.     ))
  52. ))
  53. [*]
  54.  
  55. Name:M:warn-undefined
  56.     If turned on, give an announcement when a nonexistent function is
  57. activated.  Turned on if (arg1 != ""), else turned off.
  58. [*]    
  59. #(ds,dflta,##(gs,#(==,arg1,,Fdflta,Mdflta),#(Farglist)))
  60. #(mp,dflta,#(Farglist))
  61. [*]
  62.  
  63.  
  64. ................................................................
  65.  
  66. Name:Uanw
  67. Args:(what,how-long)
  68.     Like #(an), but waits before continuing.
  69. [*]
  70. #(an,what)
  71. #(it,#(==,how-long,,10000,how-long))
  72. [*]
  73. ................................................................
  74.  
  75.  
  76.  
  77.  
  78. Name:Mstrings-read
  79. Read all the strings out of the text buffer.
  80.     WJM: modifications --
  81.         Looks for "Name:" only at start of line.
  82.         New keyword "Args:".  If this is given on the second
  83.             line, following the line with "Name:",
  84.             followed by a paranthesised argument list then
  85.             those argument names are used instead of
  86.             "arg1,arg2,...".
  87. [*]#(pm,2)
  88. #(lp,(
  89. )Name:)
  90. #(l?,.,],,0,(
  91.     #(sp,0$>>>>>>)
  92.     #(ds,arglist,##(Farglist))
  93.     #(==,##(rm,^),Args:,(
  94.         #(sp,>)#(sm,1)#(sp,$<)
  95.         #(ds,arglist,SEL(F,)##(rm,1))
  96.     ))
  97.     #(sp,0)
  98.     #(pm)
  99.     #(SELF-do,##(rm,>),#(rm,$))
  100.     #(SELF)
  101. ),(
  102.     #(an)
  103.     #(pm)
  104. ))[*]
  105.  
  106.  
  107. Name:Mstrings-read-do
  108. Read the string arg2 out of the text buffer.  The string belongs in the library
  109. whose lib letter is arg1.  Note that this function will autoload libraries
  110. that are autoloadable.
  111. [*]#(an, [Reading arg2])
  112. #(==,#(arg1filename),,(
  113.     #(==,arg2,arg1filename,,(
  114.         #(Ferror,You should define arg1filename first, or else load the library)
  115.         #(an)
  116.     ))
  117. ))
  118. #(sp,$>)
  119. #(pm,3)
  120. #(lp,#(Mstrings-delimiter))
  121. #(l?,.,],0,1)
  122. #(sp,1)
  123. #(l?,1,],1)
  124. #(ds,temp,##(rm,1))
  125. #(sp,1)
  126. #(==,##(temp),***,(
  127.     #(n?,arg2,(
  128.         #(es,arg2)
  129.         #(Fisupper,##(bc,arg1),(#(ds,arg1modified)))
  130.     ))
  131. ),(
  132.     #(==,##(temp),##(gs,arg2,#(arglist)),(
  133.         #(n?,arg2,,(#(ds,arg2)))
  134.     ),(
  135.         #(Fisupper,##(bc,arg1),(#(ds,arg1modified)))
  136.         #(ds,arg2,##(temp))
  137.         #(mp,arg2,#(arglist))
  138.     ))
  139. ))
  140. #(sp,2)
  141. #(ds,documentation,##(rm,0))
  142. #(Mstore-documentation,arg1,arg2)
  143. #(Fexit-mode)
  144. #(sp,1)
  145. #(pm)
  146. [*]
  147.  
  148.  
  149. Name:Mstrings-edit-do-do
  150.     Args:(cmd-name)
  151. Insert one string into the buffer for editing.
  152.     Modified (WJM): parallel to the above changes for M:done-editing,
  153.         I changed this so that M:ef will recognize the Arg: line
  154.         in the documentation and use those arguments.
  155.        (3/11) fixed my bug: had #(rm,0) instead of ##(rm,0) when looking
  156.         for 'Args:'.  This raised hell when there was no Arg1, but 
  157.         '#(Fmu)' instead.
  158.  
  159. [*]
  160. #(pm,2)
  161. #(an,[arg1])
  162. #(Fcrlf)
  163. #(Fcrlf)
  164. #(Fcrlf)
  165. #(is,Name:arg1)
  166. #(Fcrlf)
  167. #(sm,0,<)
  168. #(ds,temp,arg1)
  169. #(is,
  170.     #(Mfind-documentation,##(go,temp),arg1)
  171.     #(Fexit-mode)
  172.     #(Mstrings-delimiter)
  173. )
  174. #(sp,0>)
  175. #(sp,>>>>>)
  176. #(==,##(rm,^),Args:,(
  177.     #(sp,>)#(sm,0)#(sp,$<)
  178.     #(is,##(gs,arg1,SE    LF,#(rm,0)#(sp,])))
  179. ),(
  180.     #(sp,])
  181.     #(is,##(gs,arg1,#(Farglist)))
  182. ))
  183. #(is,#(Mstrings-delimiter))
  184. #(pm)
  185. #(es,temp)
  186. [*]
  187.  
  188.