temp files, was: how to re-define the HOME directory?



plot-temp-file is also used in share packages, not just plot.lisp. If
you change it, you should make sure you don't break any share
packages.

Also, if plot functions start producing new files each time you plot
something, someone should make sure they get deleted. If they are not
in /tmp and on windows they will not be removed by the system.

Andrej



On Fri, Jun 5, 2009 at 11:44 AM, Leo Butler<l.butler at ed.ac.uk> wrote:
>
>
> On Thu, 4 Jun 2009, Robert Dodier wrote:
>
> < On Thu, Jun 4, 2009 at 10:21 AM, Leo Butler <l.butler at ed.ac.uk> wrote:
> <
> < > I came up with the following lisp code to imitate mktemp. I modified plot-temp-file from
> < > src/plot.lisp so that it now returns a name not already belonging to
> < > an existing file.
> <
> < Leo, that's terrific. The one quibble I have is that the comment
> < says "Implements mkstemp.c in C-L" but the Lisp version just
> < returns the file name without creating the file (as mkstemp does).
> < There is a disclaimer following that statement which says the
> < file is not created, but it seems likely that "Implements mkstemp"
> < would be seen without the disclaimer. So I'll recommend that you
> < make the comment more accurate.
> <
> < Also can you please put a copyright claim (for yourself) and a
> < license statement on it? S.t. like "Copyright Leo Butler 2009.
> < I release this work under terms of the GNU General Public License."
> < would be enough (for me, anyway). Of course as the author you
> < can pick whatever license terms you want; GPL makes it simpler
> < to include in Maxima, should we decide to import it.
>
> Robert, I have made the revisions you requested, fixed a bracket issue
> that was invisible in gcl and added an 'in-package' line at the top.
>
> I do intend to extend this a bit, to make an interface so that maxima
> users can create multiple files with a filename template like
> "tmp-XXXXX" along the lines of mktemp. However, this already fixes a
> user's problem, so I will defer that extension for now.
>
> Here is output from a maxima session:
>
> (%i1) to_lisp();
> Type (to-maxima) to restart, ($quit) to quit Maxima.
>
> MAXIMA> (load "/knoppix-home/work/lisp/mktemp.lisp")
> WARNING: DEFUN/DEFMACRO: redefining function PLOT-TEMP-FILE in
> /knoppix-home/work/lisp/mktemp.lisp, was defined in
> ? ? ? ? /knoppix-home/work/maxima/maxima-5.18.1/src/binary-clisp/plot.fas
> T
> MAXIMA> (to-maxima)
> Returning to Maxima
> (%o1) true
> (%i2) plot2d(sin(x),[x,-%pi,%pi])$
> (%i3) plot2d(sin(x),[x,-%pi,%pi])$
> (%i4) to_lisp();
> Type (to-maxima) to restart, ($quit) to quit Maxima.
>
> MAXIMA> (compile-file "/knoppix-home/work/lisp/mktemp.lisp")
> ;; Compiling file /knoppix-home/work/lisp/mktemp.lisp ...
> ;; Wrote file /knoppix-home/work/lisp/mktemp.fas
> 0 errors, 0 warnings
> #P"/knoppix-home/work/lisp/mktemp.fas"
> NIL
> NIL
> MAXIMA> (to-maxima)
> Returning to Maxima
> (%o4) true
> (%i5) plot2d(sin(x),[x,-%pi,%pi])$
>
> -------------------------
> $ ls /tmp/maxout*
> /tmp/maxout.gnuplot_pipesKcmTZu ?/tmp/maxout.gnuplot_pipesnJmJqK
> /tmp/maxout.gnuplot_pipesx3b15x
>
>
> As you can see, it works nicely (ok, you can't see the graphs...).
> -----------------
> Oliver, this fixes your problem. You can load this into each one of your
> maxima sessions and be guaranteed that your gnuplot calls won't clobber
> one another.
>
> Leo
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>