]> code.delx.au - gnu-emacs-elpa/commitdiff
counsel.el (counsel-prompt-function-dir): Make portable
authorjustbur <justin@burkett.cc>
Thu, 10 Mar 2016 18:18:20 +0000 (13:18 -0500)
committerjustbur <justin@burkett.cc>
Thu, 10 Mar 2016 18:29:17 +0000 (13:29 -0500)
Use the built-in eshell-split-path to split the directory path into
components instead of split-string which is not likely to work on all
systems.

counsel.el

index 62d6c1a4e88b9063529debc2556e9190317361de..49b0440e809d305ed09c2c73ea2891eb84aa0723 100644 (file)
@@ -33,6 +33,7 @@
 
 (require 'swiper)
 (require 'etags)
+(require 'esh-util)
 
 ;;* Utility
 (defun counsel-more-chars (n)
@@ -179,13 +180,11 @@ Update the minibuffer with the amount of lines collected every
   "Return PROMPT appended with the parent directory."
   (let ((directory counsel--git-grep-dir))
     (format " [%s]: "
-            (let ((dir-list (split-string directory "/")))
+            (let ((dir-list (eshell-split-path directory)))
               (if (> (length dir-list) 3)
-                  (mapconcat
-                   #'identity
-                   (append '("..")
-                           (cl-subseq dir-list (- (length dir-list) 3)))
-                   "/")
+                 (apply #'concat
+                        (append '("...")
+                                (cl-subseq dir-list (- (length dir-list) 3))))
                 directory)))))
 
 (defun counsel-delete-process ()