home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume15 / calc-1.05 / part19 < prev    next >
Text File  |  1990-10-14  |  57KB  |  1,278 lines

  1. Newsgroups: comp.sources.misc
  2. X-UNIX-From: daveg@csvax.cs.caltech.edu
  3. subject: v15i046: Patch for GNU Emacs Calc, version 1.04 -> 1.05, part 19/20
  4. from: daveg@csvax.cs.caltech.edu (David Gillespie)
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 15, Issue 46
  8. Submitted-by: daveg@csvax.cs.caltech.edu (David Gillespie)
  9. Archive-name: calc-1.05/part19
  10.  
  11. #!/bin/sh
  12. # this is part 19 of a multipart archive
  13. # do not concatenate these parts, unpack them in order with /bin/sh
  14. # file calc.patch continued
  15. #
  16. CurArch=19
  17. if test ! -r s2_seq_.tmp
  18. then echo "Please unpack part 1 first!"
  19.      exit 1; fi
  20. ( read Scheck
  21.   if test "$Scheck" != $CurArch
  22.   then echo "Please unpack part $Scheck next!"
  23.        exit 1;
  24.   else exit 0; fi
  25. ) < s2_seq_.tmp || exit 1
  26. sed 's/^X//' << 'SHAR_EOF' >> calc.patch
  27. X  lines of text in this buffer as numbers or formulas, replaces the
  28. X  original stack elements in the original buffer with these new values,
  29. X***************
  30. X*** 8233,8240 ****
  31. X  continues to exist during editing, but for best results you should be
  32. X  careful not to change it until you have finished the edit.  You can
  33. X  also cancel the edit simply by killing the @samp{*Calc Edit*} buffer
  34. X! with @kbd{C-x k} (@code{kill-buffer}).
  35. X  
  36. X  @node Programming, Installation, Kill and Yank, Top
  37. X  @chapter Programming the Calculator
  38. X  
  39. X--- 13335,13357 ----
  40. X  continues to exist during editing, but for best results you should be
  41. X  careful not to change it until you have finished the edit.  You can
  42. X  also cancel the edit simply by killing the @samp{*Calc Edit*} buffer
  43. X! with @kbd{C-x k} (@code{kill-buffer}).@refill
  44. X! 
  45. X! If the @code{calc-edit} command involves more than one stack entry,
  46. X! each line of the @samp{*Calc Edit*} buffer is interpreted as a
  47. X! separate formula.  Otherwise, the entire buffer is interpreted as
  48. X! one formula, with line breaks ignored.  (You can use @kbd{C-o} to
  49. X! insert a newline in the buffer without pressing @key{RET}.)
  50. X! 
  51. X! As a special exception, if one stack entry is being edited and that
  52. X! stack entry is a single variable which has a stored value, then the
  53. X! value of the variable is edited rather than the stack entry itself.
  54. X! When you finish editing the new value is stored back in that variable.
  55. X  
  56. X+ The @kbd{`} key also works during numeric or algebraic entry.  The
  57. X+ text entered so far is moved to the @code{*Calc Edit*} buffer for
  58. X+ more extensive editing than is convenient in the minibuffer.
  59. X+ 
  60. X  @node Programming, Installation, Kill and Yank, Top
  61. X  @chapter Programming the Calculator
  62. X  
  63. X***************
  64. X*** 8290,8300 ****
  65. X  The @kbd{Z D} command first prompts for the key to define.  For example,
  66. X  press @kbd{Z D a} to define the new key sequence @kbd{z a}.  You are then
  67. X  prompted for the name of the Calculator command that this key should
  68. X! run.  For example, the @code{calc-hypot} (hypotenuse) command is not normally
  69. X! available on a key.  Typing @kbd{Z D h hypot @key{RET}} programs the
  70. X! @kbd{z h} key sequence to run @code{calc-hypot}.  This definition will remain
  71. X  in effect for the rest of this Emacs session, or until you redefine
  72. X! @kbd{z h} to be something else.
  73. X  
  74. X  You can actually bind any Emacs command to a @kbd{z} key sequence by
  75. X  backspacing over the @samp{calc-} when you are prompted for the command name.
  76. X--- 13407,13417 ----
  77. X  The @kbd{Z D} command first prompts for the key to define.  For example,
  78. X  press @kbd{Z D a} to define the new key sequence @kbd{z a}.  You are then
  79. X  prompted for the name of the Calculator command that this key should
  80. X! run.  For example, the @code{calc-sincos} command is not normally
  81. X! available on a key.  Typing @kbd{Z D s sincos @key{RET}} programs the
  82. X! @kbd{z s} key sequence to run @code{calc-sincos}.  This definition will remain
  83. X  in effect for the rest of this Emacs session, or until you redefine
  84. X! @kbd{z s} to be something else.
  85. X  
  86. X  You can actually bind any Emacs command to a @kbd{z} key sequence by
  87. X  backspacing over the @samp{calc-} when you are prompted for the command name.
  88. X***************
  89. X*** 8312,8318 ****
  90. X  @kindex Z U
  91. X  @pindex calc-user-undefine
  92. X  The @kbd{Z U} (@code{calc-user-undefine}) command unbinds a user key.
  93. X! For example, the key sequence @kbd{Z U h} will undefine the @code{hypot}
  94. X  key we defined above.
  95. X  
  96. X  @kindex Z P
  97. X--- 13429,13435 ----
  98. X  @kindex Z U
  99. X  @pindex calc-user-undefine
  100. X  The @kbd{Z U} (@code{calc-user-undefine}) command unbinds a user key.
  101. X! For example, the key sequence @kbd{Z U s} will undefine the @code{sincos}
  102. X  key we defined above.
  103. X  
  104. X  @kindex Z P
  105. X***************
  106. X*** 8323,8330 ****
  107. X  The @kbd{Z P} (@code{calc-user-define-permanent}) command makes a key
  108. X  binding permanent so that it will remain in effect even in future Emacs
  109. X  sessions.  (It does this by adding a suitable bit of Lisp code into
  110. X! your @file{.emacs} file.)  For example, @kbd{Z P h} would register
  111. X! our @code{hypot} command permanently.  If you later wish to unregister
  112. X  this command you must edit your @file{.emacs} file by hand.
  113. X  
  114. X  @kindex Z E
  115. X--- 13440,13447 ----
  116. X  The @kbd{Z P} (@code{calc-user-define-permanent}) command makes a key
  117. X  binding permanent so that it will remain in effect even in future Emacs
  118. X  sessions.  (It does this by adding a suitable bit of Lisp code into
  119. X! your @file{.emacs} file.)  For example, @kbd{Z P s} would register
  120. X! our @code{sincos} command permanently.  If you later wish to unregister
  121. X  this command you must edit your @file{.emacs} file by hand.
  122. X  
  123. X  @kindex Z E
  124. X***************
  125. X*** 8406,8419 ****
  126. X  The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has
  127. X  been defined by a keyboard macro tries to use the @code{edit-kbd-macro}
  128. X  command to edit the macro.  This command may be found in the
  129. X! @file{macedit} package, a copy of which comes with Calc.  If
  130. X! @code{edit-kbd-macro} is not available, or if you give a negative
  131. X! numeric prefix argument, @kbd{Z E} uses a variant of @code{calc-edit}
  132. X! with the contents of the buffer being the keyboard macro in ``raw''
  133. X! form.  In either case, type @kbd{C-c C-c} to finish editing and update
  134. X  the definition stored on the key, or, to cancel the edit, just kill the
  135. X  macro-editing buffer with @kbd{C-x k}.@refill
  136. X  
  137. X  @node Conditionals in Macros, Loops in Macros, Naming Keyboard Macros, Keyboard Macros
  138. X  @subsection Conditionals in Keyboard Macros
  139. X  
  140. X--- 13523,13550 ----
  141. X  The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has
  142. X  been defined by a keyboard macro tries to use the @code{edit-kbd-macro}
  143. X  command to edit the macro.  This command may be found in the
  144. X! @file{macedit} package, a copy of which comes with Calc.  It decomposes
  145. X! the macro definition into full Emacs command names, like @code{calc-pop}
  146. X! and @code{calc-add}.  Type @kbd{C-c C-c} to finish editing and update
  147. X  the definition stored on the key, or, to cancel the edit, just kill the
  148. X  macro-editing buffer with @kbd{C-x k}.@refill
  149. X  
  150. X+ If you give a negative numeric prefix argument to @kbd{Z E}, the keyboard
  151. X+ macro is edited in spelled-out keystroke form.  For example, the editing
  152. X+ buffer might contain the nine characters @samp{1 RET 2 +}.  When you press
  153. X+ @kbd{C-c C-c}, the @code{read-kbd-macro} feature of the @file{macedit}
  154. X+ package is used to reinterpret these key names.  The
  155. X+ notations @code{RET}, @code{LFD}, @code{TAB}, @code{SPC}, @code{DEL}, and
  156. X+ @code{NUL} must be written in all uppercase, as must the prefixes @code{C-}
  157. X+ and @code{M-}.  Spaces and line breaks are ignored.  Other characters are
  158. X+ copied verbatim into the keyboard macro.@refill
  159. X+ 
  160. X+ If @file{macedit} is not available, @kbd{Z E} edits the keyboard macro
  161. X+ in ``raw'' form; the editing buffer simply contains characters like
  162. X+ @samp{1^M2+} (here @samp{^M} represents the carriage-return character).
  163. X+ Editing in this mode, you will have to use @kbd{C-q} to enter more
  164. X+ control characters into the buffer.@refill
  165. X+ 
  166. X  @node Conditionals in Macros, Loops in Macros, Naming Keyboard Macros, Keyboard Macros
  167. X  @subsection Conditionals in Keyboard Macros
  168. X  
  169. X***************
  170. X*** 9545,9550 ****
  171. X--- 14676,14687 ----
  172. X  The elements of @var{vals} are assumed to be valid Calc objects, and
  173. X  are not evaluated or renormalized in any way.  If @var{vals} is an
  174. X  empty list, nothing happens.@refill
  175. X+ 
  176. X+ The stack elements are pushed without any sub-formula selections.
  177. X+ You can give an optional third argument to this function, which must
  178. X+ be a list the same size as @var{vals} of selections.  Each selection
  179. X+ must be @code{eq} to some sub-formula of the corresponding formula
  180. X+ in @var{vals}, or @code{nil} if that formula should have no selection.
  181. X  @end defun
  182. X  
  183. X  @defun calc-top-list n m
  184. X***************
  185. X*** 9558,9563 ****
  186. X--- 14695,14714 ----
  187. X  range, the command is aborted with a suitable error message.  If @var{n}
  188. X  is zero, the function returns an empty list.  The stack elements are not
  189. X  evaluated or renormalized.@refill
  190. X+ 
  191. X+ If any stack elements contain selections, and selections have not
  192. X+ been disabled by the @kbd{j e} (@code{calc-enable-selections}) command,
  193. X+ this function returns the selection portions rather than the entire
  194. X+ stack elements.  It can be given a third ``selection-mode'' argument
  195. X+ which selection other behaviors.  If it is the symbol @code{t}, then
  196. X+ a selection in any of the requested stack elements produces an
  197. X+ ``illegal operation on selections'' error.  If it the symbol @code{full},
  198. X+ the whole stack entry is always returned regardless of selections.
  199. X+ If is the symbol @code{sel}, the selected portion is always returned,
  200. X+ or @code{nil} if there is no selection.  (This mode ignores the @kbd{j e}
  201. X+ command.)  If the symbol is @code{entry}, the complete stack entry in
  202. X+ list form is returned; the first element of this list will be the whole
  203. X+ formula, and the third element will be the selection (or @code{nil}).
  204. X  @end defun
  205. X  
  206. X  @defun calc-pop-stack n m
  207. X***************
  208. X*** 9564,9569 ****
  209. X--- 14715,14726 ----
  210. X  Remove the specified elements from the stack.  The parameters @var{n}
  211. X  and @var{m} are defined the same as for @code{calc-top-list}.  The return
  212. X  value of @code{calc-pop-stack} is uninteresting.
  213. X+ 
  214. X+ If there are any selected sub-formulas among the popped elements, and
  215. X+ @kbd{j e} has not been used to disable selections, this produces an
  216. X+ error without changing the stack.  If you supply an optional third
  217. X+ argument of @code{t}, the stack elements are popped even if they
  218. X+ contain selections.
  219. X  @end defun
  220. X  
  221. X  @defun calc-record-list vals tag
  222. X***************
  223. X*** 9590,9601 ****
  224. X  commands should use this in preference to @code{calc-top-list}; the only
  225. X  standard Calc commands that operate on the stack without normalizing
  226. X  are stack management commands like @code{calc-enter} and @code{calc-roll-up}.
  227. X  @end defun
  228. X  
  229. X  @defun calc-top-n m
  230. X  This function is a convenient form of @code{calc-top-list-n} in which only
  231. X  a single element of the stack is taken and returned, rather than a list
  232. X! of elements.
  233. X  @end defun
  234. X  
  235. X  @defun calc-enter-result n tag vals
  236. X--- 14747,14760 ----
  237. X  commands should use this in preference to @code{calc-top-list}; the only
  238. X  standard Calc commands that operate on the stack without normalizing
  239. X  are stack management commands like @code{calc-enter} and @code{calc-roll-up}.
  240. X+ This function accepts the same optional selection-mode argument as
  241. X+ @code{calc-top-list}.
  242. X  @end defun
  243. X  
  244. X  @defun calc-top-n m
  245. X  This function is a convenient form of @code{calc-top-list-n} in which only
  246. X  a single element of the stack is taken and returned, rather than a list
  247. X! of elements.  This also accepts an optional selection-mode argument.
  248. X  @end defun
  249. X  
  250. X  @defun calc-enter-result n tag vals
  251. X***************
  252. X*** 9610,9615 ****
  253. X--- 14769,14788 ----
  254. X  (calc-enter-result @var{n} @var{tag} (cons 'calcFunc-@var{func}
  255. X                                 (calc-top-list-n @var{n})))
  256. X  @end example
  257. X+ 
  258. X+ If any of the @var{n} stack elements replaced contain sub-formula
  259. X+ selections, and selections have not been disabled by @kbd{j e},
  260. X+ this function takes one of two courses of action.  If @var{n} is
  261. X+ equal to the number of elements in @var{vals}, then each element of
  262. X+ @var{vals} is spliced into the corresponding selection; this is what
  263. X+ happens when you use the @key{TAB} key, or when you use a unary
  264. X+ arithmetic operation like @code{sqrt}.  If @var{vals} has only one
  265. X+ element but @var{n} is greater than one, there must be only one
  266. X+ selection among the top @var{n} stack elements; the element from
  267. X+ @var{vals} is spliced into that selection.  This is what happens when
  268. X+ you use a binary arithmetic operation like @kbd{+}.  Any other
  269. X+ combination of @var{n} and @var{vals} when selections are present
  270. X+ is an error.
  271. X  @end defun
  272. X  
  273. X  @defun calc-unary-op tag func arg
  274. X***************
  275. X*** 9907,9912 ****
  276. X--- 15080,15086 ----
  277. X  error in the series evaluation without doing extra work which would be
  278. X  lost when the result is rounded back down to the current precision.
  279. X  In @code{defmath}, this can be written @samp{(~= @var{x} @var{y})}.
  280. X+ @var{X} and @var{y} can be numbers of any time, including complex.
  281. X  @end defun
  282. X  
  283. X  @defun nearly-zerop x y
  284. X***************
  285. X*** 9914,9920 ****
  286. X  checks whether @var{x} plus @var{y} would by be @code{nearly-equal}
  287. X  to @var{y} itself, to within the current precision, in other words,
  288. X  if adding @var{x} to @var{y} would have a negligible effect on @var{y}
  289. X! due to roundoff error.
  290. X  @end defun
  291. X  
  292. X  @defun is-true x
  293. X--- 15088,15095 ----
  294. X  checks whether @var{x} plus @var{y} would by be @code{nearly-equal}
  295. X  to @var{y} itself, to within the current precision, in other words,
  296. X  if adding @var{x} to @var{y} would have a negligible effect on @var{y}
  297. X! due to roundoff error.  @var{X} may be a real or complex number, but
  298. X! @var{y} must be real.
  299. X  @end defun
  300. X  
  301. X  @defun is-true x
  302. X***************
  303. X*** 10410,10418 ****
  304. X  The functions described here operate on symbolic formulas in the
  305. X  Calculator.
  306. X  
  307. X  @defun simplify expr
  308. X  Simplify the expression @var{expr} by applying various algebraic rules.
  309. X! This is what the @kbd{a s} (@code{calc-simplify}) command uses.
  310. X  @end defun
  311. X  
  312. X  @defun simplify-extended expr
  313. X--- 15585,15688 ----
  314. X  The functions described here operate on symbolic formulas in the
  315. X  Calculator.
  316. X  
  317. X+ @defun calc-prepare-selection num
  318. X+ Prepare a stack entry for selection operations.  If @var{num} is
  319. X+ omitted, the stack entry containing the cursor is used; otherwise,
  320. X+ it is the number of the stack entry to use.  This function stores
  321. X+ useful information about the current stack entry into a set of
  322. X+ variables.  @code{calc-selection-cache-num} contains the number of
  323. X+ the stack entry involved (equal to @var{num} if you specified it);
  324. X+ @code{calc-selection-cache-entry} contains the stack entry as a
  325. X+ list (such as @code{calc-top-list} would return with @code{entry}
  326. X+ as the selection mode); and @code{calc-selection-cache-comp} contains
  327. X+ a special ``tagged'' composition (@pxref{Formatting Lisp Functions})
  328. X+ which allows Calc to relate cursor positions in the buffer with
  329. X+ their corresponding sub-formulas.
  330. X+ 
  331. X+ A slight complication arises in the selection mechanism because
  332. X+ formulas may contain small integers.  For example, in the vector
  333. X+ @samp{[1, 2, 1]} the first and last elements are @code{eq} to each
  334. X+ other; selections are recorded as the actual Lisp object that
  335. X+ appears somewhere in the tree of the whole formula, but storing
  336. X+ @code{1} would falsely select both @code{1}'s in the vector.  So
  337. X+ @code{calc-prepare-selection} also checks the stack entry and
  338. X+ replaces any plain integers with ``complex number'' lists of the form
  339. X+ @samp{(cplx @var{n} 0)}.  This list will be displayed the same as a
  340. X+ plain @var{n} and the change will be completely invisible to the
  341. X+ user, but it will guarantee that no two sub-formulas of the stack
  342. X+ entry will be @code{eq} to each other.  Next time the stack entry
  343. X+ is involved in a computation, @code{calc-normalize} will replace
  344. X+ these lists with plain numbers again, again invisibly to the user.
  345. X+ @end defun
  346. X+ 
  347. X+ @defun calc-find-selected-part
  348. X+ Find the smallest sub-formula of the current formula that contains
  349. X+ the cursor.  This assumes @code{calc-prepare-selection} has been
  350. X+ called already.  If the cursor is not actually on any part of the
  351. X+ formula, this returns @code{nil}.
  352. X+ @end defun
  353. X+ 
  354. X+ @defun calc-change-current-selection selection
  355. X+ Change the currently prepared stack element's selection to
  356. X+ @var{selection}, which should be @code{eq} to some sub-formula
  357. X+ of the stack element, or @code{nil} to unselect the formula.
  358. X+ The stack element's appearance in the Calc buffer is adjusted
  359. X+ to reflect the new selection.
  360. X+ @end defun
  361. X+ 
  362. X+ @defun calc-find-nth-part expr n
  363. X+ Return the @var{n}th sub-formula of @var{expr}.  This function is used
  364. X+ by the selection commands, and (unless @kbd{j b} has been used) treats
  365. X+ sums and products as flat many-element formulas.  Thus if @var{expr}
  366. X+ is @samp{((a + b) - c) + d}, calling @code{calc-find-nth-part} with
  367. X+ @var{n} equal to four will return @samp{d}.
  368. X+ @end defun
  369. X+ 
  370. X+ @defun calc-find-parent-formula expr part
  371. X+ Return the sub-formula of @var{expr} which immediately contains
  372. X+ @var{part}.  If @var{expr} is @samp{a*b + (c+1)*d} and @var{part}
  373. X+ is @code{eq} to the @samp{c+1} term of @var{expr}, then this function
  374. X+ will return @samp{(c+1)*d}.  If @var{part} turns out not to be a
  375. X+ sub-formula of @var{expr}, the function returns @code{nil}.  If
  376. X+ @var{part} is @code{eq} to @var{expr}, the function returns @code{t}.
  377. X+ This function does not take associativity into account.
  378. X+ @end defun
  379. X+ 
  380. X+ @defun calc-find-assoc-parent-formula expr part
  381. X+ This is the same as @code{calc-find-parent-formula}, except that
  382. X+ (unless @kbd{j b} has been used) it continues widening the selection
  383. X+ to contain a complete level of the formula.  Given @samp{a} from
  384. X+ @samp{((a + b) - c) + d}, @code{calc-find-parent-formula} will
  385. X+ return @samp{a + b} but @code{calc-find-assoc-parent-formula} will
  386. X+ return the whole expression.
  387. X+ @end defun
  388. X+ 
  389. X+ @defun calc-grow-assoc-formula expr part
  390. X+ This expands sub-formula @var{part} of @var{expr} to encompass a
  391. X+ complete level of the formula.  If @var{part} and its immediate
  392. X+ parent are not compatible associative operators, or if @kbd{j b}
  393. X+ has been used, this simply returns @var{part}.
  394. X+ @end defun
  395. X+ 
  396. X+ @defun calc-find-sub-formula expr part
  397. X+ This finds the immediate sub-formula of @var{expr} which contains
  398. X+ @var{part}.  It returns an index @var{n} such that
  399. X+ @samp{(calc-find-nth-part @var{expr} @var{n})} would return @var{part}.
  400. X+ If @var{part} is not a sub-formula of @var{expr}, it returns @code{nil}.
  401. X+ If @var{part} is @code{eq} to @var{expr}, it returns @code{t}.  This
  402. X+ function does not take associativity into account.
  403. X+ @end defun
  404. X+ 
  405. X+ @defun calc-replace-sub-formula expr old new
  406. X+ This function returns a copy of formula @var{expr}, with the
  407. X+ sub-formula that is @code{eq} to @var{old} replaced by @var{new}.
  408. X+ @end defun
  409. X+ 
  410. X  @defun simplify expr
  411. X  Simplify the expression @var{expr} by applying various algebraic rules.
  412. X! This is what the @kbd{a s} (@code{calc-simplify}) command uses.  This
  413. X! always returns a copy of the expression; the structure @var{expr} points
  414. X! to remains unchanged in memory.
  415. X  @end defun
  416. X  
  417. X  @defun simplify-extended expr
  418. X***************
  419. X*** 10529,10551 ****
  420. X  default, as described above, is infinitely many times.@refill
  421. X  @end defun
  422. X  
  423. X! @defun apply-rewrite expr old new cond
  424. X! Apply a rewrite rule at the top level of @var{expr}, if possible, and
  425. X! return the rewritten expression.  If the rule does not match, return
  426. X! @code{nil}.
  427. X  @end defun
  428. X! 
  429. X! @defun check-rewrite-rules rules
  430. X! Make sure @var{rules} is a Calc expression in a form suitable for use
  431. X! as rewrite rules (i.e., a vector of two or three elements, a vector
  432. X! of such vectors, or a variable whose definition is a valid set of
  433. X! rewrite rules).  If so, return it in the form of a Lisp list of rewrite
  434. X! rules.  If it is not valid, call @code{error} to abort the command.
  435. X! @end defun
  436. X! 
  437. X! @defun apply-rewrite-rules expr rules
  438. X! Apply a Lisp list of rewrite rules at the top level of an expression.
  439. X! Use the first rule that applies; if none apply, return @code{nil}.
  440. X  @end defun
  441. X  
  442. X  @defun deriv expr var value symb
  443. X--- 15799,15843 ----
  444. X  default, as described above, is infinitely many times.@refill
  445. X  @end defun
  446. X  
  447. X! @defun compile-rewrites rules
  448. X! Compile the rewrite rule set specified by @var{rules}, which should
  449. X! be a formula that is either a vector or a variable name.  If the latter,
  450. X! the compiled rules are saved so that later @code{compile-rules} calls
  451. X! for that same variable can return immediately.  If there are problems
  452. X! with the rules, this function calls @code{error} with a suitable
  453. X! message.
  454. X! @end defun
  455. X! 
  456. X! @defun apply-rewrites expr crules heads
  457. X! Apply the compiled rewrite rule set @var{crules} to the expression
  458. X! @var{expr}.  This will make only one rewrite and only checks at the
  459. X! top level of the expression.  The result @code{nil} if no rules
  460. X! matched, or if the only rules that matched did not actually change
  461. X! the expression.  The @var{heads} argument is optional; if is given,
  462. X! it should be a list of all function names that (may) appear in
  463. X! @var{expr}.  The rewrite compiler tags each rule with the
  464. X! rarest-looking function name in the rule; if you specify @var{heads},
  465. X! @code{apply-rewrites} can use this information to narrow its search
  466. X! down to just a few rules in the rule set.
  467. X! @end defun
  468. X! 
  469. X! @defun rewrite-heads expr
  470. X! Compute a @var{heads} list for @var{expr} suitable for use with
  471. X! @code{apply-rewrites}, as discussed above.
  472. X! @end defun
  473. X! 
  474. X! @defun rewrite expr rules many
  475. X! This is an all-in-one rewrite function.  It compiles the rule set
  476. X! specified by @var{rules}, then uses @code{map-tree} to apply the
  477. X! rules throughout @var{expr} up to @var{many} (default infinity)
  478. X! times.
  479. X  @end defun
  480. X! 
  481. X! @defun match-patterns pat vec not-flag
  482. X! Given a Calc vector @var{vec} and an uncompiled pattern set or
  483. X! pattern set variable @var{pat}, this function returns a new vector
  484. X! of all elements of @var{vec} which do (or don't, if @var{not-flag} is
  485. X! non-@code{nil}) match any of the patterns in @var{pat}.
  486. X  @end defun
  487. X  
  488. X  @defun deriv expr var value symb
  489. X***************
  490. X*** 10560,10575 ****
  491. X  @code{deriv} returns @code{nil} instead.
  492. X  
  493. X  Derivatives of an function of one argument can be defined by
  494. X! adding a @code{math-derivative} property to the function's property
  495. X! list.  The value of the property should be a Lisp function of one
  496. X! argument (which is the argument that appears in the function call being
  497. X! differentiated), which should return a formula for the derivative.
  498. X! For example, the derivative of @code{ln} is defined by
  499. X  
  500. X  @example
  501. X! (put 'calcFunc-ln 'math-derivative
  502. X       (function (lambda (u) (math-div 1 u))))
  503. X  @end example
  504. X  @end defun
  505. X  
  506. X  @defun tderiv expr var value symb
  507. X--- 15852,15877 ----
  508. X  @code{deriv} returns @code{nil} instead.
  509. X  
  510. X  Derivatives of an function of one argument can be defined by
  511. X! adding a @code{math-derivative-@var{n}} property to the property list
  512. X! of the symbol for the function's derivative, which will be the
  513. X! function name followed by an apostrophe.  Here @var{n} is the number
  514. X! of arguments to the function.  The value of the property should be a
  515. X! Lisp function; it is called with the same arguments as the original
  516. X! function call that is being differentiated.  It should return a formula
  517. X! for the derivative.  For example, the derivative of @code{ln} is defined by
  518. X  
  519. X  @example
  520. X! (put 'calcFunc-ln\' 'math-derivative-1
  521. X       (function (lambda (u) (math-div 1 u))))
  522. X  @end example
  523. X+ 
  524. X+ The two-argument @code{log} function has two derivatives,
  525. X+ @example
  526. X+ (put 'calcFunc-log\' 'math-derivative-2     ; d(log(x,b)) / dx
  527. X+      ... )
  528. X+ (put 'calcFunc-log\'2 'math-derivative-2    ; d(log(x,b)) / db
  529. X+      ... )
  530. X+ @end example
  531. X  @end defun
  532. X  
  533. X  @defun tderiv expr var value symb
  534. X***************
  535. X*** 10647,10657 ****
  536. X--- 15949,15973 ----
  537. X  if the caller requested a non-``full'' solution.
  538. X  @end defun
  539. X  
  540. X+ @defun solve-eqn expr var full
  541. X+ This version of @code{solve-for} takes an expression which will
  542. X+ typically be an equation or inequality.  (If it is not, it will be
  543. X+ interpreted as the equation @samp{@var{expr} = 0}.)  It returns an
  544. X+ equation or inequality, or @code{nil} if no solution could be found.
  545. X+ @end defun
  546. X+ 
  547. X  @defun expr-contains expr var
  548. X  Returns the number of occurrences of @var{var} as a subexpression
  549. X  of @var{expr}, or @code{nil} if there are no occurrences.  Thus,
  550. X  this function can be used as a Lisp predicate or as an actual counting
  551. X  function.@refill
  552. X+ 
  553. X+ When used as a predicate, this function seems at first to be identical
  554. X+ to @code{calc-find-sub-formula}.  The key difference is that
  555. X+ @code{expr-contains} uses @code{equal} to test for matches, whereas
  556. X+ @code{calc-find-sub-formula} uses @code{eq}.  In the formula
  557. X+ @samp{f(a, a)}, the two @samp{a}'s will be @code{equal} but not
  558. X+ @code{eq} to each other.
  559. X  @end defun
  560. X  
  561. X  @defun expr-depends expr var
  562. X***************
  563. X*** 10876,10881 ****
  564. X--- 16192,16206 ----
  565. X  surrounded by parentheses unless it is a plain number or variable name.
  566. X  @end defun
  567. X  
  568. X+ @defun format-nice-expr a width
  569. X+ This is like @code{format-flat-expr} (with @var{prec} equal to 0),
  570. X+ except that newlines will be inserted to keep lines down to the
  571. X+ specified @var{width}, and vectors of vectors (not necessarily
  572. X+ strict matrices) are written in a pseudo-matrix format.  The
  573. X+ @code{calc-edit} command uses this when only a stack entry is
  574. X+ being edited.
  575. X+ @end defun
  576. X+ 
  577. X  @defun format-value a width
  578. X  Convert the Calc number or formula @var{a} to string form, using the
  579. X  format seen in the stack buffer.  Beware the the string returned may
  580. X***************
  581. X*** 10942,10953 ****
  582. X  @node Hooks, , Lisp Variables, Internals
  583. X  @subsubsection Hooks
  584. X  
  585. X! (This section is currently unfinished.)
  586. X  
  587. X  @node Installation, Reporting Bugs, Programming, Top
  588. X  @chapter Installation
  589. X  
  590. X! Calc 1.04 comes as a pair of Emacs Lisp files, generally called
  591. X  @file{calc.el} and @file{calc-ext.el}.  The first contains the basic
  592. X  foundations of the Calculator, and is as small as possible to promote
  593. X  quick loading.  The second contains all the more advanced commands and
  594. X--- 16267,16406 ----
  595. X  @node Hooks, , Lisp Variables, Internals
  596. X  @subsubsection Hooks
  597. X  
  598. X! Hooks are variables which contain Lisp functions (or lists of functions)
  599. X! which are called at various times.  Calc defines a number of hooks
  600. X! that help you to customize it in various ways.  Calc uses the Lisp
  601. X! function @code{run-hooks} to invoke the hooks shown below.  Several
  602. X! other customization-related variables are also described here.
  603. X! 
  604. X! @defvar calc-start-hook
  605. X! This hook is called as the last step in a @kbd{M-x calc} command.
  606. X! At this point, the Calc buffer has been created and initialized if
  607. X! necessary, the Calc window and trail window have been created,
  608. X! and the ``Welcome to Calc'' message has been displayed.
  609. X! @end defvar
  610. X! 
  611. X! @defvar calc-mode-hook
  612. X! This hook is called when the Calc buffer is being created.  Usually
  613. X! this will only happen once per Emacs session.  The hook is called
  614. X! after Emacs has switched to the new buffer, the mode-settings file
  615. X! has been read if necessary, and all other buffer-local variables
  616. X! have been set up.  After this hook returns, Calc will perform a
  617. X! @code{calc-refresh} operation, set up the mode line display, then
  618. X! evaluate @code{calc-defs} if present.
  619. X! @end defvar
  620. X! 
  621. X! @defvar calc-trail-mode-hook
  622. X! This hook is called when the Calc Trail buffer is being created.
  623. X! It is called as the very last step of setting up the Trail buffer.
  624. X! Like @code{calc-mode-hook}, this will normally happen only once
  625. X! per Emacs session.
  626. X! @end defvar
  627. X! 
  628. X! @defvar calc-end-hook
  629. X! This hook is called by @code{calc-quit}, generally because the user
  630. X! presses @key{q} or @kbd{M-#} while in Calc.  The Calc buffer will
  631. X! be the current buffer.  The hook is called as the very first
  632. X! step, before the Calc window has been destroyed.
  633. X! @end defvar
  634. X! 
  635. X! @defvar calc-window-hook
  636. X! If this hook exists, it is called to create the Calc window.
  637. X! Upon return, this new Calc window should be the current window.
  638. X! (The Calc buffer will already be the current buffer when the
  639. X! hook is called.)  If the hook is not defined, Calc will
  640. X! generally use @code{split-window}, @code{set-window-buffer},
  641. X! and @code{select-window} to create the Calc window.
  642. X! @end defvar
  643. X! 
  644. X! @defvar calc-trail-window-hook
  645. X! If this hook exists, it is called to create the Calc Trail window.
  646. X! The variable @code{calc-trail-buffer} will contain the buffer
  647. X! which the window should use.  Unlike @code{calc-window-hook},
  648. X! this hook must @emph{not} switch into the new window.
  649. X! @end defvar
  650. X! 
  651. X! @defvar calc-edit-mode-hook
  652. X! This hook is called by @code{calc-edit} (and a few other similar
  653. X! commands) when the temporary editing buffer is being created.
  654. X! The buffer will have been selected and set up to be in
  655. X! @code{calc-edit-mode}, but will not yet have been filled with
  656. X! text.  (In fact it may still have leftover text from a previous
  657. X! @code{calc-edit} command.)
  658. X! @end defvar
  659. X! 
  660. X! @defvar calc-mode-save-hook
  661. X! This hook is called by the @code{calc-save-modes} command,
  662. X! after Calc's own mode features have been inserted into the
  663. X! @file{.emacs} buffer and just before the ``End of mode settings''
  664. X! message is inserted.
  665. X! @end defvar
  666. X! 
  667. X! @defvar calc-other-modes
  668. X! This variable contains a list of strings.  The strings are
  669. X! concatenated at the end of the modes portion of the Calc
  670. X! mode line (after standard modes such as ``Deg'', ``Inv'' and
  671. X! ``Hyp'').  Each string should be a short, single word followed
  672. X! by a space.  The variable is @code{nil} by default.
  673. X! @end defvar
  674. X! 
  675. X! @defvar calc-mode-map
  676. X! This is the keymap that is used by Calc mode.  The best time
  677. X! to adjust it is probably in a @code{calc-mode-hook}.  If the
  678. X! Calc extensions package (@file{calc-ext.el}) has not yet been
  679. X! loaded, many of these keys will be bound to @code{calc-missing-key},
  680. X! which is a command that loads the extensions package and
  681. X! ``retypes'' the key.  If your @code{calc-mode-hook} rebinds
  682. X! one of these keys, it will probably be overridden when the
  683. X! extensions are loaded.
  684. X! @end defvar
  685. X! 
  686. X! @defvar calc-digit-map
  687. X! This is the keymap that is used during numeric entry.  Numeric
  688. X! entry uses the minibuffer, but this map binds every non-numeric
  689. X! key to @code{calcDigit-nondigit} which generally calls
  690. X! @code{exit-minibuffer} and ``retypes'' the key.
  691. X! @end defvar
  692. X! 
  693. X! @defvar calc-alg-ent-map
  694. X! This is the keymap that is used during algebraic entry.  This is
  695. X! mostly a copy of @code{minibuffer-local-map}.
  696. X! @end defvar
  697. X! 
  698. X! @defvar calc-store-var-map
  699. X! This is the keymap that is used during entry of variable names for
  700. X! commands like @code{calc-store} and @code{calc-recall}.  This is
  701. X! mostly a copy of @code{minibuffer-local-completion-map}.
  702. X! @end defvar
  703. X! 
  704. X! @defvar calc-edit-mode-map
  705. X! This is the (sparse) keymap used by @code{calc-edit} and other
  706. X! temporary editing commands.  It binds @key{RET}, @key{LFD},
  707. X! and @kbd{C-c C-c} to @code{calc-edit-finish}.
  708. X! @end defvar
  709. X! 
  710. X! @defvar calc-mode-var-list
  711. X! This is a list of variables which are saved by @code{calc-save-modes}.
  712. X! Each entry is a list of two items, the variable (as a Lisp symbol)
  713. X! and its default value.  When modes are being saved, each variable
  714. X! is compared with its default value (using @code{equal}) and any
  715. X! non-default variables are written out.
  716. X! @end defvar
  717. X! 
  718. X! @defvar calc-local-var-list
  719. X! This is a list of variables which should be buffer-local to the
  720. X! Calc buffer.  Each entry is a variable name (as a Lisp symbol).
  721. X! These variables also have their default values manipulated by
  722. X! the @code{calc} and @code{calc-quit} commands; @pxref{Multiple Calculators}.
  723. X! Since @code{calc-mode-hook} is called after this list has been
  724. X! used the first time, your hook should add a variable to the
  725. X! list and also call @code{make-local-variable} itself.
  726. X! @end defvar
  727. X  
  728. X  @node Installation, Reporting Bugs, Programming, Top
  729. X  @chapter Installation
  730. X  
  731. X! Calc 1.05 comes as a pair of Emacs Lisp files, generally called
  732. X  @file{calc.el} and @file{calc-ext.el}.  The first contains the basic
  733. X  foundations of the Calculator, and is as small as possible to promote
  734. X  quick loading.  The second contains all the more advanced commands and
  735. X***************
  736. X*** 10955,10960 ****
  737. X--- 16408,16462 ----
  738. X  @kbd{M-#} command auto-loads only the first part, and the second part is
  739. X  auto-loaded whenever the first advanced feature is used.@refill
  740. X  
  741. X+ To install Calc, just follow these simple steps.  If you want more
  742. X+ information, each step is discussed at length in the sections below.
  743. X+ 
  744. X+ @enumerate
  745. X+ @item
  746. X+ Create a ``home'' directory for Calc in a suitable place.
  747. X+ 
  748. X+ @item
  749. X+ Place the files @file{calc.el}, @file{calc-ext.el}, @file{macedit.el},
  750. X+ and @file{calc.texinfo} in this home directory.@refill
  751. X+ 
  752. X+ @item
  753. X+ Execute the command, @samp{emacs -batch -l calc.el -f calc-install}
  754. X+ in the home directory.  (This will split the two @file{.el} files
  755. X+ into many smaller files for even faster loading, compile all of
  756. X+ those files, compile @file{macedit.el}, and format the manual
  757. X+ for use with the Emacs Info system.)@refill
  758. X+ 
  759. X+ @item
  760. X+ Add all of the @code{autoload} and @code{global-set-key} commands shown
  761. X+ below to your @file{.emacs} file (if you are installing Calc just
  762. X+ for yourself) or to the system @file{default} file (if you
  763. X+ are installing Calc for your whole system).@refill
  764. X+ 
  765. X+ @item
  766. X+ If you wish to use the GNUPLOT-based graphics commands, you may have
  767. X+ to set up a few things in your @file{.emacs} or @file{default} file
  768. X+ as described below.@refill
  769. X+ 
  770. X+ @item
  771. X+ Test your installation as described at the end of these instructions.
  772. X+ 
  773. X+ @item
  774. X+ (Optional.)  To print a hardcopy of the Calc manual (about 300 pages),
  775. X+ move to the Calc home directory and type @file{tex calc.texinfo},
  776. X+ then @file{texindex calc.??}, then @file{tex calc.texinfo} again.
  777. X+ Now print the resulting @file{calc.dvi} file using whatever command
  778. X+ is appropriate on your system.
  779. X+ @end enumerate
  780. X+ 
  781. X+ Calc is now installed and ready to go!
  782. X+ 
  783. X+ If you are pressed for disk space, you can remove the @file{.el} files
  784. X+ after @code{calc-install} has run, but @emph{not} the @file{.elc} or
  785. X+ @file{.elX} files!  (The @file{.elX} files are copies of the original
  786. X+ @file{.el} files made by @code{calc-install} before it splits those
  787. X+ files into parts.  You will need them to install patches for future
  788. X+ versions of Calc.)@refill
  789. X+ 
  790. X  @section Compilation
  791. X  
  792. X  Calc is written in a way that maximizes performance when its code has been
  793. X***************
  794. X*** 10964,10971 ****
  795. X  is used to compile an Emacs Lisp file.  Compile each of @file{calc.el} and
  796. X  @file{calc-ext.el} to obtain byte-code files @file{calc.elc} and
  797. X  @file{calc-ext.elc}.  You may find you need to do @kbd{M-x load-file
  798. X! calc.elc} before compiling @file{calc-ext.el} will work.
  799. X  
  800. X  For your convenience, the FTP distribution of Calc, obtainable from
  801. X  anonymous FTP on @samp{csvax.cs.caltech.edu}, includes already-compiled
  802. X  versions of both of these files.
  803. X--- 16466,16476 ----
  804. X  is used to compile an Emacs Lisp file.  Compile each of @file{calc.el} and
  805. X  @file{calc-ext.el} to obtain byte-code files @file{calc.elc} and
  806. X  @file{calc-ext.elc}.  You may find you need to do @kbd{M-x load-file
  807. X! calc.elc} before compiling @file{calc-ext.el} will work.@refill
  808. X  
  809. X+ The @code{calc-install} command does all necessary byte-compilation
  810. X+ for you.
  811. X+ 
  812. X  For your convenience, the FTP distribution of Calc, obtainable from
  813. X  anonymous FTP on @samp{csvax.cs.caltech.edu}, includes already-compiled
  814. X  versions of both of these files.
  815. X***************
  816. X*** 10978,10989 ****
  817. X  file (if you are installing Calc publicly).
  818. X  
  819. X  @example
  820. X! (autoload 'calc             ".../calc.elc"     "Calculator Mode" t nil)
  821. X! (autoload 'calc-extensions  ".../calc-ext.elc" nil nil nil)
  822. X! (autoload 'quick-calc       ".../calc.elc"     "Quick Calculator" t nil)
  823. X! (autoload 'full-calc        ".../calc.elc"     "Full-screen Calculator" t nil)
  824. X! (autoload 'calc-eval        ".../calc.elc"     "Call Calculator" nil nil)
  825. X! (autoload 'calc-grab-region ".../calc-ext.elc" nil t nil)
  826. X  (autoload 'defmath          ".../calc-ext.elc" nil t t)
  827. X  @end example
  828. X  
  829. X--- 16483,16494 ----
  830. X  file (if you are installing Calc publicly).
  831. X  
  832. X  @example
  833. X! (autoload 'calc             ".../calc.elc"     "Calculator Mode" t)
  834. X! (autoload 'calc-extensions  ".../calc-ext.elc" nil)
  835. X! (autoload 'quick-calc       ".../calc.elc"     "Quick Calculator" t)
  836. X! (autoload 'full-calc        ".../calc.elc"     "Full-screen Calculator" t)
  837. X! (autoload 'calc-eval        ".../calc.elc"     "Use Calculator from Lisp")
  838. X! (autoload 'calc-grab-region ".../calc-ext.elc" nil t)
  839. X  (autoload 'defmath          ".../calc-ext.elc" nil t t)
  840. X  @end example
  841. X  
  842. X***************
  843. X*** 10990,10996 ****
  844. X  where @file{.../calc.elc} represents the full path to the @file{calc.elc}
  845. X  file, and similarly for @file{.../calc-ext.elc}.  If you have installed
  846. X  these files in Emacs' main @file{lisp/} directory, you can just write
  847. X! @samp{"calc.elc"} and @samp{"calc-ext.elc"}.
  848. X  
  849. X  The @code{autoload} command for @code{calc} is what loads @file{calc.elc}
  850. X  when you type @kbd{M-x calc}.  The @code{autoload} for @code{calc-extensions}
  851. X--- 16495,16504 ----
  852. X  where @file{.../calc.elc} represents the full path to the @file{calc.elc}
  853. X  file, and similarly for @file{.../calc-ext.elc}.  If you have installed
  854. X  these files in Emacs' main @file{lisp/} directory, you can just write
  855. X! @samp{"calc.elc"} and @samp{"calc-ext.elc"}.  If you have used the
  856. X! @code{calc-install} method and the home directory you chose is called,
  857. X! say, @file{/usr/gnu/src/calc}, then you would need to write
  858. X! @samp{"/usr/gnu/src/calc/calc.elc"} and similarly for @samp{calc-ext.elc}.
  859. X  
  860. X  The @code{autoload} command for @code{calc} is what loads @file{calc.elc}
  861. X  when you type @kbd{M-x calc}.  The @code{autoload} for @code{calc-extensions}
  862. X***************
  863. X*** 11011,11027 ****
  864. X  
  865. X  @section Splitting @file{calc-ext}
  866. X  
  867. X! On the other hand, you may find that @file{calc-ext.el} is too big to load
  868. X! quickly.  You can split the Calculator into still more parts using the
  869. X! @code{calc-split} command.  This command splits the file
  870. X! @file{calc-ext.el} into about 20 small files with names like
  871. X! @file{calc-cplx.el} and @file{calc-mode.el} in the same directory
  872. X! as @file{calc-ext.el}.  First, load the file @file{calc-ext.el} with
  873. X! @kbd{C-x C-f}.  Move to the end of the buffer and type @kbd{C-x C-e}
  874. X! at the indicated position.  Now type @kbd{M-x calc-split}.
  875. X! This moves most of the text out of @file{calc-ext.el} and into
  876. X! other files.  All necessary @code{autoload} commands are inserted
  877. X! into @file{calc-ext.el}.@refill
  878. X  
  879. X  The @code{calc-split} command prompts for a directory name; the new
  880. X  files are placed in this directory, and the @code{autoload} commands are
  881. X--- 16519,16571 ----
  882. X  
  883. X  @section Splitting @file{calc-ext}
  884. X  
  885. X! On the other hand, you may find that @file{calc.el} and @file{calc-ext.el}
  886. X! are too big to load quickly.  You can split the Calculator into still
  887. X! more parts using the @code{calc-install} or @code{calc-split} commands.
  888. X! The former command does everything necessary to split Calc in a typical
  889. X! installation.  Simply use @kbd{M-x cd} to change to the directory where
  890. X! you have installed @file{calc.el} and @file{calc-ext.el}.  Now use
  891. X! @kbd{M-x load-file} to load @file{calc.el}.  Finally, type
  892. X! @kbd{M-x calc-install}.  This command will split the two original
  893. X! Calc files into many smaller, quick-loading parts.  It will then
  894. X! byte-compile all of those parts for you.  This process automatically
  895. X! inserts the necessary @code{autoload} commands into @file{calc.el} and
  896. X! the @file{calc-ext.el} to refer to the parts of them that were moved
  897. X! to other files.  These @code{autoload} commands point to the directory
  898. X! you did your @code{calc-install} in, so if you move Calc to a new home
  899. X! you'll have to do the @code{calc-install} over again there.
  900. X! Note that you will still need to install the @code{autoload} commands
  901. X! shown above so that Emacs can find the two main Calc files.@refill
  902. X! 
  903. X! The @code{calc-install} command also formats the manual, assuming
  904. X! you have placed @file{calc.texinfo} in the same directory.
  905. X! 
  906. X! If you'd rather split and compile the Calculator from the Unix shell
  907. X! or a Makefile, you can use the command
  908. X! 
  909. X! @example
  910. X! cd @var{...} ; emacs -batch -l calc.el -f calc-install
  911. X! @end example
  912. X! 
  913. X! where again @file{...} represents the directory where Calc resides.
  914. X! 
  915. X! Note that when patches are made available for new versions of Calc, they
  916. X! will refer to the old, unsplit version of the files @file{calc.el} and
  917. X! @file{calc-ext.el}.  The @code{calc-install} command makes copies of
  918. X! these under the names @file{calc.elX} and @file{calc-ext.elX}; be sure
  919. X! to keep them around so you can rename them back to @file{calc.el} and
  920. X! @file{calc-ext.el} before installing new patches.  You can then re-split
  921. X! your updated version of Calc with another @code{calc-install}
  922. X! command.@refill
  923. X! 
  924. X! 
  925. X! The @code{calc-split} command gives you better control over the splitting
  926. X! process.  To use it, type @kbd{C-x C-f} to load @file{calc-ext.el}.
  927. X! Move to the end of the buffer and type @kbd{C-x C-e} at the indicated
  928. X! position.  Now type @kbd{M-x calc-split}.  This moves most of the text
  929. X! out of @file{calc-ext.el} and into other files.  You can now load
  930. X! @file{calc.el} and give another @code{calc-split} command in it to
  931. X! complete the splitting process.@refill
  932. X  
  933. X  The @code{calc-split} command prompts for a directory name; the new
  934. X  files are placed in this directory, and the @code{autoload} commands are
  935. X***************
  936. X*** 11029,11036 ****
  937. X  backspace over the default directory name and enter a blank name, in
  938. X  which case the @code{autoload} commands will be written without
  939. X  directory names on the assumption that Emacs can find the Calc files in
  940. X! one of the default places.  Some people prefer to put the Calc files in
  941. X! a subdirectory by themselves.@refill
  942. X  
  943. X  The @code{calc-split} command also offers to byte-compile all Calc files
  944. X  automatically.  Note that @file{calc.el} must have been byte-compiled
  945. X--- 16573,16581 ----
  946. X  backspace over the default directory name and enter a blank name, in
  947. X  which case the @code{autoload} commands will be written without
  948. X  directory names on the assumption that Emacs can find the Calc files in
  949. X! one of the default places, such as the main @file{emacs/lisp} directory.
  950. X! Some people prefer instead to put the Calc files in a subdirectory of
  951. X! their own, in which case you should answer with that directory's name.@refill
  952. X  
  953. X  The @code{calc-split} command also offers to byte-compile all Calc files
  954. X  automatically.  Note that @file{calc.el} must have been byte-compiled
  955. X***************
  956. X*** 11037,11054 ****
  957. X  and loaded already, just as if you were compiling @file{calc-ext} whole.
  958. X  If you choose to compile by hand, you will need to compile @file{calc.el}
  959. X  first, load it, compile the new @file{calc-ext.el} and load it, then
  960. X! compile each of the new component files.  Also, note that the
  961. X! @code{autoload} commands shown above are still correct for use in
  962. X! your startup file.@refill
  963. X  
  964. X! If you do decide to use @code{calc-split}, note that when patches
  965. X! are made available for new versions of Calc, they will refer to
  966. X! the old, unsplit version of the file @file{calc-ext.el}.  The
  967. X! @code{calc-split} command makes a copy of this under the name
  968. X! @file{calc-old.el}; be sure to keep it around so you can rename
  969. X! it back to @file{calc-ext.el} before installing new patches.
  970. X! You can then use @code{calc-split} again to re-split your updated
  971. X! version of Calc.@refill
  972. X  
  973. X  @section Key Bindings
  974. X  
  975. X--- 16582,16592 ----
  976. X  and loaded already, just as if you were compiling @file{calc-ext} whole.
  977. X  If you choose to compile by hand, you will need to compile @file{calc.el}
  978. X  first, load it, compile the new @file{calc-ext.el} and load it, then
  979. X! compile each of the new component files.  If you are using
  980. X! @code{calc-install} this is all handled for you.@refill
  981. X  
  982. X! The @code{calc-install} command basically does all of the above
  983. X! steps for you, first for @file{calc.el}, then for @file{calc-ext.el}.@refill
  984. X  
  985. X  @section Key Bindings
  986. X  
  987. X***************
  988. X*** 11055,11061 ****
  989. X  You may wish to bind the @code{calc} command to a key.  The
  990. X  recommended keystroke is @kbd{M-#} (i.e., Meta-Shift-3).  To set up
  991. X  this key binding, include this command in your @file{.emacs} or
  992. X! @file{lisp/default} file:
  993. X  
  994. X  @example
  995. X  (global-set-key "\e#" 'calc)
  996. X--- 16593,16599 ----
  997. X  You may wish to bind the @code{calc} command to a key.  The
  998. X  recommended keystroke is @kbd{M-#} (i.e., Meta-Shift-3).  To set up
  999. X  this key binding, include this command in your @file{.emacs} or
  1000. X! @file{lisp/default} file:@refill
  1001. X  
  1002. X  @example
  1003. X  (global-set-key "\e#" 'calc)
  1004. X***************
  1005. X*** 11064,11069 ****
  1006. X--- 16602,16616 ----
  1007. X  There are no standard key assignments for @code{quick-calc} and
  1008. X  @code{calc-grab-region}, but you may wish to define some.
  1009. X  
  1010. X+ @vindex calc-scan-for-dels
  1011. X+ Another key binding issue is the @key{DEL} key.  Some installations
  1012. X+ use a different key (such as backspace) for this purpose.  Calc
  1013. X+ normally scans the entire keymap and maps all keys defined like
  1014. X+ @key{DEL} to the @code{calc-pop} command.  However, this may be
  1015. X+ slow.  You can set the variable @code{calc-scan-for-dels} to
  1016. X+ @code{nil} to cause only the actual @key{DEL} key to be mapped to
  1017. X+ @code{calc-pop}; this will speed loading of Calc.
  1018. X+ 
  1019. X  @section The @file{macedit} Package
  1020. X  
  1021. X  The file @file{macedit.el} contains another useful Emacs extension
  1022. X***************
  1023. X*** 11073,11091 ****
  1024. X  To autoload it, you will want to include the commands,
  1025. X  
  1026. X  @example
  1027. X! (autoload 'edit-kbd-macro      ".../macedit.elc" "Edit Keyboard Macro" t nil)
  1028. X! (autoload 'edit-last-kbd-macro ".../macedit.elc" "Edit Keyboard Macro" t nil)
  1029. X  @end example
  1030. X  
  1031. X  @section Documentation
  1032. X  
  1033. X  The documentation for Calc (i.e., this manual) comes in a file
  1034. X! @file{calc.texinfo}.  To format this for use as an on-line manual,
  1035. X! open this file for editing in Emacs and give the command
  1036. X  @kbd{M-x texinfo-format-buffer}.  When this finishes, type @kbd{C-x C-s}
  1037. X  to save.  The result will be a collection of files whose names begin
  1038. X! with @file{calc-info}.  You can also format this into a printable
  1039. X! document using @TeX{}, but beware, the manual is about 170 printed pages!
  1040. X  
  1041. X  @vindex calc-info-filename
  1042. X  There is a Lisp variable called @code{calc-info-filename} which holds
  1043. X--- 16620,16650 ----
  1044. X  To autoload it, you will want to include the commands,
  1045. X  
  1046. X  @example
  1047. X! (autoload 'edit-kbd-macro      ".../macedit.elc" "Edit Keyboard Macro" t)
  1048. X! (autoload 'edit-last-kbd-macro ".../macedit.elc" "Edit Keyboard Macro" t)
  1049. X! (autoload 'read-kbd-macro      ".../macedit.elc" "Read Keyboard Macro" t)
  1050. X  @end example
  1051. X  
  1052. X+ @section The GNUPLOT Program
  1053. X+ 
  1054. X+ Calc's graphing commands use the GNUPLOT program.  If you have GNUPLOT
  1055. X+ but you must type some command other than @file{gnuplot} to get
  1056. X+ it, you should add a command to set the Lisp variable @code{calc-gnuplot-name}
  1057. X+ to the appropriate file name.  You may also need to change the variables
  1058. X+ @code{calc-gnuplot-plot-command} and @code{calc-gnuplot-print-command} in
  1059. X+ order to get correct displays and hardcopies, respectively, of your
  1060. X+ plots.@refill
  1061. X+ 
  1062. X  @section Documentation
  1063. X  
  1064. X  The documentation for Calc (i.e., this manual) comes in a file
  1065. X! @file{calc.texinfo}.  To format this for use as an on-line manual, open
  1066. X! this file for editing in Emacs (with @kbd{C-x C-f}) and give the command
  1067. X  @kbd{M-x texinfo-format-buffer}.  When this finishes, type @kbd{C-x C-s}
  1068. X  to save.  The result will be a collection of files whose names begin
  1069. X! with @file{calc-info}.  The @code{calc-install} command does this for you.
  1070. X! You can also format this into a printable document using @TeX{},
  1071. X! but beware, the manual is almost 300 printed pages!
  1072. X  
  1073. X  @vindex calc-info-filename
  1074. X  There is a Lisp variable called @code{calc-info-filename} which holds
  1075. X***************
  1076. X*** 11100,11106 ****
  1077. X  
  1078. X  @noindent
  1079. X  in your @file{.emacs} or @file{lisp/default} file, where again @file{...}
  1080. X! represents the directory containing the Info files.
  1081. X  
  1082. X  @section Settings File
  1083. X  
  1084. X--- 16659,16666 ----
  1085. X  
  1086. X  @noindent
  1087. X  in your @file{.emacs} or @file{lisp/default} file, where again @file{...}
  1088. X! represents the directory containing the Info files.  Again, if you
  1089. X! use @code{calc-install} this is handled for you.
  1090. X  
  1091. X  @section Settings File
  1092. X  
  1093. X***************
  1094. X*** 11121,11131 ****
  1095. X  @kbd{i} to make sure Calc can find its Info documentation.  Press @kbd{q}
  1096. X  to exit the Info system and @kbd{M-#} to re-enter the Calculator.
  1097. X  Type @kbd{20 S} to compute the sine of 20 degrees; this will test the
  1098. X! autoloading of the extensions module.  The result should be 0.342020143326.
  1099. X  Finally, press @kbd{M-#} again to make sure the Calculator can exit.
  1100. X  
  1101. X  (The above text is included in both the Calc documentation and the
  1102. X! file INSTALL in the Calc distribution directory.)
  1103. X  
  1104. X  @node Reporting Bugs, Key Index, Installation, Top
  1105. X  @chapter Reporting Bugs
  1106. X--- 16681,16696 ----
  1107. X  @kbd{i} to make sure Calc can find its Info documentation.  Press @kbd{q}
  1108. X  to exit the Info system and @kbd{M-#} to re-enter the Calculator.
  1109. X  Type @kbd{20 S} to compute the sine of 20 degrees; this will test the
  1110. X! autoloading of the extensions module (and the split submodules, if you
  1111. X! have used this feature).  The result should be 0.342020143326.
  1112. X  Finally, press @kbd{M-#} again to make sure the Calculator can exit.
  1113. X  
  1114. X+ You may also wish to test the GNUPLOT interface; to plot a sine wave,
  1115. X+ type @kbd{' [0 .. 360], sin(x) RET g f}.
  1116. X+ 
  1117. X+ 
  1118. X  (The above text is included in both the Calc documentation and the
  1119. X! file calc-INSTALL in the Calc distribution directory.)
  1120. X  
  1121. X  @node Reporting Bugs, Key Index, Installation, Top
  1122. X  @chapter Reporting Bugs
  1123. X*** newmacedit.el    Thu Oct  4 19:35:37 1990
  1124. X--- ../dist/newmacedit.el    Tue Oct  9 16:42:53 1990
  1125. X***************
  1126. X*** 0 ****
  1127. X--- 1,691 ----
  1128. X+ ;; Keyboard macro editor for GNU Emacs.  Version 1.02.
  1129. X+ ;; Copyright (C) 1990 Dave Gillespie, daveg@csvax.caltech.edu.
  1130. X+ 
  1131. X+ ;; This file is part of GNU Emacs.
  1132. X+ 
  1133. X+ ;; GNU Emacs is distributed in the hope that it will be useful,
  1134. X+ ;; but WITHOUT ANY WARRANTY.  No author or distributor
  1135. X+ ;; accepts responsibility to anyone for the consequences of using it
  1136. X+ ;; or for whether it serves any particular purpose or works at all,
  1137. X+ ;; unless he says so in writing.  Refer to the GNU Emacs General Public
  1138. X+ ;; License for full details.
  1139. X+ 
  1140. X+ ;; Everyone is granted permission to copy, modify and redistribute
  1141. X+ ;; GNU Emacs, but only under the conditions described in the
  1142. X+ ;; GNU Emacs General Public License.   A copy of this license is
  1143. X+ ;; supposed to have been given to you along with GNU Emacs so you
  1144. X+ ;; can know your rights and responsibilities.  It should be in a
  1145. X+ ;; file named COPYING.  Among other things, the copyright notice
  1146. X+ ;; and this notice must be preserved on all copies.
  1147. X+ 
  1148. X+ ;; Installation:
  1149. X+ ;;   (autoload 'edit-kbd-macro "macedit" "Edit a named keyboard macro" t)
  1150. X+ ;;   (autoload 'edit-last-kbd-macro "macedit" "Edit a keyboard macro" t)
  1151. X+ ;;   (autoload 'read-kbd-macro "macedit" "Parse region as keyboard macro" t)
  1152. X+ 
  1153. X+ 
  1154. X+ 
  1155. X+ ;; To use, type `M-x edit-last-kbd-macro' to edit the most recently
  1156. X+ ;; defined keyboard macro.  If you have used `M-x name-last-kbd-macro'
  1157. X+ ;; to give a keyboard macro a name, type `M-x edit-kbd-macro' to edit
  1158. X+ ;; the macro by name.  When you are done editing, type `C-c C-c' to
  1159. X+ ;; record your changes back into the original keyboard macro.
  1160. X+ 
  1161. X+ 
  1162. X+ 
  1163. X+ 
  1164. X+ ;;; The user-level commands for editing macros.
  1165. X+ 
  1166. X+ (defun edit-last-kbd-macro (&optional prefix buffer hook)
  1167. X+   "Edit the most recently defined keyboard macro."
  1168. X+   (interactive "P")
  1169. X+   (MacEdit-edit-macro last-kbd-macro
  1170. X+               (function (lambda (x arg) (setq last-kbd-macro x)))
  1171. X+               prefix buffer hook)
  1172. X+ )
  1173. X+ 
  1174. X+ (defun edit-kbd-macro (cmd &optional prefix buffer hook in-hook out-hook)
  1175. X+   "Edit a keyboard macro which has been assigned a name by name-last-kbd-macro.
  1176. X+ \(See also edit-last-kbd-macro.)"
  1177. X+   (interactive "CCommand name: \nP")
  1178. X+   (and cmd
  1179. X+        (MacEdit-edit-macro (if in-hook
  1180. X+                    (funcall in-hook cmd)
  1181. X+                  (symbol-function cmd))
  1182. X+                (or out-hook
  1183. X+                    (list 'lambda '(x arg)
  1184. X+                      (list 'fset
  1185. X+                        (list 'quote cmd)
  1186. X+                        'x)))
  1187. X+                prefix buffer hook cmd))
  1188. X+ )
  1189. X+ 
  1190. X+ (defun read-kbd-macro (start end)
  1191. X+   "Read the region as a keyboard macro definition.
  1192. X+ The region is interpreted as spelled-out keystrokes, e.g., `M-x abc RET'.
  1193. X+ The resulting macro is installed as the \"current\" keyboard macro.
  1194. X+ 
  1195. X+ Symbols:  RET, SPC, TAB, DEL, LFD, NUL; C-key; M-key.  (Must be uppercase.)
  1196. X+           REM marks the rest of a line as a comment.
  1197. X+           Whitespace is ignored; other characters are copied into the macro."
  1198. X+   (interactive "r")
  1199. X+   (setq last-kbd-macro (MacEdit-parse-keys (buffer-substring start end)))
  1200. X+   (if (and (string-match "\\`\C-x(" last-kbd-macro)
  1201. X+        (string-match "\C-x)\\'" last-kbd-macro))
  1202. X+       (setq last-kbd-macro (substring last-kbd-macro 2 -2)))
  1203. X+ )
  1204. X+ 
  1205. X+ 
  1206. X+ 
  1207. X+ 
  1208. X+ ;;; Formatting a keyboard macro as human-readable text.
  1209. X+ 
  1210. X+ (defun MacEdit-print-macro (macro-str local-map)
  1211. X+   (let ((save-map (current-local-map))
  1212. X+     (print-escape-newlines t)
  1213. X+     key-symbol key-str key-last prefix-arg this-prefix)
  1214. X+     (unwind-protect
  1215. X+     (progn
  1216. X+       (use-local-map local-map)
  1217. X+       (while (MacEdit-peek-char)
  1218. X+         (MacEdit-read-key)
  1219. X+         (setq this-prefix prefix-arg)
  1220. X+         (or (memq key-symbol '(digit-argument
  1221. X+                    negative-argument
  1222. X+                    universal-argument))
  1223. X+         (null prefix-arg)
  1224. X+         (progn
  1225. X+           (cond ((consp prefix-arg)
  1226. X+              (insert (format "prefix-arg (%d)\n"
  1227. X+                      (car prefix-arg))))
  1228. X+             ((eq prefix-arg '-)
  1229. X+              (insert "prefix-arg -\n"))
  1230. X+             ((numberp prefix-arg)
  1231. X+              (insert (format "prefix-arg %d\n" prefix-arg))))
  1232. X+           (setq prefix-arg nil)))
  1233. X+         (cond ((null key-symbol)
  1234. X+            (insert "type \"")
  1235. X+            (MacEdit-insert-string macro-str)
  1236. X+            (insert "\"\n")
  1237. X+            (setq macro-str ""))
  1238. X+           ((eq key-symbol 'digit-argument)
  1239. X+            (MacEdit-prefix-arg key-last nil prefix-arg))
  1240. X+           ((eq key-symbol 'negative-argument)
  1241. X+            (MacEdit-prefix-arg ?- nil prefix-arg))
  1242. X+           ((eq key-symbol 'universal-argument)
  1243. X+            (let* ((c-u 4) (argstartchar key-last)
  1244. X+               (char (MacEdit-read-char)))
  1245. X+              (while (= char argstartchar)
  1246. X+                (setq c-u (* 4 c-u)
  1247. X+                  char (MacEdit-read-char)))
  1248. X+              (MacEdit-prefix-arg char c-u nil)))
  1249. X+           ((eq key-symbol 'self-insert-command)
  1250. X+            (insert "insert ")
  1251. X+            (if (and (>= key-last 32) (<= key-last 126))
  1252. X+                (let ((str ""))
  1253. X+              (while (or (and (eq key-symbol
  1254. X+                          'self-insert-command)
  1255. X+                      (< (length str) 60)
  1256. X+                      (>= key-last 32)
  1257. X+                      (<= key-last 126))
  1258. X+                     (and (memq key-symbol
  1259. X+                            '(backward-delete-char
  1260. X+                          delete-backward-char
  1261. X+                          backward-delete-char-untabify))
  1262. X+                      (> (length str) 0)))
  1263. X+                (if (eq key-symbol 'self-insert-command)
  1264. X+                    (setq str (concat str
  1265. X+                          (char-to-string key-last)))
  1266. X+                  (setq str (substring str 0 -1)))
  1267. X+                (MacEdit-read-key))
  1268. X+              (insert "\"" str "\"\n")
  1269. X+              (MacEdit-unread-chars key-str))
  1270. X+              (insert "\"")
  1271. X+              (MacEdit-insert-string (char-to-string key-last))
  1272. X+              (insert "\"\n")))
  1273. SHAR_EOF
  1274. echo "End of part 19, continue with part 20"
  1275. echo "20" > s2_seq_.tmp
  1276. exit 0
  1277.  
  1278.