Mercurial > emacs
comparison lisp/vc.el @ 87436:a5a588610e41
* vc.el (vc-dired-hook): Show unregistered file status as "?" in
non-terse mode.
(vc-dired-ignorable-p): Ignore Makefile when it has a peer named
Makefile.in or Makefile.am
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Thu, 27 Dec 2007 16:17:17 +0000 |
parents | 13951469ac3a |
children | 168445c0b213 |
comparison
equal
deleted
inserted
replaced
87435:13951469ac3a | 87436:a5a588610e41 |
---|---|
2328 t t nil 1))) | 2328 t t nil 1))) |
2329 | 2329 |
2330 (defun vc-dired-ignorable-p (filename) | 2330 (defun vc-dired-ignorable-p (filename) |
2331 "Should FILENAME be ignored in VC-Dired listings?" | 2331 "Should FILENAME be ignored in VC-Dired listings?" |
2332 (catch t | 2332 (catch t |
2333 ;; Ignore anything that wouldn't be found by completion (.o, .la, etc.) | |
2333 (dolist (ignorable completion-ignored-extensions) | 2334 (dolist (ignorable completion-ignored-extensions) |
2334 (let ((ext (substring filename | 2335 (let ((ext (substring filename |
2335 (- (length filename) | 2336 (- (length filename) |
2336 (length ignorable))))) | 2337 (length ignorable))))) |
2337 (if (string= ignorable ext) (throw t t)))) | 2338 (if (string= ignorable ext) (throw t t)))) |
2339 ;; Ignore Makefiles derived from something else | |
2340 (when (string= (file-name-nondirectory filename) "Makefile") | |
2341 (let* ((dir (file-name-directory filename)) | |
2342 (peers (directory-files (or dir default-directory)))) | |
2343 (if (or (member "Makefile.in" peers) (member "Makefile.am" peers)) | |
2344 (throw t t)))) | |
2338 nil)) | 2345 nil)) |
2339 | 2346 |
2340 (defun vc-dired-hook () | 2347 (defun vc-dired-hook () |
2341 "Reformat the listing according to version control. | 2348 "Reformat the listing according to version control. |
2342 Called by dired after any portion of a vc-dired buffer has been read in." | 2349 Called by dired after any portion of a vc-dired buffer has been read in." |
2388 (dired-kill-line)) | 2395 (dired-kill-line)) |
2389 ;; ordinary file -- call the (possibly expensive) state query | 2396 ;; ordinary file -- call the (possibly expensive) state query |
2390 (t | 2397 (t |
2391 (let ((backend (vc-backend filename))) | 2398 (let ((backend (vc-backend filename))) |
2392 (cond | 2399 (cond |
2393 ((and backend | 2400 ;; Not registered |
2394 (not (and vc-dired-terse-mode | 2401 ((not backend) |
2395 (vc-up-to-date-p filename)))) | 2402 (if vc-dired-terse-mode |
2403 (dired-kill-line) | |
2404 (vc-dired-reformat-line "?") | |
2405 (forward-line 1))) | |
2406 ;; Either we're in non-terse mode or it's out of date | |
2407 ((not (and vc-dired-terse-mode (vc-up-to-date-p filename))) | |
2396 (vc-dired-reformat-line (vc-call dired-state-info filename)) | 2408 (vc-dired-reformat-line (vc-call dired-state-info filename)) |
2397 (forward-line 1)) | 2409 (forward-line 1)) |
2398 (t | 2410 ;; Remaining cases are under version control but uninteresting |
2411 (t | |
2399 (dired-kill-line))))))) | 2412 (dired-kill-line))))))) |
2400 ;; any other line | 2413 ;; any other line |
2401 (t (forward-line 1)))) | 2414 (t (forward-line 1)))) |
2402 (vc-dired-purge)) | 2415 (vc-dired-purge)) |
2403 (message "Getting version information... done") | 2416 (message "Getting version information... done") |
2404 (save-restriction | 2417 (save-restriction |
2405 (widen) | 2418 (widen) |
2406 (cond ((eq (count-lines (point-min) (point-max)) 1) | 2419 (cond ((eq (count-lines (point-min) (point-max)) 1) |
2407 (goto-char (point-min)) | 2420 (goto-char (point-min)) |
2408 (message "No files locked under %s" default-directory))))) | 2421 (message "No changes pending under %s" default-directory))))) |
2409 | 2422 |
2410 (defun vc-dired-purge () | 2423 (defun vc-dired-purge () |
2411 "Remove empty subdirs." | 2424 "Remove empty subdirs." |
2412 (goto-char (point-min)) | 2425 (goto-char (point-min)) |
2413 (while (dired-get-subdir) | 2426 (while (dired-get-subdir) |