emacs-devel
[Top][All Lists]
Advanced

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

Re: vc-state and unregistered


From: Dmitry Gutov
Subject: Re: vc-state and unregistered
Date: Sun, 24 Apr 2016 20:35:47 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

On 04/24/2016 04:07 PM, Michael Albinus wrote:

Pls show me the bugs, I might have introduced.

As far as bugs go, here's one: you never return nil from vc-state anymore. Try evaluating:

(progn
  (vc-file-clearprops buffer-file-name)
  (vc-state buffer-file-name 'CVS))

And if the goal is to always return non-nil (which would be a change to the documented behavior), there is an easier way to do that than checking (vc-registered file), like:

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 0535565..5c31d20 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -475,11 +475,11 @@ vc-state
   ;; 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)))
+       (setq backend (or backend (vc-backend file)))
        (when backend
-         (vc-state-refresh file backend)))))
+         (vc-state-refresh file backend)))
+      'unregistered))

 (defun vc-state-refresh (file backend)
   "Quickly recompute the `state' of FILE."




reply via email to

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