How to set current SBCL directory using slime?

In the past, I used the following script to run SBCL:

breakchars="(){}[],^%$#@\"\";:''|\\" cd /media/E/work exec rlwrap --remember -c -b "$breakchars" -f "$HOME"/.sbcl_completions sbcl --noinform --userinit "$HOME"/.sbclrc " $@ " 

Now that you are using slime in emacs, doonot I know how to set the current SBCL directory?

Any suggestion appreciated!

+7
source share
2 answers

Why do you need to change the current directory from SLIME? I assume that this is not because you want to visit the source Lisp file from the system you are currently writing, but because you want to write code that reads or writes to a file containing data.

If so, it is probably best to try local-projects in Quicklisp . Together with quickproject it makes it easy to create systems that you can load using (ql:quickload 'my-system) or even (require 'my-system) .

If you need to refer to the data file located relative to the root of the my-system (just using the name from the last paragraph to bring the examples in line), you can use asdf:system-relative-pathname . For example, (asdf:system-relative-pathname 'my-system "files/data.txt") .

Of course, deployment is a completely different business. My solution is to see how the executable executable was launched to determine if the code is being deployed or is under development. If under development, I use asdf:system-relative-pathname . If it is deployed, I determine the path to the files based on the path of the executable file (my build script "copies these files next to the executable files when creating the project).

Since I started using this approach, my need for cd -ing in SBCL dropped to zero. cd around was not difficult, but it was nice to have fewer things to worry about.

+5
source

SLIME starts the Lisp system with the current directory taken from the directory in which the file associated with the current buffer is located. Typically, you should open the file in which you want to run SLIME first.

If you want to change the current directory to Lisp, then cd shortcut is the best way. This assumes that you have the correct slime-repl setting since the current Slime default settings are very minimal. See the packages provided , you probably want at least a slime-fancy metapackage .

+8
source

All Articles