stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] [PATCH] Don't dereference symlinks in program completion list.


From: Ben Spencer
Subject: [STUMP] [PATCH] Don't dereference symlinks in program completion list.
Date: Tue, 16 Jun 2009 23:39:06 +0100
User-agent: Mutt/1.5.19 (2009-01-05)

The directory function dereferences symlinks in its results, so if you
have /usr/bin/firefox -> ../lib/iceweasel/iceweasel (as debian does),
you won't be able to complete on firefox.  This patch fixes that.
I've included support for as many lisp implementations as I could, but
I've only tested this end-to-end on sbcl, clisp and ccl.

---
 user.lisp     |    4 ++--
 wrappers.lisp |   10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/user.lisp b/user.lisp
index 07cc218..b6f3165 100644
--- a/user.lisp
+++ b/user.lisp
@@ -120,8 +120,8 @@ each directory seperated by a colon."
                        ;; SBCL doesn't match files with types if type
                        ;; is not wild and CLISP won't match files
                        ;; without a type when type is wild. So cover all the 
bases
-                       (directory (merge-pathnames (make-pathname :name :wild) 
dir))
-                       (directory (merge-pathnames (make-pathname :name :wild 
:type :wild) dir))
+                       (directory-no-deref (merge-pathnames (make-pathname 
:name :wild) dir))
+                       (directory-no-deref (merge-pathnames (make-pathname 
:name :wild :type :wild) dir))
                        :test 'equal)
           for namestring = (file-namestring file)
            when (pathname-is-executable-p file)
diff --git a/wrappers.lisp b/wrappers.lisp
index 24485d7..edeb7c0 100644
--- a/wrappers.lisp
+++ b/wrappers.lisp
@@ -252,6 +252,16 @@ they should be windows. So use this function to make a 
window out of them."
   #+(or clisp sbcl) (invoke-restart :one)
   #-(or clisp sbcl) (error 'not-implemented))
 
+(defun directory-no-deref (pathspec)
+  "Call directory without dereferencing symlinks in the results"
+  #+(or cmu scl) (directory pathspec :truenamep nil)
+  #+clisp (mapcar #'car (directory pathspec :full t))
+  #+lispworks (directory pathspec :link-transparency nil)
+  #+openmcl (directory pathspec :follow-links nil)
+  #+sbcl (directory pathspec :resolve-symlinks nil)
+  #-(or clisp cmu lispworks openmcl sbcl scl) (directory pathspec)
+  )
+
 ;;; CLISP does not include features to distinguish different Unix
 ;;; flavours (at least until version 2.46). Until this is fixed, use a
 ;;; hack to determine them.
-- 
1.6.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]