216 |
|
|
217 |
Optional argument LIMIT is a regexp. If present, the file is inserted |
Optional argument LIMIT is a regexp. If present, the file is inserted |
218 |
in chunks of size BLOCKSIZE (default 8 kByte), until the first |
in chunks of size BLOCKSIZE (default 8 kByte), until the first |
219 |
occurrence of LIMIT is found. The function returns non-nil if FILE |
occurrence of LIMIT is found. Anything from the start of that occurence |
220 |
exists and its contents were successfully inserted." |
to the end of the buffer is then deleted. The function returns |
221 |
|
non-nil if FILE exists and its contents were successfully inserted." |
222 |
(erase-buffer) |
(erase-buffer) |
223 |
(when (file-exists-p file) |
(when (file-exists-p file) |
224 |
(if (not limit) |
(if (not limit) |
229 |
(and (< 0 (cadr (insert-file-contents |
(and (< 0 (cadr (insert-file-contents |
230 |
file nil filepos (incf filepos blocksize)))) |
file nil filepos (incf filepos blocksize)))) |
231 |
(progn (beginning-of-line) |
(progn (beginning-of-line) |
232 |
(not (re-search-forward limit nil 'move))))))) |
(let ((pos (re-search-forward limit nil 'move))) |
233 |
|
(if pos (delete-region (match-beginning 0) |
234 |
|
(point-max))) |
235 |
|
(not pos))))))) |
236 |
(set-buffer-modified-p nil) |
(set-buffer-modified-p nil) |
237 |
t)) |
t)) |
238 |
|
|