aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Spiegel2002-07-19 13:26:11 +0000
committerAndré Spiegel2002-07-19 13:26:11 +0000
commite30140cebbd4e67a913ffd320c0346ea74e6185d (patch)
treeca1738199302963b83b9290b4db08735b74b52d2
parent655388b5d42a92b893c9b624103ed5505cc4b98f (diff)
downloademacs-e30140cebbd4e67a913ffd320c0346ea74e6185d.tar.gz
emacs-e30140cebbd4e67a913ffd320c0346ea74e6185d.zip
(vc-insert-file): When called with a LIMIT regexp,
delete anything that comes after LIMIT from the buffer.
-rw-r--r--lisp/vc-hooks.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index ceb6a325eec..c90356a9c1a 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.139 2002/02/28 13:09:36 spiegel Exp $ 8;; $Id: vc-hooks.el,v 1.140 2002/07/16 17:42:57 spiegel Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -216,8 +216,9 @@ It is usually called via the `vc-call' macro."
216 216
217Optional argument LIMIT is a regexp. If present, the file is inserted 217Optional argument LIMIT is a regexp. If present, the file is inserted
218in chunks of size BLOCKSIZE (default 8 kByte), until the first 218in chunks of size BLOCKSIZE (default 8 kByte), until the first
219occurrence of LIMIT is found. The function returns non-nil if FILE 219occurrence of LIMIT is found. Anything from the start of that occurence
220exists and its contents were successfully inserted." 220to the end of the buffer is then deleted. The function returns
221non-nil if FILE exists and its contents were successfully inserted."
221 (erase-buffer) 222 (erase-buffer)
222 (when (file-exists-p file) 223 (when (file-exists-p file)
223 (if (not limit) 224 (if (not limit)
@@ -228,7 +229,10 @@ exists and its contents were successfully inserted."
228 (and (< 0 (cadr (insert-file-contents 229 (and (< 0 (cadr (insert-file-contents
229 file nil filepos (incf filepos blocksize)))) 230 file nil filepos (incf filepos blocksize))))
230 (progn (beginning-of-line) 231 (progn (beginning-of-line)
231 (not (re-search-forward limit nil 'move))))))) 232 (let ((pos (re-search-forward limit nil 'move)))
233 (if pos (delete-region (match-beginning 0)
234 (point-max)))
235 (not pos)))))))
232 (set-buffer-modified-p nil) 236 (set-buffer-modified-p nil)
233 t)) 237 t))
234 238