diff options
| author | André Spiegel | 2000-10-04 09:50:21 +0000 |
|---|---|---|
| committer | André Spiegel | 2000-10-04 09:50:21 +0000 |
| commit | d445a9756a2b10ac488561ba1ce16397101e5548 (patch) | |
| tree | 19b741b83fcd78e6cbf8f85130cee3ffd2854f17 | |
| parent | ffda04606120aabbb51a2f14a655ce7fc03e7063 (diff) | |
| download | emacs-d445a9756a2b10ac488561ba1ce16397101e5548.tar.gz emacs-d445a9756a2b10ac488561ba1ce16397101e5548.zip | |
(vc-before-save, vc-default-make-version-backups,
vc-version-backup-file-name): New functions.
| -rw-r--r-- | lisp/vc-hooks.el | 24 |
1 files changed, 23 insertions, 1 deletions
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 @@ | |||
| 5 | ;; Author: FSF (see vc.el for full credits) | 5 | ;; Author: FSF (see vc.el for full credits) |
| 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 7 | 7 | ||
| 8 | ;; $Id: vc-hooks.el,v 1.120 2000/09/21 13:15:26 spiegel Exp $ | 8 | ;; $Id: vc-hooks.el,v 1.121 2000/10/02 12:02:37 spiegel Exp $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -459,6 +459,28 @@ to do that, use this command a second time with no argument." | |||
| 459 | (toggle-read-only))) | 459 | (toggle-read-only))) |
| 460 | (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) | 460 | (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) |
| 461 | 461 | ||
| 462 | (defun vc-default-make-version-backups (backend file) | ||
| 463 | "Return non-nil if unmodified repository versions should | ||
| 464 | be backed up locally. The default is to switch off this feature." | ||
| 465 | nil) | ||
| 466 | |||
| 467 | (defun vc-version-backup-file-name (file &optional rev) | ||
| 468 | "Return a backup file name for REV or the current version of FILE." | ||
| 469 | (concat file ".~" (or rev (vc-workfile-version file)) "~")) | ||
| 470 | |||
| 471 | (defun vc-before-save () | ||
| 472 | "Function to be called by `basic-save-buffer' (in files.el)." | ||
| 473 | ;; If the file on disk is still in sync with the repository, | ||
| 474 | ;; and version backups should be made, copy the file to | ||
| 475 | ;; another name. This enables local diffs and local reverting. | ||
| 476 | (let ((file (buffer-file-name))) | ||
| 477 | (and (vc-backend file) | ||
| 478 | (vc-up-to-date-p file) | ||
| 479 | (eq (vc-checkout-model file) 'implicit) | ||
| 480 | (vc-call make-version-backups file) | ||
| 481 | (copy-file file (vc-version-backup-file-name file) | ||
| 482 | 'ok-if-already-exists 'keep-date)))) | ||
| 483 | |||
| 462 | (defun vc-after-save () | 484 | (defun vc-after-save () |
| 463 | "Function to be called by `basic-save-buffer' (in files.el)." | 485 | "Function to be called by `basic-save-buffer' (in files.el)." |
| 464 | ;; If the file in the current buffer is under version control, | 486 | ;; If the file in the current buffer is under version control, |