[slime-devel] AllegroCL and ,cd without a trailing slash

Mikel Bancroft mutandiz at yahoo.com
Fri Mar 24 07:03:25 UTC 2006

I've run into a problem in some emacs versions where changing 
directories via ,cd without a trailing slash will cause subsequent cd 
commands (and possibly other pathname related lisp routines) to fail.

The problem is that read-directory-name may or may not return a path 
string with a trailing slash. So a directory "/users/mikel/foo" that
is passed to set-default-directory in the allegro backend and is parsed 
into a pathname with 'foo' in the :name slot rather than as part of the 
:directory. This is then stored into *default-pathname-defaults*.

The following patch avoids this since the path returned by excl:chdir 
returns a path string with a trailing slash regardless of whether or not 
its argument does and thus will be parsed correctly when converted into 
a pathname object.

Index: swank-allegro.lisp
RCS file: /project/slime/cvsroot/slime/swank-allegro.lisp,v
retrieving revision 1.85
diff -c -r1.85 swank-allegro.lisp
*** swank-allegro.lisp	22 Mar 2006 16:40:01 -0000	1.85
--- swank-allegro.lisp	24 Mar 2006 06:45:05 -0000
*** 86,94 ****

   (defimplementation set-default-directory (directory)
!   (let ((dir (namestring (setf *default-pathname-defaults*
!                                (truename (merge-pathnames directory))))))
!     (excl:chdir dir)

   (defimplementation default-directory ()
--- 86,93 ----

   (defimplementation set-default-directory (directory)
!   (let* ((dir (namestring (truename (merge-pathnames directory)))))
!     (setf *default-pathname-defaults* (pathname (excl:chdir dir)))

   (defimplementation default-directory ()

-Mikel Bancroft

More information about the slime-devel mailing list