From: Stern, M. (NIH/NIA/I. [E] <st...@ma...> - 2019-06-11 20:57:11
|
How can I save values, sessions to my home directory? When I do save("file",...) from wxmaxima it saves it in the wxmaxima folder on my C drive instead of the maxima home directory on my data drive where everything else maxima is located, and with no extension even though it is a lisp file. In order to load it in the usual way I need to move it to the home directory and then add .lisp to the name to make it accessible. How can I avoid this (other than by typing a full filepath). When I do it from maxima.bat, it puts it in the maxima directory on the C drive. For obvious reasons I don't wan to be writing data to my system SSD. Suggestions? |
From: Gunter K. <gu...@pe...> - 2019-06-11 21:12:51
|
Wow... ...what is the output of build_info(); The Lisp standards were designed with a reality in mind in which the lisp is the operating system. Which means that the concept of an external operating system having a "current working directory" would be a custom extension to a lisp. The newest wxMaxima release should be able to switch the current working directory on all supported lisps, though. In the last few releases you would have been able to turn this feature on and off from wxMaxima's configuration dialogue as the lisp sbcl runs into problems if your system mixes unicode chars and chars from the local codepage in directory names resulting in error messages that annoyed users that never wrote files. Kind regards, Gunter. On 11.06.19 22:56, Stern, Michael (NIH/NIA/IRP) [E] via Maxima-discuss wrote: > > How can I save values, sessions to my home directory? When I do > save(“file”,…) from wxmaxima it saves it in the wxmaxima folder on my > C drive instead of the maxima home directory on my data drive where > everything else maxima is located, and with no extension even though > it is a lisp file. In order to load it in the usual way I need to > move it to the home directory and then add .lisp to the name to make > it accessible. How can I avoid this (other than by typing a full > filepath). When I do it from maxima.bat, it puts it in the maxima > directory on the C drive. For obvious reasons I don’t wan to be > writing data to my system SSD. > > > > Suggestions? > > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |
From: Robert D. <rob...@gm...> - 2019-06-12 05:04:28
|
On 2019-06-11, Stern, Michael (NIH/NIA/IRP) [E] via Maxima-discuss <max...@li...> wrote: > How can I save values, sessions to my home directory? When I do > save("file",...) from wxmaxima it saves it in the wxmaxima folder on > my C drive instead of the maxima home directory on my data drive where > everything else maxima is located, and with no extension even though > it is a lisp file. In order to load it in the usual way I need to > move it to the home directory and then add .lisp to the name to make > it accessible. How can I avoid this (other than by typing a full > filepath). When I do it from maxima.bat, it puts it in the maxima > directory on the C drive. For obvious reasons I don't wan to be > writing data to my system SSD. Well, on looking at the source code for 'save' in src/dsksetup.lisp, I see that it opens its output file without appending a path or changing the working directory or anything. So the output file will go whereever the Lisp implementation thinks is the default directory. I can see some different ways forward. One would be to append one of the existing paths, maxima_tempdir or maxima_userdir, to the file name in 'save'. That would be straightforward to do. Another idea is to call a "change directory" function. There are probably multiple implementations of such a function in various Common Lisp packages. One that I know is CHDIR in the UIOP/OS package of the UIOP project (which provides a system-independent compability layer for files and filesystem operations). UIOP is used by ASDF, which might be included in the Maxima image you are using -- try :lisp (require :asdf) and then :lisp (find-package "UIOP"). If that returns something, try :lisp (uiop/os:chdir "something/something/something"). If that succeeds, then maybe save("foo.lisp", ...) will put foo.lisp there -- I tried that and it did work as expected. If ASDF is not in your Maxima image, maybe you are willing to install Quicklisp (http://beta.quicklisp.org) and then :lisp (ql:quickload :uiop) after which try :lisp (uiop/os:chdir ...). This is all certainly a clumsy mess and I'm just trying to figure out something that could work. If all else fails then just writing save("foo/bar/baz/quux.lisp", ...) should work, and it's not too painful. Hope this helps, Robert Dodier |
From: Gunter K. <gu...@pe...> - 2019-06-12 06:25:37
|
In theory wxMaxima should do the following things: * If the directory the worksheet is in is known when maxima is started the environment variable MAXIMA_INITIAL_FOLDER is set accordingly. This should cause maxima.bat to changes maxima's working directory into the Right Folder => Problem solved * If this is the case once the name of the worksheet file is known wxMaxima sends the following command to maxima: :lisp-quiet (wx-cd <filename>) * The definition of wx-cd is as follows: (defun wx-cd (dir) (handler-case (progn (let ((dir (cond ((pathnamep dir) dir) ((stringp dir) (make-pathname :directory (pathname-directory dir) :host (pathname-host dir) :device (pathname-device dir))) (t (error "cd(dir): dir must be a string or pathname."))))) #+ allegro (excl:chdir dir) #+clisp (ext:cd dir) #+cmu (setf (ext:default-directory) dir) #+cormanlisp (ccl:set-current-directory dir) #+gcl (si::chdir dir) #+lispworks (hcl:change-directory dir) #+lucid (lcl:working-directory dir) #+sbcl (sb-posix:chdir dir) #+sbcl (setf *default-pathname-defaults* (sb-ext:native-pathname (format nil "~A~A" (sb-posix:getcwd) "/"))) #+ccl (ccl:cwd dir) #+ecl (si::chdir dir) ;;; Officially gcl supports (si:chdir dir), too. But the version ;;; shipped with debian and ubuntu (at least in Feb 2017) doesn't. #+gcl (xchdir dir) #+gcl (setf *default-pathname-defaults* dir) #-(or allegro clisp cmu cormanlisp gcl lispworks lucid sbcl ccl ecl) (format t "Info: wxMathml.cpp: Changing the working dir during a maxima session isn't implemented for this lisp.") (namestring dir) (wx-print-variables))) (error (c) (format t "Warning: Can set maxima's working directory but cannot change it during the maxima session :~%~&~%") (values 0 c)))) In theory that should set maxima's current working directory, too. Is the directory you save the worksheets in actually mapped to a drive one can change the current working directory to or are your file on a network share and therefore named something to the likes of \\myshare\path\filename.wxmx? Don't know enough of windows to know if there would be a way to handle that. Kind regards, Gunter. |
From: <l.c...@gm...> - 2019-06-12 21:42:13
|
Maybe the maxima command "system" can help. Best. Laurent. || -----Message d'origine----- || De : Robert Dodier <rob...@gm...> || Envoyé : mercredi 12 juin 2019 07:04 || À : max...@li... || Objet : Re: [Maxima-discuss] "Save" location || || On 2019-06-11, Stern, Michael (NIH/NIA/IRP) [E] via Maxima-discuss || <max...@li...> wrote: || || > How can I save values, sessions to my home directory? When I do || > save("file",...) from wxmaxima it saves it in the wxmaxima folder on || > my C drive instead of the maxima home directory on my data drive where || > everything else maxima is located, and with no extension even though || > it is a lisp file. In order to load it in the usual way I need to || > move it to the home directory and then add .lisp to the name to make || > it accessible. How can I avoid this (other than by typing a full || > filepath). When I do it from maxima.bat, it puts it in the maxima || > directory on the C drive. For obvious reasons I don't wan to be || > writing data to my system SSD. || || Well, on looking at the source code for 'save' in src/dsksetup.lisp, I see that || it opens its output file without appending a path or changing the working || directory or anything. So the output file will go whereever the Lisp || implementation thinks is the default directory. || || I can see some different ways forward. One would be to append one of the || existing paths, maxima_tempdir or maxima_userdir, to the file name in || 'save'. That would be straightforward to do. || || Another idea is to call a "change directory" function. There are probably || multiple implementations of such a function in various Common Lisp || packages. One that I know is CHDIR in the UIOP/OS package of the UIOP || project (which provides a system-independent compability layer for files || and filesystem operations). UIOP is used by ASDF, which might be included || in the Maxima image you are using -- try :lisp (require :asdf) and then :lisp || (find-package "UIOP"). If that returns something, try :lisp (uiop/os:chdir || "something/something/something"). If that succeeds, then maybe || save("foo.lisp", ...) will put foo.lisp there -- I tried that and it did work as || expected. || || If ASDF is not in your Maxima image, maybe you are willing to install || Quicklisp (http://beta.quicklisp.org) and then :lisp (ql:quickload :uiop) after || which try :lisp (uiop/os:chdir ...). || || This is all certainly a clumsy mess and I'm just trying to figure out something || that could work. || || If all else fails then just writing save("foo/bar/baz/quux.lisp", ...) should || work, and it's not too painful. || || Hope this helps, || || Robert Dodier || || || || _______________________________________________ || Maxima-discuss mailing list || Max...@li... || https://lists.sourceforge.net/lists/listinfo/maxima-discuss |
From: Robert D. <rob...@gm...> - 2019-06-13 00:16:10
|
Another idea to try. How about this: :lisp (setq *default-pathname-defaults* #p"/something/something/") which is supposed to be pasted onto a file name when a directory isn't otherwise specified. I find that after setting *DEFAULT-PATHNAME-DEFAULTS*, 'save' puts its output file into that directory. hope this helps, Robert Dodier |
From: Elias M. <lo...@gm...> - 2019-06-13 03:21:26
|
Some background in case anyone is interested: This is a consequence of Common Lisp's attempt to create a platform-independent pathname representation. At the time CL was designed, there were a very wide variety of filesystems in use, each having wildly different semantics. Many of them didn't even have a concept of "current directory". This abstraction was, unfortunately, overdesigned and sort of bolts-on a different system on top of whatever the underlying operating system uses. *DEFAULT-PATHNAME-DEFAULTS* is one of these systems. This is why forcing a change of current directory (i.e. by using SB-POSIX:CHDIR) doesn't really work most of the time, and even when it does, it's not reliable across implementations. Regards, Elias On Thu, 13 Jun 2019 at 08:17, Robert Dodier <rob...@gm...> wrote: > Another idea to try. How about this: > > :lisp (setq *default-pathname-defaults* #p"/something/something/") > > which is supposed to be pasted onto a file name when a directory isn't > otherwise specified. > > I find that after setting *DEFAULT-PATHNAME-DEFAULTS*, 'save' puts its > output file into that directory. > > hope this helps, > Robert Dodier > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |
From: Stern, M. (NIH/NIA/I. [E] <st...@ma...> - 2019-06-13 03:29:43
|
Macsyma 2.4 wrapped it up with CLIMAX in a single Windows XP executable so I never got to see these complications before. BTW, for those who didn’t see my previous reply, Robert Dodier’s suggestion worked well when loaded in the maxima-init in Windows 7 and Windows 10. From: Elias Mårtenson <lo...@gm...> Sent: Wednesday, June 12, 2019 11:23 PM To: Robert Dodier <rob...@gm...> Cc: Stern, Michael (NIH/NIA/IRP) [E] <st...@ma...>; max...@li... Subject: Re: [Maxima-discuss] "Save" location Some background in case anyone is interested: This is a consequence of Common Lisp's attempt to create a platform-independent pathname representation. At the time CL was designed, there were a very wide variety of filesystems in use, each having wildly different semantics. Many of them didn't even have a concept of "current directory". This abstraction was, unfortunately, overdesigned and sort of bolts-on a different system on top of whatever the underlying operating system uses. *DEFAULT-PATHNAME-DEFAULTS* is one of these systems. This is why forcing a change of current directory (i.e. by using SB-POSIX:CHDIR) doesn't really work most of the time, and even when it does, it's not reliable across implementations. Regards, Elias On Thu, 13 Jun 2019 at 08:17, Robert Dodier <rob...@gm...<mailto:rob...@gm...>> wrote: Another idea to try. How about this: :lisp (setq *default-pathname-defaults* #p"/something/something/") which is supposed to be pasted onto a file name when a directory isn't otherwise specified. I find that after setting *DEFAULT-PATHNAME-DEFAULTS*, 'save' puts its output file into that directory. hope this helps, Robert Dodier _______________________________________________ Maxima-discuss mailing list Max...@li...<mailto:Max...@li...> https://lists.sourceforge.net/lists/listinfo/maxima-discuss |