]> code.delx.au - gnu-emacs/blob - lisp/calc/INSTALL
Initial import of Calc 2.02f.
[gnu-emacs] / lisp / calc / INSTALL
1
2 Installation
3 ************
4
5 Calc 2.02 comes as a set of GNU Emacs Lisp files, with names like
6 `calc.el' and `calc-ext.el', and also as a `calc.texinfo' file which
7 can be used to generate both on-line and printed documentation.
8
9 To install Calc, just follow these simple steps. If you want more
10 information, each step is discussed at length in the sections below.
11
12 1. Change (`cd') to the Calc "home" directory. This directory was
13 created when you unbundled the Calc `.tar' or `.shar' file.
14
15 2. Type `make' to install Calc privately for your own use, or type
16 `make install' to install Calc system-wide. This will compile all
17 the Calc component files, modify your `.emacs' or the system-wide
18 `lisp/default' file to install Calc as appropriate, and format
19 the on-line Calc manual.
20
21 Both variants are shorthand for the following three steps:
22
23 * `make compile' to run the byte-compiler.
24
25 * `make private' or `make public', corresponding to `make' and
26 `make install', respectively. (If `make public' fails
27 because your system doesn't already have a `default' or
28 `default.el' file, use Emacs or the Unix `touch' command to
29 create a zero-sized one first.)
30
31 * `make info' to format the on-line Calc manual. This first
32 tries to use the `makeinfo' program; if that program is not
33 present, it uses the Emacs `texinfo-format-buffer' command
34 instead.
35
36 The Unix `make' utility looks in the file `Makefile' in the
37 current directory to see what Unix commands correspond to the
38 various "targets" like `install' or `public'. If your system
39 doesn't have `make', you will have to examine the `Makefile' and
40 type in the corresponding commands by hand.
41
42 3. If you ever move Calc to a new home directory, just give the
43 `make private' or `make public' command again in the new
44 directory.
45
46 4. Test your installation as described at the end of these
47 instructions.
48
49 5. (Optional.) To print a hardcopy of the Calc manual (over 500
50 pages) or just the Calc Summary (about 20 pages), follow the
51 instructions under "Printed Documentation" below.
52
53 Calc is now installed and ready to go!
54
55
56 Upgrading from Calc 1.07
57 =========================
58
59 If you have Calc version 1.07 or earlier, you will find that Calc 2.00
60 is organized quite differently. For one, Calc 2.00 is now distributed
61 already split into many parts; formerly this was done as part of the
62 installation procedure. Also, some new functions must be autoloaded
63 and the `M-#' key must be bound to `calc-dispatch' instead of to
64 `calc'.
65
66 The easiest way to upgrade is to delete your old Calc files and then
67 install Calc 2.00 from scratch using the above instructions. You
68 should then go into your `.emacs' or `default' file and remove the old
69 `autoload' and `global-set-key' commands for Calc, since `make
70 public'/`make private' has added new, better ones.
71
72 See the `README' and `README.prev' files in the Calc distribution
73 for more information about what has changed since version 1.07.
74 (`README.prev' describes changes before 2.00, and is present only in
75 the FTP and tape versions of the distribution.)
76
77
78 The `make public' Command
79 ==========================
80
81 If you are not the regular Emacs administrator on your system, your
82 account may not be allowed to execute the `make public' command, since
83 the system-wide `default' file may be write-protected. If this is the
84 case, you will have to ask your Emacs installer to execute this
85 command. (Just `cd' to the Calc home directory and type `make
86 public'.)
87
88 The `make private' command adds exactly the same set of commands to
89 your `.emacs' file as `make public' adds to `default'. If your Emacs
90 installer is concerned about typing this command out of the blue, you
91 can ask her/him instead to copy the necessary text from your `.emacs'
92 file. (It will be marked by a comment that says "Commands added by
93 `calc-private-autoloads' on (date and time).")
94
95
96 Compilation
97 ============
98
99 Calc is written in a way that maximizes performance when its code has
100 been byte-compiled; a side effect is that performance is seriously
101 degraded if it *isn't* compiled. Thus, it is essential to compile the
102 Calculator before trying to use it. The function `calc-compile' in
103 the file `calc-maint.el' runs the Emacs byte-compiler on all the Calc
104 source files. (Specifically, it runs `M-x byte-compile-file' on all
105 files in the current directory with names of the form `calc*.el', and
106 also on the file `macedit.el'.)
107
108 If `calc-compile' finds that certain files have already been
109 compiled and have not been changed since, then it will not bother to
110 recompile those files.
111
112 The `calc-compile' command also pre-builds certain tables, such as
113 the units table (see "The Units Table") and the built-in rewrite
114 rules (see "Rearranging with Selections") which Calc would otherwise
115 need to rebuild every time those features were used.
116
117 The `make compile' shell command is simply a convenient way to
118 start an Emacs and give it a `calc-compile' command.
119
120
121 Auto-loading
122 =============
123
124 To teach Emacs how to load in Calc when you type `M-#' for the first
125 time, add these lines to your `.emacs' file (if you are installing
126 Calc just for your own use), or the system's `lisp/default' file (if
127 you are installing Calc publicly). The `make private' and `make
128 public' commands, respectively, take care of this. (Note that `make'
129 runs `make private', and `make install' runs `make public'.)
130
131 (autoload 'calc-dispatch "calc" "Calculator Options" t)
132 (autoload 'full-calc "calc" "Full-screen Calculator" t)
133 (autoload 'full-calc-keypad "calc" "Full-screen X Calculator" t)
134 (autoload 'calc-eval "calc" "Use Calculator from Lisp")
135 (autoload 'defmath "calc" nil t t)
136 (autoload 'calc "calc" "Calculator Mode" t)
137 (autoload 'quick-calc "calc" "Quick Calculator" t)
138 (autoload 'calc-keypad "calc" "X windows Calculator" t)
139 (autoload 'calc-embedded "calc" "Use Calc from any buffer" t)
140 (autoload 'calc-embedded-activate "calc" "Activate =>'s in buffer" t)
141 (autoload 'calc-grab-region "calc" "Grab region of Calc data" t)
142 (autoload 'calc-grab-rectangle "calc" "Grab rectangle of data" t)
143
144 Unless you have installed the Calc files in Emacs' main `lisp/'
145 directory, you will also have to add a command that looks like the
146 following to tell Emacs where to find them. In this example, we have
147 put the files in directory `/usr/gnu/src/calc-2.00'.
148
149 (setq load-path (append load-path (list "/usr/gnu/src/calc-2.00")))
150
151 The `make public' and `make private' commands also do this (they use
152 the then-current directory as the name to add to the path). If you
153 move Calc to a new location, just repeat the `make public' or `make
154 private' command to have this new location added to the `load-path'.
155
156 The `autoload' command for `calc-dispatch' is what loads `calc.elc'
157 when you type `M-#'. It is the only `autoload' that is absolutely
158 necessary for Calc to work. The others are for commands and features
159 that you may wish to use before typing `M-#' for the first time. In
160 particular, `full-calc' and `full-calc-keypad' are autoloaded to
161 support "standalone" operation (see "Standalone Operation"),
162 `calc-eval' and `defmath' are autoloaded to allow other Emacs Lisp
163 programs to use Calc facilities (see "Calling Calc from Your
164 Programs"), and `calc-embedded-activate' is autoloaded because some
165 Embedded Mode files may call it as soon as they are read into Emacs
166 (see "Assignments in Embedded Mode").
167
168
169 Finding Component Files
170 ========================
171
172 There is no need to write `autoload' commands that point to all the
173 various Calc component files like `calc-misc.elc' and `calc-alg.elc'.
174 The main file, `calc.elc', contains all the necessary `autoload'
175 commands for these files.
176
177 (Actually, to conserve space `calc.elc' only autoloads a few of the
178 component files, plus `calc-ext.elc', which in turn autoloads the rest
179 of the components. This allows Calc to load a little faster in the
180 beginning, but the net effect is the same.)
181
182 This autoloading mechanism assumes that all the component files can
183 be found on the `load-path'. The `make public' and `make private'
184 commands take care of this, but Calc has a few other strategies in
185 case you have installed it in an unusual way.
186
187 If, when Calc is loaded, it is unable to find its components on the
188 `load-path' it is given, it checks the file name in the original
189 `autoload' command for `calc-dispatch'. If that name included
190 directory information, Calc adds that directory to the `load-path':
191
192 (autoload 'calc-dispatch "calc-2.00/calc" "Calculator" t)
193
194 Suppose the directory `/usr/gnu/src/emacs/lisp' is on the path, and
195 the above `autoload' allows Emacs to find Calc under the name
196 `/usr/gnu/src/emacs/lisp/calc-2.00/calc.elc'. Then when Calc starts
197 up it will add `/usr/gnu/src/emacs/lisp/calc-2.00' to the path so that
198 it will later be able to find its component files.
199
200 If the above strategy does not locate the component files, Calc
201 examines the variable `calc-autoload-directory'. This is initially
202 `nil', but you can store the name of Calc's home directory in it as a
203 sure-fire way of getting Calc to find its components.
204
205
206 Merging Source Files
207 =====================
208
209 If the `autoload' mechanism is not managing to load each part of Calc
210 when it is needed, you can concatenate all the `.el' files into one
211 big file. The order should be `calc.el', then `calc-ext.el', then all
212 the other files in any order. Byte-compile the resulting big file.
213 This merged Calculator ought to work just like Calc normally does,
214 though it will be *substantially* slower to load.
215
216
217 Key Bindings
218 =============
219
220 Calc is normally bound to the `M-#' key. To set up this key binding,
221 include the following command in your `.emacs' or `lisp/default' file.
222 (This is done automatically by `make private' or `make public',
223 respectively.)
224
225 (global-set-key "\e#" 'calc-dispatch)
226
227 Note that `calc-dispatch' actually works as a prefix for various
228 two-key sequences. If you have a convenient unused function key on
229 your keyboard, you may wish to bind `calc-dispatch' to that as well.
230 You may even wish to bind other specific Calc functions like `calc' or
231 `quick-calc' to other handy function keys.
232
233 Even if you bind `calc-dispatch' to other keys, it is best to bind
234 it to `M-#' as well if you possibly can: There are references to
235 `M-#' all throughout the Calc manual which would confuse novice users
236 if they didn't work as advertised.
237
238 Another key binding issue is the DEL key. Some installations use a
239 different key (such as backspace) for this purpose. Calc normally
240 scans the entire keymap and maps all keys defined like DEL to the
241 `calc-pop' command. However, this may be slow. You can set the
242 variable `calc-scan-for-dels' to `nil' to cause only the actual DEL
243 key to be mapped to `calc-pop'; this will speed loading of Calc.
244
245
246 The `macedit' Package
247 ======================
248
249 The file `macedit.el' contains another useful Emacs extension called
250 `edit-kbd-macro'. It allows you to edit a keyboard macro in
251 human-readable form. The `Z E' command in Calc knows how to use it to
252 edit user commands that have been defined by keyboard macros. To
253 autoload it, you will want to include the commands,
254
255 (autoload 'edit-kbd-macro "macedit" "Edit Keyboard Macro" t)
256 (autoload 'edit-last-kbd-macro "macedit" "Edit Keyboard Macro" t)
257 (autoload 'read-kbd-macro "macedit" "Read Keyboard Macro" t)
258
259 The `make public' and `make private' commands do this.
260
261
262 The GNUPLOT Program
263 ====================
264
265 Calc's graphing commands use the GNUPLOT program. If you have GNUPLOT
266 but you must type some command other than `gnuplot' to get it, you
267 should add a command to set the Lisp variable `calc-gnuplot-name' to
268 the appropriate file name. You may also need to change the variables
269 `calc-gnuplot-plot-command' and `calc-gnuplot-print-command' in order
270 to get correct displays and hardcopies, respectively, of your plots.
271
272
273 On-Line Documentation
274 ======================
275
276 The documentation for Calc (this manual) comes in a file called
277 `calc.texinfo'. To format this for use as an on-line manual, type
278 `make info' (to use the `makeinfo' program), or `make texinfo' (to use
279 the `texinfmt.el' program which runs inside of Emacs). The former
280 command is recommended if it works on your system; it is faster and
281 produces nicer-looking output.
282
283 The `makeinfo' program will report inconsistencies involving the
284 nodes "Copying" and "Interactive Tutorial"; these messages should be
285 ignored.
286
287 The result will be a collection of files whose names begin with
288 `calc.info'. You may wish to add a reference to the first of these,
289 `calc.info' itself, to your Info system's `dir' file. (This is
290 optional since the `M-# i' command can access `calc.info' whether or
291 not it appears in the `dir' file.)
292
293 There is a Lisp variable called `calc-info-filename' which holds
294 the name of the Info file containing Calc's on-line documentation.
295 Its default value is `"calc.info"', which will work correctly if the
296 Info files are stored in Emacs' main `info/' directory, or if they are
297 in any of the directories listed in the `load-path'. If you keep them
298 elsewhere, you will want to put a command of the form,
299
300 (setq calc-info-filename ".../calc.info")
301
302 in your `.emacs' or `lisp/default' file, where `...' represents the
303 directory containing the Info files. This will not be necessary if
304 you follow the normal installation procedures.
305
306 The `make info' and `make texinfo' commands compare the dates on
307 the files `calc.texinfo' and `calc.info', and run the appropriate
308 program only if the latter file is older or does not exist.
309
310
311 Printed Documentation
312 ======================
313
314 Because the Calc manual is so large, you should only make a printed
315 copy if you really need it. To print the manual, you will need the
316 TeX typesetting program (this is a free program by Donald Knuth at
317 Stanford University) as well as the `texindex' program and
318 `texinfo.tex' file, both of which can be obtained from the FSF as part
319 of the `texinfo2' package.
320
321 To print the Calc manual in one huge 550 page tome, type `make tex'.
322 This will take care of running the manual through TeX twice so that
323 references to later parts of the manual will have correct page numbers.
324 (Don't worry if you get some "overfull box" warnings.)
325
326 The result will be a device-independent output file called
327 `calc.dvi', which you must print in whatever way is right for your
328 system. On many systems, the command is
329
330 lpr -d calc.dvi
331
332 Marginal notes for each function and key sequence normally alternate
333 between the left and right sides of the page, which is correct if the
334 manual is going to be bound as double-sided pages. Near the top of
335 the file `calc.texinfo' you will find alternate definitions of the
336 `\bumpoddpages' macro that put the marginal notes always on the same
337 side, best if you plan to be binding single-sided pages.
338
339 Some people find the Calc manual to be too large to handle easily.
340 In fact, some versions of TeX have too little memory to print it. So
341 Calc includes a `calc-split-manual' command that splits `calc.texinfo'
342 into two volumes, the Calc Tutorial and the Calc Reference. The
343 easiest way to use it is to type `make tex2' instead of `make tex'.
344 The result will be two smaller files, `calctut.dvi' and `calcref.dvi'.
345 The former contains the tutorial part of the manual; the latter
346 contains the reference part. Both volumes include copies of the
347 "Getting Started" chapter and licensing information.
348
349 To save disk space, you may wish to delete `calctut.*' and
350 `calcref.*' after you're done. Don't delete `calc.texinfo', because
351 you will need it to install future patches to Calc. The `make tex2'
352 command takes care of all of this for you.
353
354 The `make textut' command formats only the Calc Tutorial volume,
355 producing `calctut.dvi' but not `calcref.dvi'. Likewise, `make
356 texref' formats only the Calc Reference volume.
357
358 Finally, there is a `calc-split-summary' command that splits off
359 just the Calc Summary appendix suitable for printing by itself. Type
360 `make summary' instead of `make tex'. The resulting `calcsum.dvi'
361 file will print in less than 20 pages. If the Key Index file
362 `calc.ky' is present, left over from a previous `make tex' command,
363 then `make summary' will insert a column of page numbers into the
364 summary using that information.
365
366 The `make isummary' command is like `make summary', but it prints a
367 summary that is designed to be substituted into the regular manual.
368 (The two summaries will be identical except for the additional column
369 of page numbers.) To make a complete manual, run `make tex' and `make
370 isummary', print the two resulting `.dvi' files, then discard the
371 Summary pages that came from `calc.dvi' and insert the ones from
372 `calcsum.dvi' in their place. Also, remember that the table of
373 contents prints at the end of the manual but should generally be moved
374 to the front (after the title and copyright pages).
375
376 If you don't have TeX, you can print the summary as a plain text
377 file by going to the "Summary" node in Calc's Info file, then typing
378 `M-x print-buffer' (see "Summary").
379
380
381 Settings File
382 ==============
383
384 Another variable you might want to set is `calc-settings-file', which
385 holds the file name in which commands like `m m' and `Z P' store
386 "permanent" definitions. The default value for this variable is
387 `"~/.emacs"'. If `calc-settings-file' does not contain `".emacs"' as
388 a substring, and if the variable `calc-loaded-settings-file' is `nil',
389 then Calc will automatically load your settings file (if it exists)
390 the first time Calc is invoked.
391
392
393 Testing the Installation
394 =========================
395
396 To test your installation of Calc, start a new Emacs and type `M-# c'
397 to make sure the autoloads and key bindings work. Type `M-# i' to
398 make sure Calc can find its Info documentation. Press `q' to exit the
399 Info system and `M-# c' to re-enter the Calculator. Type `20 S' to
400 compute the sine of 20 degrees; this will test the autoloading of the
401 extensions modules. The result should be 0.342020143326. Finally,
402 press `M-# c' again to make sure the Calculator can exit.
403
404 You may also wish to test the GNUPLOT interface; to plot a sine
405 wave, type `' [0 .. 360], sin(x) RET g f'. Type `g q' when you are
406 done viewing the plot.
407
408 Calc is now ready to use. If you wish to go through the Calc
409 Tutorial, press `M-# t' to begin.
410
411
412 (The above text is included in both the Calc documentation and the
413 file INSTALL in the Calc distribution directory.)