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

Jeffrey Cunningham jeffrey at jkcunningham.com
Sun Nov 20 17:54:55 UTC 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20111120/db27d082/attachment.html>


More information about the slime-devel mailing list