To add maxima initialization files maxima-init.lisp and maxima-init.mac,
append $load and $batchload statements to macsyma-top-level. This function
is defined in macsys.lisp. Thus macsyma-top-level is changed to
(defun macsyma-top-level ()
(let ((*package* (find-package "MAXIMA")))
(apply 'format t
"Maxima ~a.~a ~a (with enhancements by William Schelter).~%Licensed under the GNU Public License (see file COPYING)~%"
(get :maxima :version))
(if ($file_search "maxima-init.lisp") ($load "maxima-init.lisp")) ;; added
(if ($file_search "maxima-init.mac") ($batchload "maxima-init.mac")) ;; added
(catch 'quit-to-lisp
(in-package "MAXIMA")
(sloop
do
(catch #+kcl si::*quit-tag* #+cmu 'continue #-(or kcl cmu) nil
(catch 'macsyma-quit
(continue)(bye)))))))
Now, after the core maxima system is loaded, maxima will use its
file_search scheme to look for the files "maxima-init.lisp" and
"maxima-init.mac" (in that order) and load them if they are found.
Here is an example of a maxima-init.lisp file. It redefines
$setup_autoload to use $file_search. Without this change,
setup_autoload may need a full pathname to the file.
----start maxima-init.lisp-----------------
(defun $setup_autoload (filename &rest functions)
(let ((file ($file_search filename)))
(dolist (func functions)
(nonsymchk func '$setup_autoload)
(putprop (setq func (dollarify-name func)) file 'autoload)
(add2lnc func $props))) '$done)
----end of file----------------------------
To autoload the function hermite that is in specfun, the
maxima-init.mac file is
-----start maxima-init.mac--------------
setup_autoload(specfun, hermite);
----end of file----------------------------
At least, it works for me: my Lisp is GCL 2.4.0, my maxima is 5.6,
my OS is RedHat 6.1, and my eyes are brown:
GCL (GNU Common Lisp) Version(2.4.0) Fri Jan 11 07:37:59 CST 2002
Licensed under GNU Library General Public License
Contains Enhancements by W. Schelter
Maxima 5.6 Fri Jan 11 07:37:26 CST 2002 (with enhancements by William Schelter).
Licensed under the GNU Public License (see file COPYING)
Loading maxima-init.lisp
Finished loading maxima-init.lisp
(C1) display2d : false$
(C2) hermite(2,x);
Loading /usr/local/lib/maxima-5.6/src/specfun.o
start address -T 85c4000 Finished loading /usr/local/lib/maxima-5.6/src/specfun.o
(D2) -2*(1-2*x^2)
(If setup_autoload is changed to use file_search in the maxima source,
some additional changes need to be made to compile maxima. I didn't
try to do that.)
Barton