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-hooks.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-hooks.el
Date: Sun, 06 Jul 2003 13:26:49 -0400

Index: emacs/lisp/vc-hooks.el
diff -c emacs/lisp/vc-hooks.el:1.152 emacs/lisp/vc-hooks.el:1.153
*** emacs/lisp/vc-hooks.el:1.152        Thu Jun  5 07:34:06 2003
--- emacs/lisp/vc-hooks.el      Sun Jul  6 13:26:48 2003
***************
*** 6,12 ****
  ;; Author:     FSF (see vc.el for full credits)
  ;; Maintainer: Andre Spiegel <address@hidden>
  
! ;; $Id: vc-hooks.el,v 1.152 2003/06/05 11:34:06 fx Exp $
  
  ;; This file is part of GNU Emacs.
  
--- 6,12 ----
  ;; Author:     FSF (see vc.el for full credits)
  ;; Maintainer: Andre Spiegel <address@hidden>
  
! ;; $Id: vc-hooks.el,v 1.153 2003/07/06 17:26:48 monnier Exp $
  
  ;; This file is part of GNU Emacs.
  
***************
*** 118,123 ****
--- 118,172 ----
        (and vc-mistrust-permissions
           (funcall vc-mistrust-permissions
                    (vc-backend-subdirectory-name file)))))
+ 
+ (defcustom vc-stay-local t
+   "*Non-nil means use local operations when possible for remote repositories.
+ This avoids slow queries over the network and instead uses heuristics
+ and past information to determine the current status of a file.
+ 
+ The value can also be a regular expression or list of regular
+ expressions to match against the host name of a repository; then VC
+ only stays local for hosts that match it.  Alternatively, the value
+ can be a list of regular expressions where the first element is the
+ symbol `except'; then VC always stays local except for hosts matched
+ by these regular expressions."
+   :type '(choice (const :tag "Always stay local" t)
+         (const :tag "Don't stay local" nil)
+         (list :format "\nExamine hostname and %v" :tag "Examine hostname ..."
+               (set :format "%v" :inline t (const :format "%t" :tag "don't" 
except))
+               (regexp :format " stay local,\n%t: %v" :tag "if it matches")
+               (repeat :format "%v%i\n" :inline t (regexp :tag "or"))))
+   :version "21.4"
+   :group 'vc)
+ 
+ (defun vc-stay-local-p (file)
+   "Return non-nil if VC should stay local when handling FILE.
+ This uses the `repository-hostname' backend operation."
+   (let* ((backend (vc-backend file))
+        (sym (vc-make-backend-sym backend 'stay-local))
+        (stay-local (if (boundp sym) (symbol-value sym) t)))
+     (if (eq stay-local t) (setq stay-local vc-stay-local))
+     (if (symbolp stay-local) stay-local
+       (let ((dirname (if (file-directory-p file)
+                        (directory-file-name file)
+                      (file-name-directory file))))
+       (eq 'yes
+           (or (vc-file-getprop dirname 'vc-stay-local-p)
+               (vc-file-setprop
+                dirname 'vc-stay-local-p
+                (let ((hostname (vc-call-backend
+                                 backend 'repository-hostname dirname)))
+                  (if (not hostname)
+                      'no
+                    (let ((default t))
+                      (if (eq (car-safe stay-local) 'except)
+                          (setq default nil stay-local (cdr stay-local)))
+                      (when (consp stay-local)
+                        (setq stay-local
+                              (mapconcat 'identity stay-local "\\|")))
+                      (if (if (string-match stay-local hostname)
+                              default (not default))
+                          'yes 'no)))))))))))
  
  ;;; This is handled specially now.
  ;; Tell Emacs about this new kind of minor mode




reply via email to

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