diff options
| author | Stefan Monnier | 2004-03-23 20:59:19 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-03-23 20:59:19 +0000 |
| commit | 4a330ab7afc2731efaf7ea73388dad0670be66e2 (patch) | |
| tree | 3a2844496bb59502b1c01dc849965381e74da6fc | |
| parent | 22cd1973d54a817eb0b0a8e9a9bf6e07323817fa (diff) | |
| download | emacs-4a330ab7afc2731efaf7ea73388dad0670be66e2.tar.gz emacs-4a330ab7afc2731efaf7ea73388dad0670be66e2.zip | |
(vc-default-find-file-not-found-hook): New fun.
(vc-file-not-found-hook): Use it.
| -rw-r--r-- | lisp/vc-hooks.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index d0c444d2d91..be39f7d9d5c 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Author: FSF (see vc.el for full credits) | 6 | ;; Author: FSF (see vc.el for full credits) |
| 7 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 7 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 8 | 8 | ||
| 9 | ;; $Id: vc-hooks.el,v 1.161 2004/03/15 03:53:05 monnier Exp $ | 9 | ;; $Id: vc-hooks.el,v 1.162 2004/03/21 15:44:39 spiegel Exp $ |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | 12 | ||
| @@ -765,14 +765,17 @@ Used in `find-file-not-found-functions'." | |||
| 765 | ;; When a file does not exist, ignore cached info about it | 765 | ;; When a file does not exist, ignore cached info about it |
| 766 | ;; from a previous visit. | 766 | ;; from a previous visit. |
| 767 | (vc-file-clearprops buffer-file-name) | 767 | (vc-file-clearprops buffer-file-name) |
| 768 | (if (and (vc-backend buffer-file-name) | 768 | (let ((backend (vc-backend buffer-file-name))) |
| 769 | (yes-or-no-p | 769 | (if backend (vc-call-backend backend find-file-not-found-hook)))) |
| 770 | (format "File %s was lost; check out from version control? " | 770 | |
| 771 | (file-name-nondirectory buffer-file-name)))) | 771 | (defun vc-default-find-file-not-found-hook (backend) |
| 772 | (save-excursion | 772 | (if (yes-or-no-p |
| 773 | (require 'vc) | 773 | (format "File %s was lost; check out from version control? " |
| 774 | (setq default-directory (file-name-directory buffer-file-name)) | 774 | (file-name-nondirectory buffer-file-name))) |
| 775 | (not (vc-error-occurred (vc-checkout buffer-file-name)))))) | 775 | (save-excursion |
| 776 | (require 'vc) | ||
| 777 | (setq default-directory (file-name-directory buffer-file-name)) | ||
| 778 | (not (vc-error-occurred (vc-checkout buffer-file-name)))))) | ||
| 776 | 779 | ||
| 777 | (add-hook 'find-file-not-found-functions 'vc-file-not-found-hook) | 780 | (add-hook 'find-file-not-found-functions 'vc-file-not-found-hook) |
| 778 | 781 | ||