[Top][All Lists]

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

[elpa] master bc2dcbe 279/399: counsel.el (counsel--find-build-subdir):

From: Oleh Krehel
Subject: [elpa] master bc2dcbe 279/399: counsel.el (counsel--find-build-subdir): Simplify
Date: Sat, 20 Jul 2019 14:57:40 -0400 (EDT)

branch: master
commit bc2dcbeae439a20ebaf6b270327999d258e16208
Author: Basil L. Contovounesios <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>

    counsel.el (counsel--find-build-subdir): Simplify
    Re: #2077
 counsel.el | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/counsel.el b/counsel.el
index df676da..86e5264 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5423,22 +5423,17 @@ subdirectories that builds may be invoked in."
 (defun counsel--get-build-subdirs (blddir)
   "Return all subdirs under BLDDIR sorted by modification time.
-If there are non-directory files in BLDDIR we also return BLDDIR in
-  the list as it may also be a build directory."
+If there are non-directory files in BLDDIR, include BLDDIR in the
+list as it may also be a build directory."
   (let* ((files (directory-files-and-attributes
                  blddir t directory-files-no-dot-files-regexp t))
-         (filtered-files (cl-remove-if
-                          (lambda (f) (not (nth 1 f)))
-                          files)))
-    ;; any non-dir files?
-    (when (< (length filtered-files)
+         (dirs (cl-remove-if-not #'cl-second files)))
+    ;; Any non-dir files?
+    (when (< (length dirs)
              (length files))
-      (push (cons blddir (file-attributes blddir))
-            filtered-files))
-    (mapcar #'car
-            (sort filtered-files
-                  (lambda (x y)
-                    (time-less-p (nth 6 y) (nth 6 x)))))))
+      (push (cons blddir (file-attributes blddir)) dirs))
+    (mapcar #'car (sort dirs (lambda (x y)
+                               (time-less-p (nth 6 y) (nth 6 x)))))))
 (defun counsel-compile-get-build-directories (&optional dir)
   "Return a list of potential build directories."

reply via email to

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