diff options
| author | Jambunathan K | 2012-08-13 17:31:56 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-08-13 17:31:56 -0400 |
| commit | 92cb3b044b0654babb07a8491242c1719f48100b (patch) | |
| tree | c8217b447dec35f64d84df5dab3f00533cda7e74 | |
| parent | 3c98c9629581c4bfcaaa5e3bb21ec543286751a7 (diff) | |
| download | emacs-92cb3b044b0654babb07a8491242c1719f48100b.tar.gz emacs-92cb3b044b0654babb07a8491242c1719f48100b.zip | |
* lisp/vc/vc-dir.el (vc-dir-hide-state): New command.
(vc-dir-hide-up-to-date): Route it to `vc-dir-hide-state'.
Fixes: debbugs:12159
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc/vc-dir.el | 46 |
2 files changed, 36 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6ccbb69a919..a55a3fc1d82 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-13 Jambunathan K <kjambunathan@gmail.com> | ||
| 2 | |||
| 3 | * vc/vc-dir.el (vc-dir-hide-state): New command (bug#12159). | ||
| 4 | (vc-dir-hide-up-to-date): Route it to `vc-dir-hide-state'. | ||
| 5 | |||
| 1 | 2012-08-13 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2012-08-13 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * subr.el (function-get): Refine `autoload' arg so it can also | 8 | * subr.el (function-get): Refine `autoload' arg so it can also |
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 7c840fd071b..455f48c50d3 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el | |||
| @@ -1106,9 +1106,22 @@ outside of VC) and one wants to do some operation on it." | |||
| 1106 | (interactive "fShow file: ") | 1106 | (interactive "fShow file: ") |
| 1107 | (vc-dir-update (list (list (file-relative-name file) (vc-state file))) (current-buffer))) | 1107 | (vc-dir-update (list (list (file-relative-name file) (vc-state file))) (current-buffer))) |
| 1108 | 1108 | ||
| 1109 | (defun vc-dir-hide-up-to-date () | 1109 | (defun vc-dir-hide-state (&optional state) |
| 1110 | "Hide up-to-date items from display." | 1110 | "Hide items that are in STATE from display. |
| 1111 | (interactive) | 1111 | See `vc-state' for valid values of STATE. |
| 1112 | |||
| 1113 | If STATE is nil, default it to up-to-date. | ||
| 1114 | |||
| 1115 | Interactively, if `current-prefix-arg' is non-nil, set STATE to | ||
| 1116 | state of item at point. Otherwise, set STATE to up-to-date." | ||
| 1117 | (interactive (list | ||
| 1118 | (and current-prefix-arg | ||
| 1119 | ;; Command is prefixed. Infer STATE from point. | ||
| 1120 | (let ((node (ewoc-locate vc-ewoc))) | ||
| 1121 | (and node (vc-dir-fileinfo->state (ewoc-data node))))))) | ||
| 1122 | ;; If STATE is un-specified, use up-to-date. | ||
| 1123 | (setq state (or state 'up-to-date)) | ||
| 1124 | (message "Hiding items in state \"%s\"" state) | ||
| 1112 | (let ((crt (ewoc-nth vc-ewoc -1)) | 1125 | (let ((crt (ewoc-nth vc-ewoc -1)) |
| 1113 | (first (ewoc-nth vc-ewoc 0))) | 1126 | (first (ewoc-nth vc-ewoc 0))) |
| 1114 | ;; Go over from the last item to the first and remove the | 1127 | ;; Go over from the last item to the first and remove the |
| @@ -1120,18 +1133,21 @@ outside of VC) and one wants to do some operation on it." | |||
| 1120 | (prev (ewoc-prev vc-ewoc crt)) | 1133 | (prev (ewoc-prev vc-ewoc crt)) |
| 1121 | ;; ewoc-delete does not work without this... | 1134 | ;; ewoc-delete does not work without this... |
| 1122 | (inhibit-read-only t)) | 1135 | (inhibit-read-only t)) |
| 1123 | (when (or | 1136 | (when (or |
| 1124 | ;; Remove directories with no child files. | 1137 | ;; Remove directories with no child files. |
| 1125 | (and dir | 1138 | (and dir |
| 1126 | (or | 1139 | (or |
| 1127 | ;; Nothing follows this directory. | 1140 | ;; Nothing follows this directory. |
| 1128 | (not next) | 1141 | (not next) |
| 1129 | ;; Next item is a directory. | 1142 | ;; Next item is a directory. |
| 1130 | (vc-dir-fileinfo->directory (ewoc-data next)))) | 1143 | (vc-dir-fileinfo->directory (ewoc-data next)))) |
| 1131 | ;; Remove files in the up-to-date state. | 1144 | ;; Remove files in specified STATE. STATE can be a |
| 1132 | (eq (vc-dir-fileinfo->state data) 'up-to-date)) | 1145 | ;; symbol or a user-name. |
| 1133 | (ewoc-delete vc-ewoc crt)) | 1146 | (equal (vc-dir-fileinfo->state data) state)) |
| 1134 | (setq crt prev))))) | 1147 | (ewoc-delete vc-ewoc crt)) |
| 1148 | (setq crt prev))))) | ||
| 1149 | |||
| 1150 | (defalias 'vc-dir-hide-up-to-date 'vc-dir-hide-state) | ||
| 1135 | 1151 | ||
| 1136 | (defun vc-dir-kill-line () | 1152 | (defun vc-dir-kill-line () |
| 1137 | "Remove the current line from display." | 1153 | "Remove the current line from display." |