bug-gnu-emacs
[Top][All Lists]
Advanced

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

backups of VC files and vc-make-backup-files


From: Pavel Hlavnicka
Subject: backups of VC files and vc-make-backup-files
Date: Wed, 24 Jul 2002 15:41:40 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020605

In GNU Emacs 21.2.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-04-09 on porky.devel.redhat.com
configured using `configure i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-gcc --with-pop --with-sound'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

The backup of version controlled files is created even if
vc-make-backup-files is set to nil.

While the vc-find-file-hook hook is executed (in vc-hooks.el), the
vc-make-backup-files variable is checked and the backup-inhibited
local variable is set correctly, what prevents emacs to create an
ordinary backup files.

What seem to be a problem is a fact, that the vc-make-backup-files is
not tested while the file is saved. The vc-before-save is called w/o
any check, and there is no check in this function too.

I fixed this problem locally modifying the vc-before-save as follows:

(defun vc-before-save ()
  "Function to be called by `basic-save-buffer' (in files.el)."
  ;; If the file on disk is still in sync with the repository,
  ;; and version backups should be made, copy the file to
  ;; another name.  This enables local diffs and local reverting.
  (let ((file (buffer-file-name)))
    ;;_ph_ vc-make-backup-files was not checked
    (and vc-make-backup-files ; <==== HERE
         (vc-backend file)
         (vc-up-to-date-p file)
         (eq (vc-checkout-model file) 'implicit)
         (vc-call make-version-backups-p file)
         (vc-make-version-backup file))))

I don't know, whether it matches the concept, but it works :)

Emacs rules!

Have a nice day

Pavel

--
Pavel Hlavnicka
Ginger Alliance
www.gingerall.com




reply via email to

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