Greetings,
This problem has been bothering me for awhile. If I start emacs and then slime in one directory and M-x cd to another, even though M-x pwd tells me I am in the other directory, running a simple piece of code like
(with-open-file (*standard-output* "test" :direction :output) (print (get-universal-time)))
demonstrates that Lisp still thinks it's "current" directory is the first directory.
How do you get around this problem? The only way I know is to kill the current inferior-lisp, change directories, and start a new one, which seems somewhat over-kill to say the least.
Regards,
Jeff
Jeffrey Cunningham jeffrey@jkcunningham.com writes:
Greetings,
This problem has been bothering me for awhile. If I start emacs and then slime in one directory and M-x cd to another, even though M-x pwd tells me I am in the other directory, running a simple piece of code like
(with-open-file (*standard-output* "test" :direction :output) (print (get-universal-time)))
demonstrates that Lisp still thinks it's "current" directory is the first directory.
How do you get around this problem? The only way I know is to kill the current inferior-lisp, change directories, and start a new one, which seems somewhat over-kill to say the least.
Common Lisp uses the standard variable *DEFAULT-PATHNAME-DEFAULTS* to control how relative pathnames are turned into absolute pathnames for filesystem operations.
http://l1sp.org/cl/*default-pathname-defaults* has more info.
Zach
Thanks, Zach. That's exactly what I needed to know.
I tried it in a fresh emacs & slime setup and see that M-x cd calls swank:set-default-directory, after which *DEFAULT-PATHNAME-DEFAULTS* has been changed as expected. What's curious is that I periodically run into cases where it doesn't seem to be working. Of course, at the moment my working emacs slime (recently started) is behaving as it should. Next time it acts up I'll take a look at the value of *default-pathname-defaults* to see if it is in fact being changed. I bet not.
Regards, Jeff
On 06/11/2012 10:02 AM, Zach Beane wrote:
Common Lisp uses the standard variable*DEFAULT-PATHNAME-DEFAULTS* to control how relative pathnames are turned into absolute pathnames for filesystem operations.
http://l1sp.org/cl/*default-pathname-defaults* has more info.
Jeffrey Cunningham jeffrey@jkcunningham.com writes:
Thanks, Zach. That's exactly what I needed to know.
I tried it in a fresh emacs & slime setup and see that M-x cd calls swank:set-default-directory, after which *DEFAULT-PATHNAME-DEFAULTS* has been changed as expected. What's curious is that I periodically run into cases where it doesn't seem to be working. Of course, at the moment my working emacs slime (recently started) is behaving as it should. Next time it acts up I'll take a look at the value of *default-pathname-defaults* to see if it is in fact being changed. I bet not.
M-x cd invokes the emacs "cd" function, which changes emacs's notion of where the current working directory is, but it has no effect on the Lisp implementation connected via SLIME.
M-x slime-cd (or the ,cd REPL command) should always update the Lisp implementation's notion of the current working directory.
Zach
11.06.2012, 21:33, "Zach Beane" xach@xach.com:
Jeffrey Cunningham jeffrey@jkcunningham.com writes:
Thanks, Zach. That's exactly what I needed to know.
I tried it in a fresh emacs & slime setup and see that M-x cd calls swank:set-default-directory, after which *DEFAULT-PATHNAME-DEFAULTS* has been changed as expected. What's curious is that I periodically run into cases where it doesn't seem to be working. Of course, at the moment my working emacs slime (recently started) is behaving as it should. Next time it acts up I'll take a look at the value of *default-pathname-defaults* to see if it is in fact being changed. I bet not.
M-x cd invokes the emacs "cd" function, which changes emacs's notion of where the current working directory is, but it has no effect on the Lisp implementation connected via SLIME.
M-x slime-cd (or the ,cd REPL command) should always update the Lisp implementation's notion of the current working directory.
There is also also has M-x slime-set-default-directory (now that I know about slime-cd I wonder what is the difference between them).
BTW, both these slime functions call swank:set-default-directory. This method in some lisp implementations does a little bit more that changing *DEFAULT-PATHNAME-DEFAULTS*, for example:
;; swank-lispworks.lisp (defimplementation set-default-directory (directory) (namestring (hcl:change-directory directory)))
;; swank-clisp.lisp (defimplementation set-default-directory (directory) (setf (ext:default-directory) directory) (namestring (setf *default-pathname-defaults* (ext:default-directory))))
Am Mon, 11 Jun 2012 09:58:52 -0700 schrieb Jeffrey Cunningham jeffrey@jkcunningham.com:
Greetings,
This problem has been bothering me for awhile. If I start emacs and then slime in one directory and M-x cd to another, even though M-x pwd tells me I am in the other directory, running a simple piece of code like
(with-open-file (*standard-output* "test" :direction :output) (print (get-universal-time)))
demonstrates that Lisp still thinks it's "current" directory is the first directory.
How do you get around this problem? The only way I know is to kill the current inferior-lisp, change directories, and start a new one, which seems somewhat over-kill to say the least.
Regards,
Jeff
The Emacs M-x cd command only changes the Emacs default-directory. To change the Common Lisp *DEFAULT-PATHNAME-DEFAULTS*, too, type a comma at the CL-USER> prompt in the *slime-repl* buffer, then a Command: prompt appears in the Emacs minibuffer, where you type cd, and then the directory where you want to change to.
Got it. I've been using the two interchangeably which no doubt explains everything.
Thanks. Jeff
On 06/11/2012 10:28 AM, edgar wrote:
Am Mon, 11 Jun 2012 09:58:52 -0700 schrieb Jeffrey Cunninghamjeffrey@jkcunningham.com:
Greetings,
This problem has been bothering me for awhile. If I start emacs and then slime in one directory and M-x cd to another, even though M-x pwd tells me I am in the other directory, running a simple piece of code like
(with-open-file (*standard-output* "test" :direction :output) (print (get-universal-time)))
demonstrates that Lisp still thinks it's "current" directory is the first directory.
How do you get around this problem? The only way I know is to kill the current inferior-lisp, change directories, and start a new one, which seems somewhat over-kill to say the least.
Regards,
Jeff
The Emacs M-x cd command only changes the Emacs default-directory. To change the Common Lisp *DEFAULT-PATHNAME-DEFAULTS*, too, type a comma at the CL-USER> prompt in the *slime-repl* buffer, then a Command: prompt appears in the Emacs minibuffer, where you type cd, and then the directory where you want to change to.
slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel