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
"Jeffrey Cunningham" jeffrey@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.
On Sun, 20 Nov 2011 13:50:31 -0800, Daimrod daimrod@gmail.com wrote:
Do you know about Slime shortcuts ? In the REPL type ,help RET
You can look at ,cd ,pwd ,pop ,push.
I do now. Thank you. (I can't believe I didn't know about these).
--Jeff
On Sun, 20 Nov 2011 09:54:55 -0800, Jeffrey Cunningham wrote:
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?
Hi Jeffrey,
I usually make an ASD file to load my project (BTW, it is really easy to do a skeleton with Quickproject), and then use asdf:system-relative-pathname. It is documented here: http://common-lisp.net/project/asdf/asdf/Miscellaneous-additional-functional...
HTH,
Tamas
On Mon, 21 Nov 2011 01:38:09 -0800, Tamas Papp tkpapp@gmail.com wrote:
How do other people handle this situation?
Hi Jeffrey,
I usually make an ASD file to load my project (BTW, it is really easy to do a skeleton with Quickproject), and then use asdf:system-relative-pathname. It is documented here: http://common-lisp.net/project/asdf/asdf/Miscellaneous-additional-functional...
HTH,
Tamas
That is a useful function. Thank you, Tamas.
Jeff