[slime-devel] Is there a good way to handle multiple "current directories"?

Daimrod daimrod at gmail.com
Sun Nov 20 21:50:31 UTC 2011


"Jeffrey Cunningham" <jeffrey at jkcunningham.com> writes:

> I keep running into to this rather trivial but annoying problem while
> working in slime. Emacs is running (of course), and god only knows
> what directory I was in when I started it up days ago. I am often
> working on more than one project, or I will be looking for some piece
> of data in a folder other than what Slime considers the "current
> directory" (which I usually determine by M-x d and looking to see
> where it's at). Whatever the case, if I want to run a few lines of
> code that access a different directory than the "current" one, I end
> up doing various ad hoc things, like figuring out the relative path
> between where it is and where I want it to be, or just typing out a
> fully-qualified pathname. 
>
> Is there a way to do this more easily? 
>
> I know that if I put something like
>
> (defparameter *i-am-here*
>   (make-pathname :name nil :type nil :version nil :defaults
> (parse-namestring *load-truename*)))
>
> in a file located in the directory I'm looking at, that the parameter
> will be set correctly when the file is loaded. But that begs the
> question, since I have to know where that file is to load it. 
>
> What I'd like to be able to do would be something like this:
>
> (with-open-file (fs (merge-pathnames "data.file"
> (directory-of-file-buffer)) :direction :input)
>   ;; do stuff
> )
>
> How do other people handle this situation?
>
> --Jeff

Do you know about Slime shortcuts ?
In the REPL type ,help RET

You can look at ,cd ,pwd ,pop ,push.





More information about the slime-devel mailing list