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

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

[elpa] master a6f3b89 05/22: diff-hl-dired: Highlight ignored files


From: Dmitry Gutov
Subject: [elpa] master a6f3b89 05/22: diff-hl-dired: Highlight ignored files
Date: Fri, 02 Jan 2015 23:46:27 +0000

branch: master
commit a6f3b89590c35795a2874fcc5e7f452cc23a11ed
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    diff-hl-dired: Highlight ignored files
    
    #25
---
 diff-hl-dired.el |   34 ++++++++++++++++++++++++++++++----
 diff-hl.el       |    1 +
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/diff-hl-dired.el b/diff-hl-dired.el
index 928bb9c..2bbf12b 100644
--- a/diff-hl-dired.el
+++ b/diff-hl-dired.el
@@ -49,6 +49,10 @@
   '((default :inherit diff-header))
   "Face used to highlight unregistered files.")
 
+(defface diff-hl-dired-ignored
+  '((default :inherit shadow))
+  "Face used to highlight unregistered files.")
+
 ;;;###autoload
 (define-minor-mode diff-hl-dired-mode
   "Toggle VC diff highlighting on the side of a Dired window."
@@ -79,7 +83,7 @@
         (erase-buffer)
         (vc-call-backend
          backend 'dir-status def-dir
-         (lambda (entries &optional _more-to-come)
+         (lambda (entries &optional more-to-come)
            (with-current-buffer buffer
              (dolist (entry entries)
                (cl-destructuring-bind (file state &rest) entry
@@ -95,12 +99,34 @@
                                (push (cons dir type) dirs-alist)
                              (setcdr (assoc dir dirs-alist) 'change))))
                      (push (cons file type) files-alist)))))
-             ;; Process's finished, time to use the results.
-             (unless (get-buffer-process diff-hl-dired-process-buffer)
+             (unless more-to-come
                (diff-hl-dired-highlight-items (append dirs-alist
-                                                      files-alist)))))
+                                                      files-alist))
+               (diff-hl-dired-update-ignores backend def-dir))))
          )))))
 
+(defun diff-hl-dired-update-ignores (backend def-dir)
+  (let ((buffer (current-buffer))
+        entries-alist)
+    (with-current-buffer diff-hl-dired-process-buffer
+      (erase-buffer)
+      (vc-call-backend
+       backend 'dir-status-files def-dir
+       (cl-loop for file in (directory-files def-dir)
+                unless (member file '("." ".."))
+                collect file)
+       nil
+       (lambda (entries &optional more-to-come)
+         (with-current-buffer buffer
+           (dolist (entry entries)
+             (cl-destructuring-bind (file state &rest) entry
+               (when (eq state 'ignored)
+                 (push (cons (directory-file-name file)
+                             'ignored) entries-alist))))
+           (unless more-to-come
+             (diff-hl-dired-highlight-items entries-alist))))
+       ))))
+
 (defun diff-hl-dired-highlight-items (alist)
   "Highlight ALIST containing (FILE . TYPE) elements."
   (dolist (pair alist)
diff --git a/diff-hl.el b/diff-hl.el
index 258e48a..2488f4d 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -184,6 +184,7 @@
   (cl-case type
     (unknown 'question-mark)
     (change 'exclamation-mark)
+    (ignored 'filled-square)
     (t (intern (format "diff-hl-bmp-%s" type)))))
 
 (defvar vc-svn-diff-switches)



reply via email to

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