Search code examples
emacscommon-lispclispslime

CLISP tries to load weird directory in SLIME on Windows 10


I've previously successfully installed Emacs + SLIME + SBCL on this machine.

I'm trying to install CLISP to work through some of the "Land of Lisp" examples that are CLISP specific.

When I start up SLIME with CLISP, it breaks when trying to load some SLIME files:

*** - OPEN: Directory #P"C:\\Users\\GUSTAV~1.BER\\AppData\\Local\\Temp\\" does not exist

I've explicitly set the temporary-file-directory to a fully expanded directory ("C:\\Users\\Gustav.Bertram\\AppData\\Local\\Temp\\") in .clisprc.lisp and I made sure that the variable is available at the point where the break happens.

The backtrace immediately after the error shows:

<1/164> #<SYSTEM-FUNCTION SHOW-STACK> 3
<2/157> #<COMPILED-FUNCTION SYSTEM::PRINT-BACKTRACE>
<3/151> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE>
<4/142> #<SYSTEM-FUNCTION SYSTEM::READ-EVAL-PRINT> 2
<5/139> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2-3>
<6/135> #<SYSTEM-FUNCTION SYSTEM::SAME-ENV-AS> 2
<7/121> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2>
<8/119> #<SYSTEM-FUNCTION SYSTEM::DRIVER>
<9/79> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP>
<10/76> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1
<11/65> #<SYSTEM-FUNCTION OPEN>
<12/57> #<COMPILED-FUNCTION SWANK::ANNOUNCE-SERVER-PORT>
<13/54> #<COMPILED-FUNCTION SWANK::START-SERVER-1>
<14/49> #<COMPILED-FUNCTION SWANK::SETUP-SERVER>
<15/42> #<COMPILED-FUNCTION SWANK:START-SERVER>
<16/40> #<SYSTEM-FUNCTION FUNCALL> 2
[38] EVAL frame for form (FUNCALL (READ-FROM-STRING "swank:start-server") "c:\\Users\\GUSTAV~1.BER\\AppData\\Local\\Temp\\slime.34812")
<17/35> #<SPECIAL-OPERATOR PROGN>
[34] EVAL frame for form 
(PROGN
 (LOAD "c:\\Users\\Gustav.Bertram\\AppData\\Roaming\\.emacs.d\\elpa\\slime-20170921.1000\\swank-loader.lisp" :VERBOSE T)
 (FUNCALL (READ-FROM-STRING "swank-loader:init"))
 (FUNCALL (READ-FROM-STRING "swank:start-server") "c:\\Users\\GUSTAV~1.BER\\AppData\\Local\\Temp\\slime.34812"))
Printed 17 frames

How can I figure out where the function call is coming from?


Solution

  • In the stack trace you can see that CLISP is evaluating the following:

    (PROGN
     (LOAD "c:\\Users\\Gustav.Bertram\\AppData\\Roaming\\.emacs.d\\elpa\\slime-20170921.1000\\swank-loader.lisp" :VERBOSE T)
     (FUNCALL (READ-FROM-STRING "swank-loader:init"))
     (FUNCALL (READ-FROM-STRING "swank:start-server") "c:\\Users\\GUSTAV~1.BER\\AppData\\Local\\Temp\\slime.34812"))
    

    This is what Slime passes to the Common Lisp after launching it in order to load Swank and start up a server to communicate with. You can see that the wrong path to the temporary file directory is passed as a string here, which means the directory must be resolved on the Emacs side. Emacs has a variable temporary-file-directory for this, which can be set in your initialization file, or via customize.