emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 6c669ff 014/348: File sorting function using a priority or


From: Oleh Krehel
Subject: [elpa] master 6c669ff 014/348: File sorting function using a priority order for extensions
Date: Sat, 8 Apr 2017 11:03:15 -0400 (EDT)

branch: master
commit 6c669ffe5e77926669e290e639e95fa3287904b5
Author: ThibautVerron <address@hidden>
Commit: ThibautVerron <address@hidden>

    File sorting function using a priority order for extensions
    
    This is just the sorting function, as suggested in issue 
https://github.com/abo-abo/swiper/issues/453.
    
    I'm not sure of how this option is best presented to the user.
    Also, in the long term, it would probably be a good idea to create a 
"purely ivy" variable replacing `ido-file-extensions-order`, in which case the 
new function could completely replace the default function.
---
 ivy.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ivy.el b/ivy.el
index 857f738..3e32376 100644
--- a/ivy.el
+++ b/ivy.el
@@ -39,6 +39,7 @@
 ;;; Code:
 (require 'cl-lib)
 (require 'ffap)
+(require 'ido nil t)
 
 ;;* Customization
 (defgroup ivy nil
@@ -1138,6 +1139,16 @@ Prioritize directories."
     (if (get-text-property 0 'dirp y)
         nil
       (string< x y))))
+      
+(defun ivy-sort-file-function-using-ido (x y)
+  "Compare two files X and Y using `ido-file-extensions-order'
+  
+  This function is suitable as a replacement for 
`ivy-sort-file-function-default' 
+  in `ivy-sort-functions-alist'."
+  (if (and (boundp 'ido-file-extensions-order)
+           ido-file-extensions-order)
+      (ido-file-extension-lessp x y)
+    (ivy-sort-file-function-default x y)))
 
 (defcustom ivy-sort-functions-alist
   '((read-file-name-internal . ivy-sort-file-function-default)



reply via email to

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