Hide Forgot
Created attachment 491249 [details] Simple test file for Maxima, takes the derivative of x^2. Description of problem: The load() function returns an error, at least when its argument is a Maxima file. Version-Release number of selected component (if applicable): 5.23.2-1 How reproducible: Always Steps to Reproduce: 1. Start maxima. 2. Type load("test.max")$ at the Maxima prompt, where "test.max" is the attached file. Actual results: I get the following error messages: Maxima encountered a Lisp error: READ failure in COMPILE-FILE: SB-INT:SIMPLE-READER-ERROR at 4 (line 1, column 4) on #<SB-SYS:FD-STREAM for "file /home/jjramsey/Desktop/test.max" {1005C29D71}>: illegal terminating character after a colon: #\ Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. ; ; compilation unit aborted ; caught 1 fatal ERROR condition Expected results: Maxima displays "foo = 2 x". Additional info: Typing batch("test.max")$ works as expected.
The problem goes away if I rename "test.max" to "test.mac". Turns out that the function that load() uses to identify the file type has changed in newer versions. In Maxima 5.23.2, the function looks like this: (defun $file_type (fil) (let ((typ ($pathname_type fil))) (cond ((member typ '("l" "lsp" "lisp") :test #'string=) '$lisp) ((member typ '("mac" "mc" "demo" "dem" "dm1" "dm2" "dm3" "dmt") :test #'string=) '$maxima) (t '$object)))) Near as I can tell, if the file name ends in ".mac", ".mc", ".demo", etc., it's counted as a file with Maxima code. The code from Maxima 5.20.1 reads as follows: (defun $file_type (fil &aux typ) (setq fil (pathname fil)) (setq typ (format nil "~(~A~)" (pathname-type fil))) (or (and (> (length typ) 0) (let ((ch (aref typ 0))) (cdr (assoc ch '((#\m . $maxima) (#\d . $maxima) (#\l . $lisp) (#\o . $object) (#\f . $object)))))) '$object)) Near as I can tell, if the file name extension begins with an "m" or "d", it's counted as a file with Maxima code. I used to be able to load files ending in ".max" in older versions of Maxima, but Maxima's behavior has simply changed in newer versions. That's all.
Whew, excellent detective-work.