branch: externals/vc-got commit dcb5b83a7470b57af0f2d26f6fbe6810308b13aa Author: Omar Polo <o...@omarpolo.com> Commit: Omar Polo <o...@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=)))