From d445a9756a2b10ac488561ba1ce16397101e5548 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Spiegel?= Date: Wed, 4 Oct 2000 09:50:21 +0000 Subject: [PATCH] (vc-before-save, vc-default-make-version-backups, vc-version-backup-file-name): New functions. --- lisp/vc-hooks.el | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index c8277ec95cd..8e662efefba 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -5,7 +5,7 @@ ;; Author: FSF (see vc.el for full credits) ;; Maintainer: Andre Spiegel -;; $Id: vc-hooks.el,v 1.120 2000/09/21 13:15:26 spiegel Exp $ +;; $Id: vc-hooks.el,v 1.121 2000/10/02 12:02:37 spiegel Exp $ ;; This file is part of GNU Emacs. @@ -459,6 +459,28 @@ to do that, use this command a second time with no argument." (toggle-read-only))) (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) +(defun vc-default-make-version-backups (backend file) + "Return non-nil if unmodified repository versions should +be backed up locally. The default is to switch off this feature." + nil) + +(defun vc-version-backup-file-name (file &optional rev) + "Return a backup file name for REV or the current version of FILE." + (concat file ".~" (or rev (vc-workfile-version file)) "~")) + +(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))) + (and (vc-backend file) + (vc-up-to-date-p file) + (eq (vc-checkout-model file) 'implicit) + (vc-call make-version-backups file) + (copy-file file (vc-version-backup-file-name file) + 'ok-if-already-exists 'keep-date)))) + (defun vc-after-save () "Function to be called by `basic-save-buffer' (in files.el)." ;; If the file in the current buffer is under version control, -- 2.39.2