[Top][All Lists]

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

several fixes to vc.el, vc-switches.el

From: Jonathan Kamens
Subject: several fixes to vc.el, vc-switches.el
Date: Wed, 9 Jan 2002 09:16:48 -0500

2002-01-09  Jonathan Kamens  <address@hidden>

        * vc-hooks.el (vc-mode-line): Set vc-mode to nil if the file is
        not version-controlled.  This is necessary, e.g., if the file has
        just been reverted, and thus was previously under version control
        but isn't any longer.

        * vc.el (vc-default-init-version): Update documentation to
        indicate that the backend can override the default init version.
        (vc-register): Use the backend init-version function, if it
        exists, to determine the initial version of a file.
        (vc-diff-switches-list): Don't symbol-quote backend, since it's
        already a symbol.  Don't fail if vc-BACKEND-diff-switches
        isn't bound.

Index: vc-hooks.el
RCS file: /cvsroot/emacs/emacs/lisp/vc-hooks.el,v
retrieving revision 1.137
diff -u -r1.137 vc-hooks.el
--- vc-hooks.el 14 Dec 2001 07:58:33 -0000      1.137
+++ vc-hooks.el 9 Jan 2002 14:12:01 -0000
@@ -544,7 +544,8 @@
 The value is set in the current buffer, which should be the buffer
 visiting FILE."
   (interactive (list buffer-file-name))
-  (unless (not (vc-backend file))
+  (if (not (vc-backend file))
+      (setq vc-mode nil)
     (setq vc-mode (concat " " (if vc-display-status
                                  (vc-call mode-line-string file)
                                (symbol-name (vc-backend file)))))
Index: vc.el
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.325
diff -u -r1.325 vc.el
--- vc.el       5 Jan 2002 17:15:20 -0000       1.325
+++ vc.el       9 Jan 2002 14:12:05 -0000
@@ -171,6 +171,12 @@
 ;;   The implementation should pass the value of vc-register-switches
 ;;   to the backend command.
+;; - init-version (file)
+;;   The initial version to use when registering FILE if one is not
+;;   specified by the user.  If not provided, the variable
+;;   vc-default-init-version is used instead.
 ;; - responsible-p (file)
 ;;   Return non-nil if this backend considers itself "responsible" for
@@ -429,7 +435,8 @@
 (defcustom vc-default-init-version "1.1"
   "*A string used as the default version number when a new file is registered.
-This can be overridden by giving a prefix argument to \\[vc-register]."
+This can be overridden by giving a prefix argument to \\[vc-register].  This
+can also be overridden by a particular VC backend."
   :type 'string
   :group 'vc
   :version "20.3")
@@ -1342,8 +1349,10 @@
                   (if set-version
                       (read-string (format "Initial version level for %s: "
-                    ;; TODO: Use backend-specific init version.
-                    vc-default-init-version)
+                   (let ((backend (vc-responsible-backend buffer-file-name)))
+                     (if (vc-find-backend-function backend 'init-version)
+                         (vc-call-backend backend 'init-version)
+                       vc-default-init-version)))
                   (or comment (not vc-initial-comment))
                   "Enter initial comment."
@@ -1867,9 +1876,13 @@
     (if (listp diff-switches) diff-switches (list diff-switches))
     (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches))
-    (let ((backend-switches
-           (eval (intern (concat "vc-" (symbol-name ',backend)
-                                 "-diff-switches")))))
+    (let* ((backend-switches-symbol
+           (intern (concat "vc-" (symbol-name ,backend)
+                           "-diff-switches")))
+          (backend-switches
+           (if (boundp backend-switches-symbol)
+               (eval backend-switches-symbol)
+             nil)))
       (if (listp backend-switches) backend-switches (list backend-switches)))))
 (defun vc-default-diff-tree (backend dir rel1 rel2)

reply via email to

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