emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/vc.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el,v
Date: Fri, 21 Mar 2008 06:02:52 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/03/21 06:02:52

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.551
retrieving revision 1.552
diff -u -b -r1.551 -r1.552
--- vc.el       20 Mar 2008 15:51:44 -0000      1.551
+++ vc.el       21 Mar 2008 06:02:50 -0000      1.552
@@ -553,8 +553,6 @@
 
 ;;; Todo:
 
-;; - vc-state needs a new state for `added'.
-;;
 ;; - vc-update/vc-merge should deal with VC systems that don't
 ;;   update/merge on a file basis, but on a whole repository basis.
 ;;
@@ -592,12 +590,6 @@
 ;;   them, or remove them from the VCS. C-x v v might also need
 ;;   adjustments.
 ;;
-;; - when changing a file whose directory is shown in the vc-status
-;;   buffer, it should be added there as "modified".  (PCL-CVS does this).
-;;
-;; - Update the vc-status buffers after vc operations, implement the
-;;   equivalent of vc-dired-resynch-file.
-;;
 ;; - vc-status needs a toolbar.
 ;;
 ;; - vc-status: refresh should not completely wipe out the current
@@ -1791,10 +1783,15 @@
   (if (string= buffer-file-name file)
       (vc-resynch-window file keep noquery)
     (let ((buffer (get-file-buffer file)))
-      (if buffer
+      (when buffer
          (with-current-buffer buffer
            (vc-resynch-window file keep noquery)))))
-  (vc-dired-resynch-file file))
+  (vc-dired-resynch-file file)
+  (when (memq 'vc-status-mark-buffer-changed after-save-hook)
+    (let ((buffer (get-file-buffer file)))
+      (with-current-buffer buffer
+       (when buffer (vc-status-mark-buffer-changed))))))
+
 
 (defun vc-start-entry (files rev comment initial-contents msg action &optional 
after-hook)
   "Accept a comment for an operation on FILES revision REV.
@@ -2665,20 +2662,23 @@
 (defun vc-status-printer (fileentry)
   "Pretty print FILEENTRY."
   ;; If you change the layout here, change vc-status-move-to-goal-column.
+  (let ((state (vc-status-fileinfo->state fileentry)))
   (insert
    (propertize
     (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? ))
     'face 'font-lock-type-face)
    "   "
    (propertize
-    (format "%-20s" (vc-status-fileinfo->state fileentry))
-    'face 'font-lock-variable-name-face
+      (format "%-20s" state)
+      'face (if (eq state 'up-to-date) 
+               'font-lock-builtin-face
+             'font-lock-variable-name-face)
     'mouse-face 'highlight)
    " "
    (propertize
     (format "%s" (vc-status-fileinfo->name fileentry))
     'face 'font-lock-function-name-face
-    'mouse-face 'highlight)))
+      'mouse-face 'highlight))))
 
 (defun vc-status-move-to-goal-column ()
   (beginning-of-line)
@@ -2702,7 +2702,9 @@
     (define-key map [refresh] 
       '(menu-item "Refresh" vc-status-refresh
                  :help "Refresh the contents of the VC status buffer"))
-
+    (define-key map [remup] 
+      '(menu-item "Remove up-to-date" vc-status-remove-up-to-date
+                 :help "Remove up-to-date items from display"))
     ;; VC commands.
     (define-key map [separator-vc-commands] '("--"))
     (define-key map [annotate] 
@@ -2786,6 +2788,7 @@
     ;; The remainder.
     (define-key map "f" 'vc-status-find-file)
     (define-key map "o" 'vc-status-find-file-other-window)
+    (define-key map "x" 'vc-status-remove-up-to-date)
     (define-key map "q" 'bury-buffer)
     (define-key map "g" 'vc-status-refresh)
     (define-key map "\C-c\C-c" 'vc-status-kill-dir-status-process)
@@ -3118,9 +3121,16 @@
     vc-status
     (lambda (crt) (vc-status-fileinfo->marked crt)))))
 
+(defun vc-status-remove-up-to-date ()
+  "Remove up-to-date items from display."
+  (interactive)
+  (ewoc-filter
+   vc-status
+   (lambda (crt) (not (eq (vc-status-fileinfo->state crt) 'up-to-date)))))
+
 (defun vc-status-mark-buffer-changed ()
   (let* ((file (expand-file-name buffer-file-name))
-        (version (and (vc-backend file) (vc-working-revision file)))
+        (state (and (vc-backend file) (vc-state file)))
         (found-vc-status-buf nil))
     (save-excursion
       (dolist (status-buf (buffer-list))
@@ -3128,21 +3138,11 @@
        ;; look for a vc-status buffer that might show this file.
        (when (eq major-mode 'vc-status-mode)
          (setq found-vc-status-buf t)
-         (let ((def-dir (expand-file-name default-directory)))
+         (let ((ddir (expand-file-name default-directory)))
            ;; This test is cvs-string-prefix-p
-           (when (eq t (compare-strings file nil (length def-dir) def-dir nil 
nil))
-             (let* ((file-short
-                     (substring file (length def-dir)))
-                    (entry
-                     (cons
-                      file-short
-                      (if version
-                          ;; This it not the correct test to check if
-                          ;; the files is "added" for all backends.
-                          ;; It does not work for git for example.
-                          ;; vc-state needs a new state: `added'.
-                          (if (string= "0" version) 'added 'modified)
-                        'unregistered))))
+           (when (eq t (compare-strings file nil (length ddir) ddir nil nil))
+             (let* ((file-short (substring file (length ddir)))
+                    (entry (cons file-short (if state state 'unregistered))))
                (vc-status-add-entry entry status-buf))))))
       ;; We didn't find any vc-status buffers, remove the hook, it is
       ;; not needed.




reply via email to

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