]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-hooks.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / vc / vc-hooks.el
index b3644cc1ac5e9ae9eb51e8bc22ea2179a5b8331f..4047bca046ad52443bd429c16ec631ffd0997fa2 100644 (file)
@@ -206,17 +206,17 @@ VC commands are globally reachable under the prefix `\\[vc-prefix-map]':
           (not (memq property vc-touched-properties)))
       (setq vc-touched-properties (append (list property)
                                          vc-touched-properties)))
-  (put (intern file vc-file-prop-obarray) property value))
+  (put (intern (expand-file-name file) vc-file-prop-obarray) property value))
 
 (defun vc-file-getprop (file property)
   "Get per-file VC PROPERTY for FILE."
-  (get (intern file vc-file-prop-obarray) property))
+  (get (intern (expand-file-name file) vc-file-prop-obarray) property))
 
 (defun vc-file-clearprops (file)
   "Clear all VC properties of FILE."
   (if (boundp 'vc-parent-buffer)
       (kill-local-variable 'vc-parent-buffer))
-  (setplist (intern file vc-file-prop-obarray) nil))
+  (setplist (intern (expand-file-name file) vc-file-prop-obarray) nil))
 
 \f
 ;; We keep properties on each symbol naming a backend as follows:
@@ -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-backend file)))
+       (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-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
@@ -807,15 +810,15 @@ In the latter case, VC mode is deactivated for this buffer."
     (add-hook 'vc-mode-line-hook 'vc-mode-line nil t)
     (let (backend)
       (cond
-       ((setq backend (with-demoted-errors (vc-backend buffer-file-name)))
+        ((setq backend (with-demoted-errors (vc-backend buffer-file-name)))
+         ;; Let the backend setup any buffer-local things he needs.
+         (vc-call-backend backend 'find-file-hook)
        ;; Compute the state and put it in the mode line.
        (vc-mode-line buffer-file-name backend)
        (unless vc-make-backup-files
          ;; Use this variable, not make-backup-files,
          ;; because this is for things that depend on the file name.
-         (set (make-local-variable 'backup-inhibited) t))
-       ;; Let the backend setup any buffer-local things he needs.
-       (vc-call-backend backend 'find-file-hook))
+          (set (make-local-variable 'backup-inhibited) t)))
        ((let* ((truename (and buffer-file-truename
                              (expand-file-name buffer-file-truename)))
               (link-type (and truename