emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109588: * lisp/vc/vc-dir.el (vc-dir-


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109588: * lisp/vc/vc-dir.el (vc-dir-hide-state): New command.
Date: Mon, 13 Aug 2012 17:31:56 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109588
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12159
author: Jambunathan K <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-08-13 17:31:56 -0400
message:
  * lisp/vc/vc-dir.el (vc-dir-hide-state): New command.
  (vc-dir-hide-up-to-date): Route it to `vc-dir-hide-state'.
modified:
  lisp/ChangeLog
  lisp/vc/vc-dir.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-08-13 21:23:09 +0000
+++ b/lisp/ChangeLog    2012-08-13 21:31:56 +0000
@@ -1,3 +1,8 @@
+2012-08-13  Jambunathan K  <address@hidden>
+
+       * vc/vc-dir.el (vc-dir-hide-state): New command (bug#12159).
+       (vc-dir-hide-up-to-date): Route it to `vc-dir-hide-state'.
+
 2012-08-13  Stefan Monnier  <address@hidden>
 
        * subr.el (function-get): Refine `autoload' arg so it can also

=== modified file 'lisp/vc/vc-dir.el'
--- a/lisp/vc/vc-dir.el 2012-07-11 23:13:41 +0000
+++ b/lisp/vc/vc-dir.el 2012-08-13 21:31:56 +0000
@@ -1106,9 +1106,22 @@
   (interactive "fShow file: ")
   (vc-dir-update (list (list (file-relative-name file) (vc-state file))) 
(current-buffer)))
 
-(defun vc-dir-hide-up-to-date ()
-  "Hide up-to-date items from display."
-  (interactive)
+(defun vc-dir-hide-state (&optional state)
+  "Hide items that are in STATE from display.
+See `vc-state' for valid values of STATE.
+
+If STATE is nil, default it to up-to-date.
+
+Interactively, if `current-prefix-arg' is non-nil, set STATE to
+state of item at point.  Otherwise, set STATE to up-to-date."
+  (interactive (list
+               (and current-prefix-arg
+                    ;; Command is prefixed.  Infer STATE from point.
+                    (let ((node (ewoc-locate vc-ewoc)))
+                      (and node (vc-dir-fileinfo->state (ewoc-data node)))))))
+  ;; If STATE is un-specified, use up-to-date.
+  (setq state (or state 'up-to-date))
+  (message "Hiding items in state \"%s\"" state)
   (let ((crt (ewoc-nth vc-ewoc -1))
        (first (ewoc-nth vc-ewoc 0)))
     ;; Go over from the last item to the first and remove the
@@ -1120,18 +1133,21 @@
             (prev (ewoc-prev vc-ewoc crt))
             ;; ewoc-delete does not work without this...
             (inhibit-read-only t))
-         (when (or
-                ;; Remove directories with no child files.
-                (and dir
-                     (or
-                      ;; Nothing follows this directory.
-                      (not next)
-                      ;; Next item is a directory.
-                      (vc-dir-fileinfo->directory (ewoc-data next))))
-                ;; Remove files in the up-to-date state.
-                (eq (vc-dir-fileinfo->state data) 'up-to-date))
-           (ewoc-delete vc-ewoc crt))
-         (setq crt prev)))))
+       (when (or
+              ;; Remove directories with no child files.
+              (and dir
+                   (or
+                    ;; Nothing follows this directory.
+                    (not next)
+                    ;; Next item is a directory.
+                    (vc-dir-fileinfo->directory (ewoc-data next))))
+              ;; Remove files in specified STATE.  STATE can be a
+              ;; symbol or a user-name.
+              (equal (vc-dir-fileinfo->state data) state))
+         (ewoc-delete vc-ewoc crt))
+       (setq crt prev)))))
+
+(defalias 'vc-dir-hide-up-to-date 'vc-dir-hide-state)
 
 (defun vc-dir-kill-line ()
   "Remove the current line from display."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]