Function: vc-insert-file
vc-insert-file is a byte-compiled function defined in vc-hooks.el.gz.
Signature
(vc-insert-file FILE &optional LIMIT BLOCKSIZE)
Documentation
Insert the contents of FILE into the current buffer.
Optional argument LIMIT is a regexp. If present, the file is inserted in chunks of size BLOCKSIZE (default 8 kByte), until the first occurrence of LIMIT is found. Anything from the start of that occurrence to the end of the buffer is then deleted. The function returns non-nil if FILE exists and its contents were successfully inserted.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-hooks.el.gz
(defun vc-insert-file (file &optional limit blocksize)
"Insert the contents of FILE into the current buffer.
Optional argument LIMIT is a regexp. If present, the file is inserted
in chunks of size BLOCKSIZE (default 8 kByte), until the first
occurrence of LIMIT is found. Anything from the start of that occurrence
to the end of the buffer is then deleted. The function returns
non-nil if FILE exists and its contents were successfully inserted."
(erase-buffer)
(when (file-exists-p file)
(if (not limit)
(insert-file-contents file)
(unless blocksize (setq blocksize 8192))
(let ((filepos 0))
(while
(and (< 0 (cadr (insert-file-contents
file nil filepos (cl-incf filepos blocksize))))
(progn (beginning-of-line)
(let ((pos (re-search-forward limit nil 'move)))
(when pos (delete-region (match-beginning 0)
(point-max)))
(not pos)))))))
(set-buffer-modified-p nil)
t))