Mercurial > emacs
comparison lisp/vc-hooks.el @ 33206:7feabfeb41cc
(vc-insert-file): Rewritten. Don't bother about auto-save-mode.
author | André Spiegel <spiegel@gnu.org> |
---|---|
date | Sat, 04 Nov 2000 18:24:50 +0000 |
parents | 3632d408929e |
children | 23d61d30fcd0 |
comparison
equal
deleted
inserted
replaced
33205:8b4c25bb65d8 | 33206:7feabfeb41cc |
---|---|
3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. |
4 | 4 |
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.125 2000/10/27 12:11:55 spiegel Exp $ | 8 ;; $Id: vc-hooks.el,v 1.126 2000/10/27 13:26:18 spiegel Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
206 (defun vc-insert-file (file &optional limit blocksize) | 206 (defun vc-insert-file (file &optional limit blocksize) |
207 "Insert the contents of FILE into the current buffer. | 207 "Insert the contents of FILE into the current buffer. |
208 | 208 |
209 Optional argument LIMIT is a regexp. If present, the file is inserted | 209 Optional argument LIMIT is a regexp. If present, the file is inserted |
210 in chunks of size BLOCKSIZE (default 8 kByte), until the first | 210 in chunks of size BLOCKSIZE (default 8 kByte), until the first |
211 occurrence of LIMIT is found. The function returns nil if FILE doesn't | 211 occurrence of LIMIT is found. The function returns non-nil if FILE |
212 exist." | 212 exists and its contents were successfully inserted." |
213 (erase-buffer) | 213 (erase-buffer) |
214 (cond ((file-exists-p file) | 214 (when (file-exists-p file) |
215 (cond (limit | 215 (if (not limit) |
216 (if (not blocksize) (setq blocksize 8192)) | 216 (insert-file-contents file) |
217 (let (found s) | 217 (if (not blocksize) (setq blocksize 8192)) |
218 (while (not found) | 218 (let (found s) |
219 (setq s (buffer-size)) | 219 (while (not found) |
220 (goto-char (1+ s)) | 220 (setq s (buffer-size)) |
221 (setq found | 221 (goto-char (1+ s)) |
222 (or (zerop (cadr (insert-file-contents | 222 (setq found |
223 file nil s (+ s blocksize)))) | 223 (or (zerop (cadr (insert-file-contents |
224 (progn (beginning-of-line) | 224 file nil s (+ s blocksize)))) |
225 (re-search-forward limit nil t))))))) | 225 (progn (beginning-of-line) |
226 (t (insert-file-contents file))) | 226 (re-search-forward limit nil t))))))) |
227 (set-buffer-modified-p nil) | 227 (set-buffer-modified-p nil) |
228 (auto-save-mode nil) | 228 t)) |
229 t) | |
230 (t nil))) | |
231 | 229 |
232 ;;; Access functions to file properties | 230 ;;; Access functions to file properties |
233 ;;; (Properties should be _set_ using vc-file-setprop, but | 231 ;;; (Properties should be _set_ using vc-file-setprop, but |
234 ;;; _retrieved_ only through these functions, which decide | 232 ;;; _retrieved_ only through these functions, which decide |
235 ;;; if the property is already known or not. A property should | 233 ;;; if the property is already known or not. A property should |