[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 32a8963 1/4: Allow to customize the dotted directories
From: |
Oleh Krehel |
Subject: |
[elpa] master 32a8963 1/4: Allow to customize the dotted directories |
Date: |
Sat, 18 Apr 2015 17:20:51 +0000 |
branch: master
commit 32a8963873016804c792a4f23fa6d83decac5803
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Allow to customize the dotted directories
* ivy.el (ivy-extra-directories): New defcustom.
(ivy--sorted-files): Update.
Re #38
---
ivy.el | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/ivy.el b/ivy.el
index ed96dc9..791b46b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -64,6 +64,11 @@ Set this to nil if you don't want the count."
This is usually meant as a quick exit out of the minibuffer."
:type 'function)
+(defcustom ivy-extra-directories '("../" "./")
+ "Add this to the front of the list when completing file names.
+Only \"./\" and \"../\" apply here. They appear in reverse order."
+ :type 'list)
+
;;* User Visible
;;** Keymap
(require 'delsel)
@@ -221,17 +226,19 @@ Directories come first."
(seq (all-completions "" 'read-file-name-internal)))
(if (equal dir "/")
seq
- (cons "./" (cons "../"
- (cl-sort
- (delete "./" (delete "../" seq))
- (lambda (x y)
- (if (file-directory-p x)
- (if (file-directory-p y)
- (string< x y)
- t)
- (if (file-directory-p y)
- nil
- (string< x y))))))))))
+ (setq seq (cl-sort
+ (delete "./" (delete "../" seq))
+ (lambda (x y)
+ (if (file-directory-p x)
+ (if (file-directory-p y)
+ (string< x y)
+ t)
+ (if (file-directory-p y)
+ nil
+ (string< x y))))))
+ (dolist (dir ivy-extra-directories)
+ (push dir seq))
+ seq)))
;;** Entry Point
(defun ivy-read (prompt collection