]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-hooks.el
Some improvements in vc
[gnu-emacs] / lisp / vc / vc-hooks.el
index 97ccec84550f95b102fb153a41227bd45a9a8cc5..0535565db2884f9a8c4e0c32ea49ce243f84b75e 100644 (file)
@@ -40,7 +40,7 @@
   :group 'mode-line
   :version "25.1")
 
-(defface vc-state-base-face
+(defface vc-state-base
   '((default))
   "Base face for VC state indicator."
   :group 'vc-faces
   :version "25.1")
 
 (defface vc-up-to-date-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is up to date."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-needs-update-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file needs update."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-locked-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file locked."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-locally-added-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is locally added."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-conflict-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file contains merge conflicts."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-removed-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file was removed from the VC system."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-missing-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is missing from the file system."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-edited-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is edited."
   :version "25.1"
   :group 'vc-faces)
@@ -475,10 +475,11 @@ status of this file.  Otherwise, the value returned is one of:
   ;; FIXME: New (sub)states needed (?):
   ;; - `copied' and `moved' (might be handled by `removed' and `added')
   (or (vc-file-getprop file 'vc-state)
+      (and (not (vc-registered file)) 'unregistered)
       (when (> (length file) 0)         ;Why??  --Stef
        (setq backend (or backend (vc-responsible-backend file)))
        (when backend
-          (vc-state-refresh file backend)))))
+         (vc-state-refresh file backend)))))
 
 (defun vc-state-refresh (file backend)
   "Quickly recompute the `state' of FILE."
@@ -494,11 +495,13 @@ status of this file.  Otherwise, the value returned is one of:
   "Return the repository version from which FILE was checked out.
 If FILE is not registered, this function always returns nil."
   (or (vc-file-getprop file 'vc-working-revision)
-      (progn
-       (setq backend (or backend (vc-responsible-backend file)))
-       (when backend
-         (vc-file-setprop file 'vc-working-revision
-                          (vc-call-backend backend 'working-revision file))))))
+      (and (vc-registered file)
+          (progn
+            (setq backend (or backend (vc-responsible-backend file)))
+            (when backend
+              (vc-file-setprop file 'vc-working-revision
+                               (vc-call-backend
+                                 backend 'working-revision file)))))))
 
 ;; Backward compatibility.
 (define-obsolete-function-alias