|
37 | 37 |
|
38 | 38 | (defun dired-omit-regexp () |
39 | 39 | (let ((file (expand-file-name ".git")) |
40 | | - parent-dir) |
41 | | - (while (and (not (file-exists-p file)) |
42 | | - (progn |
43 | | - (setq parent-dir |
44 | | - (file-name-directory |
45 | | - (directory-file-name |
46 | | - (file-name-directory file)))) |
47 | | - ;; Give up if we are already at the root dir. |
48 | | - (not (string= (file-name-directory file) |
49 | | - parent-dir)))) |
50 | | - ;; Move up to the parent dir and try again. |
51 | | - (setq file (expand-file-name ".git" parent-dir))) |
52 | | - ;; If we found a change log in a parent, use that. |
53 | | - (if (file-exists-p file) |
54 | | - (let ((regexp (funcall dired-omit-regexp-orig)) |
55 | | - (omitted-files (shell-command-to-string |
56 | | - "git clean -d -x -n"))) |
57 | | - (if (= 0 (length omitted-files)) |
58 | | - regexp |
59 | | - (concat |
60 | | - regexp |
61 | | - (if (> (length regexp) 0) |
62 | | - "\\|" "") |
63 | | - "\\(" |
64 | | - (mapconcat |
65 | | - #'(lambda (str) |
66 | | - (concat "^" |
67 | | - (regexp-quote |
68 | | - (substring str 13 |
69 | | - (if (= ?/ (aref str (1- (length str)))) |
70 | | - (1- (length str)) |
71 | | - nil))) |
72 | | - "$")) |
73 | | - (split-string omitted-files "\n" t) |
74 | | - "\\|") |
75 | | - "\\)"))) |
76 | | - (funcall dired-omit-regexp-orig)))) |
77 | | - |
78 | | - (defun dired-delete-file (file &optional recursive) |
79 | | - (if recursive |
80 | | - (call-process "/Users/johnw/bin/del" nil nil nil "-fr" file) |
81 | | - (call-process "/Users/johnw/bin/del" nil nil nil file))))) |
| 40 | + parent-dir) |
| 41 | + (while (and (not (file-exists-p file)) |
| 42 | + (progn |
| 43 | + (setq parent-dir |
| 44 | + (file-name-directory |
| 45 | + (directory-file-name |
| 46 | + (file-name-directory file)))) |
| 47 | + ;; Give up if we are already at the root dir. |
| 48 | + (not (string= (file-name-directory file) |
| 49 | + parent-dir)))) |
| 50 | + ;; Move up to the parent dir and try again. |
| 51 | + (setq file (expand-file-name ".git" parent-dir))) |
| 52 | + ;; If we found a change log in a parent, use that. |
| 53 | + (if (file-exists-p file) |
| 54 | + (let ((regexp (funcall dired-omit-regexp-orig)) |
| 55 | + (omitted-files (shell-command-to-string |
| 56 | + "git clean -d -x -n"))) |
| 57 | + (if (= 0 (length omitted-files)) |
| 58 | + regexp |
| 59 | + (concat |
| 60 | + regexp |
| 61 | + (if (> (length regexp) 0) |
| 62 | + "\\|" "") |
| 63 | + "\\(" |
| 64 | + (mapconcat |
| 65 | + #'(lambda (str) |
| 66 | + (concat "^" |
| 67 | + (regexp-quote |
| 68 | + (substring str 13 |
| 69 | + (if (= ?/ (aref str (1- (length str)))) |
| 70 | + (1- (length str)) |
| 71 | + nil))) |
| 72 | + "$")) |
| 73 | + (split-string omitted-files "\n" t) |
| 74 | + "\\|") |
| 75 | + "\\)"))) |
| 76 | + (funcall dired-omit-regexp-orig)))))) |
82 | 77 |
|
83 | 78 | (provide 'git-dired) |
84 | 79 |
|
|
0 commit comments