]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/cedet-files.el
Dired recognize dirs when file size in human units
[gnu-emacs] / lisp / cedet / cedet-files.el
index bb7137ddad2219070d47abd856c98f80e6ae2153..875c67726c2d2420b6df631fe32030061155572e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cedet-files.el --- Common routines dealing with file names.
 
-;; Copyright (C) 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 ;; Package: cedet
@@ -83,12 +83,29 @@ specific conversions during tests."
          (setq file (concat driveletter ":"
                             (substring file (match-end 1))))))
 
-      ;; Handle the \\file\name nomenclature on some windows boxes.
+      ;; Handle the \\file\name nomenclature on some Windows boxes.
       (when (string-match "^!" file)
        (setq file (concat "//" (substring file 1)))))
     file))
 
+(defun cedet-files-list-recursively (dir re)
+  "Returns list of files in directory matching to given regex"
+  (when (file-accessible-directory-p dir)
+    (let ((files (directory-files dir t))
+          matched)
+      (dolist (file files matched)
+        (let ((fname (file-name-nondirectory file)))
+          (cond
+           ((or (string= fname ".")
+                (string= fname "..")) nil)
+           ((and (file-regular-p file)
+                 (string-match re fname))
+            (setq matched (cons file matched)))
+           ((file-directory-p file)
+            (let ((tfiles (cedet-files-list-recursively file re)))
+              (when tfiles (setq matched (append matched tfiles)))))))))))
+
+
 (provide 'cedet-files)
 
-;; arch-tag: 4884c616-82c3-475d-ac9f-039e3431a702
 ;;; cedet-files.el ends here