[slime-devel] Question about current directory and M-x cd behavior

Anton Vodonosov avodonosov at yandex.ru
Mon Jun 11 17:47:24 UTC 2012



11.06.2012, 21:33, "Zach Beane" <xach at xach.com>:
> Jeffrey Cunningham <jeffrey at 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))))





More information about the slime-devel mailing list