emacs-devel
[Top][All Lists]
Advanced

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

Re: How to inhibit version control for a single command.


From: Kevin Rodgers
Subject: Re: How to inhibit version control for a single command.
Date: Thu, 21 Aug 2003 16:52:54 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

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






reply via email to

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