unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to inhibit version control for a single command.
@ 2003-08-20  0:59 Kim F. Storm
  2003-08-21 15:46 ` Andre Spiegel
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kim F. Storm @ 2003-08-20  0:59 UTC (permalink / raw)



In ido, I used to be able to let bind vc-master-templates to nil to
temporarily inhibit version control for a single command (e.g. avoid
the CVS up-to-date check when the CVS repository is accessed over a
slow WAN link).  I have used a similar hack in connection with M-x
grep where I don't want to have the up-to-date check just to look at
the matching lines.

Now the vc-master-templates variable is obsolete and it's suggested to
use vc-BACKEND-master-templates instead, but then I have to let bind
several variables to accomplish the same effect.

Now the question is:  is there a simple way in the current vc.el to
temporarily disable vc while opening a file.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to inhibit version control for a single command.
  2003-08-20  0:59 How to inhibit version control for a single command Kim F. Storm
@ 2003-08-21 15:46 ` Andre Spiegel
  2003-08-21 16:47 ` Stefan Monnier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Andre Spiegel @ 2003-08-21 15:46 UTC (permalink / raw)
  Cc: emacs-devel

On Wed, 2003-08-20 at 02:59, Kim F. Storm wrote:

> Now the question is:  is there a simple way in the current vc.el to
> temporarily disable vc while opening a file.

Let-binding vc-handled-backends to nil should do the trick.  If it
doesn't please let me know, perhaps we can work out something that suits
your needs.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to inhibit version control for a single command.
  2003-08-20  0:59 How to inhibit version control for a single command Kim F. Storm
  2003-08-21 15:46 ` Andre Spiegel
@ 2003-08-21 16:47 ` Stefan Monnier
  2003-08-25  9:55   ` Kim F. Storm
  2003-08-21 22:52 ` Kevin Rodgers
  2003-08-23 10:12 ` Andre Spiegel
  3 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2003-08-21 16:47 UTC (permalink / raw)
  Cc: emacs-devel

> In ido, I used to be able to let bind vc-master-templates to nil to
> temporarily inhibit version control for a single command (e.g. avoid
> the CVS up-to-date check when the CVS repository is accessed over a
> slow WAN link).  I have used a similar hack in connection with M-x
> grep where I don't want to have the up-to-date check just to look at
> the matching lines.

Since Emacs-21, the slow access should never happen upon find-file
(only upon vc-next-action or somesuch).  Otherwise, it's a bug and
you should report it.

> Now the vc-master-templates variable is obsolete and it's suggested to
> use vc-BACKEND-master-templates instead, but then I have to let bind
> several variables to accomplish the same effect.

The suggestion is meant for when you set the var to a non-nil value.
In your case the "replacement" is vc-handled-backends, but as mentioned
above if you need to bind it to nil, it might be due to a bug.


	Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to inhibit version control for a single command.
  2003-08-20  0:59 How to inhibit version control for a single command Kim F. Storm
  2003-08-21 15:46 ` Andre Spiegel
  2003-08-21 16:47 ` Stefan Monnier
@ 2003-08-21 22:52 ` Kevin Rodgers
  2003-08-22 18:54   ` Andre Spiegel
  2003-08-23 10:12 ` Andre Spiegel
  3 siblings, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2003-08-21 22:52 UTC (permalink / raw)


Kim F. Storm wrote:

> In ido, I used to be able to let bind vc-master-templates to nil to
> temporarily inhibit version control for a single command (e.g. avoid
> the CVS up-to-date check when the CVS repository is accessed over a
> slow WAN link).  I have used a similar hack in connection with M-x
> grep where I don't want to have the up-to-date check just to look at
> the matching lines.
> 
> Now the vc-master-templates variable is obsolete and it's suggested to
> use vc-BACKEND-master-templates instead, but then I have to let bind
> several variables to accomplish the same effect.
> 
> Now the question is:  is there a simple way in the current vc.el to
> temporarily disable vc while opening a file.

How about adding this:

(defmacro with-vc-disabled (&rest body)
   "Execute BODY forms with version control disabled.
Temporarily bind `vc-rcs-master-templates' and `vc-sccs-master-templates'
to nil."
   `(let ((vc-rcs-master-templates nil)
          (vc-sccs-master-templates nil))
      ,@body))

(put 'with-vc-disabled 'lisp-indent-function 0)

Or better yet:

(defmacro with-vc-disabled (&rest body)
   "Execute BODY forms with version control disabled.
Temporarily bind all `vc-BACKEND-master-templates' variables to nil."
   (let ((template-symbols nil)
         (template-regexp "\\`vc-\\(\\sw\\|\\s_\\)+-master-templates\\'"))
     (mapatoms (lambda (symbol)
                 (if (and (boundp symbol)
                          (string-match template-regexp (symbol-name symbol)))
                     (setq template-symbols
                           (cons symbol template-symbols)))))
     `(let ,(mapcar (lambda (symbol) (list symbol nil))
                    (nreverse template-symbols))
        ,@body)))

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to inhibit version control for a single command.
  2003-08-21 22:52 ` Kevin Rodgers
@ 2003-08-22 18:54   ` Andre Spiegel
  0 siblings, 0 replies; 7+ messages in thread
From: Andre Spiegel @ 2003-08-22 18:54 UTC (permalink / raw)


On Fri, 2003-08-22 at 00:52, Kevin Rodgers wrote:

> (defmacro with-vc-disabled (&rest body)
>    "Execute BODY forms with version control disabled.
> Temporarily bind `vc-rcs-master-templates' and `vc-sccs-master-templates'
> to nil."

This should clearly not be necessary: setting vc-handled-backends to nil
is all that you need.  The vc-BACKEND-master-templates mechanism is
actually only used for RCS and SCCS nowadays, it is not a general
mechanism that would suit all kinds of version control backends.  CVS,
for example, no longer uses it.  vc-handled-backends tells VC which
backends it should watch out for, and each backend can have its own idea
how to determine if a file is controlled by it.  Setting
vc-handled-backends to nil simply disables VC for all backends.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to inhibit version control for a single command.
  2003-08-20  0:59 How to inhibit version control for a single command Kim F. Storm
                   ` (2 preceding siblings ...)
  2003-08-21 22:52 ` Kevin Rodgers
@ 2003-08-23 10:12 ` Andre Spiegel
  3 siblings, 0 replies; 7+ messages in thread
From: Andre Spiegel @ 2003-08-23 10:12 UTC (permalink / raw)
  Cc: emacs-devel

On Wed, 2003-08-20 at 02:59, Kim F. Storm wrote:

> Now the vc-master-templates variable is obsolete and it's suggested to
> use vc-BACKEND-master-templates instead, but then I have to let bind
> several variables to accomplish the same effect.

I have added documentation to the obsolescence declaration that mentions
vc-handled-backends.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to inhibit version control for a single command.
  2003-08-21 16:47 ` Stefan Monnier
@ 2003-08-25  9:55   ` Kim F. Storm
  0 siblings, 0 replies; 7+ messages in thread
From: Kim F. Storm @ 2003-08-25  9:55 UTC (permalink / raw)
  Cc: emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@cs.yale.edu> writes:

> > In ido, I used to be able to let bind vc-master-templates to nil to
> > temporarily inhibit version control for a single command (e.g. avoid
> > the CVS up-to-date check when the CVS repository is accessed over a
> > slow WAN link).  I have used a similar hack in connection with M-x
> > grep where I don't want to have the up-to-date check just to look at
> > the matching lines.
> 
> Since Emacs-21, the slow access should never happen upon find-file
> (only upon vc-next-action or somesuch).  Otherwise, it's a bug and
> you should report it.
> 
> > Now the vc-master-templates variable is obsolete and it's suggested to
> > use vc-BACKEND-master-templates instead, but then I have to let bind
> > several variables to accomplish the same effect.
> 
> The suggestion is meant for when you set the var to a non-nil value.
> In your case the "replacement" is vc-handled-backends, but as mentioned
> above if you need to bind it to nil, it might be due to a bug.

At my previous employer, we were using a hacked up version of CVS
which enforced _mandatory_ file locking, and vc (from 20.x) was
modified to support thi.

This meant that whenever we opened -- or visited -- a file in emacs,
it would have to go to the CVS server (over a slow WAN link) to check
whether someone else had locked the file (using "cvs editors").  This
obviously caused many unnecessary checks when just browsing through a
list of grep matches or compiler warnings (in other people's modules).

So I made the hack to ido and other packages to disable vc checking
when I only wanted to view a file.

I'm a bit puzzled that vc can now always do without any checking
against the archive when opening a file, as it may be quite useful to
know whether other people are editing the same file as you.

But I agree that the new functionality (only check on next-action) is
sufficient, and the advantages (higher performance) out-weights the
disadvantages.

Thanks to Andre for the advice on using vc-handled-backends; I guess I
don't need it anyway, but it's nice to know.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-08-25  9:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-20  0:59 How to inhibit version control for a single command Kim F. Storm
2003-08-21 15:46 ` Andre Spiegel
2003-08-21 16:47 ` Stefan Monnier
2003-08-25  9:55   ` Kim F. Storm
2003-08-21 22:52 ` Kevin Rodgers
2003-08-22 18:54   ` Andre Spiegel
2003-08-23 10:12 ` Andre Spiegel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).