diff options
| author | Dan Nicolaescu | 2008-06-28 07:30:47 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2008-06-28 07:30:47 +0000 |
| commit | f731e2f977dd330bd8ac8c25bfccef3ddb1e64fa (patch) | |
| tree | b5c38d9353f89462ba52d1f9d34e492afc06149a | |
| parent | dcaf1e4bfe54395bf9de94f3cc47b680f4cd0998 (diff) | |
| download | emacs-f731e2f977dd330bd8ac8c25bfccef3ddb1e64fa.tar.gz emacs-f731e2f977dd330bd8ac8c25bfccef3ddb1e64fa.zip | |
* vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
(vc-string-prefix-p): Move function ...
* vc.el (vc-string-prefix-p): ... here.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/vc-dir.el | 31 | ||||
| -rw-r--r-- | lisp/vc.el | 8 |
3 files changed, 34 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1df394338dc..7087c1a3606 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-06-28 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories. | ||
| 4 | (vc-string-prefix-p): Move function ... | ||
| 5 | * vc.el (vc-string-prefix-p): ... here. | ||
| 6 | |||
| 1 | 2008-06-27 Juanma Barranquero <lekktu@gmail.com> | 7 | 2008-06-27 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | * vc-dir.el (vc-dir): Complete only directory names. | 9 | * vc-dir.el (vc-dir): Complete only directory names. |
diff --git a/lisp/vc-dir.el b/lisp/vc-dir.el index 17f8b5d91cb..df7caca120c 100644 --- a/lisp/vc-dir.el +++ b/lisp/vc-dir.el | |||
| @@ -478,11 +478,6 @@ If a prefix argument is given, move by that many lines." | |||
| 478 | (funcall mark-unmark-function)))) | 478 | (funcall mark-unmark-function)))) |
| 479 | (funcall mark-unmark-function))) | 479 | (funcall mark-unmark-function))) |
| 480 | 480 | ||
| 481 | (defun vc-string-prefix-p (prefix string) | ||
| 482 | (let ((lpref (length prefix))) | ||
| 483 | (and (>= (length string) lpref) | ||
| 484 | (eq t (compare-strings prefix nil nil string nil lpref))))) | ||
| 485 | |||
| 486 | (defun vc-dir-parent-marked-p (arg) | 481 | (defun vc-dir-parent-marked-p (arg) |
| 487 | ;; Return nil if none of the parent directories of arg is marked. | 482 | ;; Return nil if none of the parent directories of arg is marked. |
| 488 | (let* ((argdir (vc-dir-node-directory arg)) | 483 | (let* ((argdir (vc-dir-node-directory arg)) |
| @@ -938,9 +933,29 @@ outside of VC) and one wants to do some operation on it." | |||
| 938 | (defun vc-dir-hide-up-to-date () | 933 | (defun vc-dir-hide-up-to-date () |
| 939 | "Hide up-to-date items from display." | 934 | "Hide up-to-date items from display." |
| 940 | (interactive) | 935 | (interactive) |
| 941 | (ewoc-filter | 936 | (let ((crt (ewoc-nth vc-ewoc -1)) |
| 942 | vc-ewoc | 937 | (first (ewoc-nth vc-ewoc 0))) |
| 943 | (lambda (crt) (not (eq (vc-dir-fileinfo->state crt) 'up-to-date))))) | 938 | ;; Go over from the last item to the first and remove the |
| 939 | ;; up-to-date files and directories with no child files. | ||
| 940 | (while (not (eq crt first)) | ||
| 941 | (let* ((data (ewoc-data crt)) | ||
| 942 | (dir (vc-dir-fileinfo->directory data)) | ||
| 943 | (next (ewoc-next vc-ewoc crt)) | ||
| 944 | (prev (ewoc-prev vc-ewoc crt)) | ||
| 945 | ;; ewoc-delete does not work without this... | ||
| 946 | (inhibit-read-only t)) | ||
| 947 | (when (or | ||
| 948 | ;; Remove directories with no child files. | ||
| 949 | (and dir | ||
| 950 | (or | ||
| 951 | ;; Nothing follows this directory. | ||
| 952 | (not next) | ||
| 953 | ;; Next item is a directory. | ||
| 954 | (vc-dir-fileinfo->directory (ewoc-data next)))) | ||
| 955 | ;; Remove files in the up-to-date state. | ||
| 956 | (eq (vc-dir-fileinfo->state data) 'up-to-date)) | ||
| 957 | (ewoc-delete vc-ewoc crt)) | ||
| 958 | (setq crt prev))))) | ||
| 944 | 959 | ||
| 945 | (defun vc-dir-status-printer (fileentry) | 960 | (defun vc-dir-status-printer (fileentry) |
| 946 | (vc-call-backend vc-dir-backend 'status-printer fileentry)) | 961 | (vc-call-backend vc-dir-backend 'status-printer fileentry)) |
diff --git a/lisp/vc.el b/lisp/vc.el index 6cc1dd9c680..c27688e669c 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -643,9 +643,6 @@ | |||
| 643 | ;; | 643 | ;; |
| 644 | ;; - vc-dir toolbar needs more icons. | 644 | ;; - vc-dir toolbar needs more icons. |
| 645 | ;; | 645 | ;; |
| 646 | ;; - vc-dir-hide-up-to-date needs to hide directories that do not have | ||
| 647 | ;; any children anymore. | ||
| 648 | ;; | ||
| 649 | ;;; Code: | 646 | ;;; Code: |
| 650 | 647 | ||
| 651 | (require 'vc-hooks) | 648 | (require 'vc-hooks) |
| @@ -2476,6 +2473,11 @@ to provide the `find-revision' operation instead." | |||
| 2476 | 2473 | ||
| 2477 | ;; These things should probably be generally available | 2474 | ;; These things should probably be generally available |
| 2478 | 2475 | ||
| 2476 | (defun vc-string-prefix-p (prefix string) | ||
| 2477 | (let ((lpref (length prefix))) | ||
| 2478 | (and (>= (length string) lpref) | ||
| 2479 | (eq t (compare-strings prefix nil nil string nil lpref))))) | ||
| 2480 | |||
| 2479 | (defun vc-file-tree-walk (dirname func &rest args) | 2481 | (defun vc-file-tree-walk (dirname func &rest args) |
| 2480 | "Walk recursively through DIRNAME. | 2482 | "Walk recursively through DIRNAME. |
| 2481 | Invoke FUNC f ARGS on each VC-managed file f underneath it." | 2483 | Invoke FUNC f ARGS on each VC-managed file f underneath it." |