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

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

[elpa] externals/vc-got dcb5b83 083/145: extract the filtering to its ow


From: ELPA Syncer
Subject: [elpa] externals/vc-got dcb5b83 083/145: extract the filtering to its own function
Date: Thu, 9 Sep 2021 15:58:38 -0400 (EDT)

branch: externals/vc-got
commit dcb5b83a7470b57af0f2d26f6fbe6810308b13aa
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>

    extract the filtering to its own function
    
    I got tired of `n` a millions of time when debugging
    vc-got-dir-status-files, so I extracted it to its own function.
    (yeah, I could have used a conditional breakpoint, but I feel this is
    more readable)
---
 vc-got.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/vc-got.el b/vc-got.el
index f4c2417..3dec6b9 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -407,15 +407,19 @@ files on disk."
               'up-to-date
             (vc-got--parse-status-char (char-after))))))))
 
+(defun vc-got--dir-filter-files (files)
+  "Remove ., .. and .got from FILES."
+  (cl-loop for file in files
+           unless (or (string= file "..")
+                      (string= file ".")
+                      (string= file ".got"))
+           collect file))
+
 (defun vc-got-dir-status-files (dir files update-function)
   "Build the status for FILES in DIR.
 The builded result is given to the callback UPDATE-FUNCTION.  If
 FILES is nil, consider all the files in DIR."
-  (let* ((fs (seq-filter (lambda (file)
-                           (and (not (string= file ".."))
-                                (not (string= file "."))
-                                (not (string= file ".got"))))
-                         (or files (directory-files dir))))
+  (let* ((fs (vc-got--dir-filter-files (or files (directory-files dir))))
          (res (vc-got--status nil dir files)))
     (cl-loop for file in fs
              do (when (and (not (cdr (assoc file res #'string=)))



reply via email to

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