unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pavel Hlavnicka <pavel@gingerall.cz>
Subject: backups of VC files and vc-make-backup-files
Date: Wed, 24 Jul 2002 15:41:40 +0200	[thread overview]
Message-ID: <3D3EAE94.7030805@gingerall.cz> (raw)

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	other threads:[~2002-07-24 13:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D3EAE94.7030805@gingerall.cz \
    --to=pavel@gingerall.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).