Function: url-insert
url-insert is a byte-compiled function defined in url-handlers.el.gz.
Signature
(url-insert BUFFER &optional BEG END)
Documentation
Insert the body of a URL object.
BUFFER should be a complete URL buffer as returned by url-retrieve.
If the headers specify a coding-system (and current buffer is multibyte),
it is applied to the body before it is inserted.
Returns a list of the form (SIZE CHARSET), where SIZE is the size in bytes
of the inserted text and CHARSET is the charset that was specified in the
header, or nil if none was found.
BEG and END can be used to only insert a subpart of the body.
They count bytes from the beginning of the body.
Source Code
;; Defined in /usr/src/emacs/lisp/url/url-handlers.el.gz
(defun url-insert (buffer &optional beg end)
"Insert the body of a URL object.
BUFFER should be a complete URL buffer as returned by `url-retrieve'.
If the headers specify a coding-system (and current buffer is multibyte),
it is applied to the body before it is inserted.
Returns a list of the form (SIZE CHARSET), where SIZE is the size in bytes
of the inserted text and CHARSET is the charset that was specified in the
header, or nil if none was found.
BEG and END can be used to only insert a subpart of the body.
They count bytes from the beginning of the body."
(let* ((handle (with-current-buffer buffer (mm-dissect-buffer t)))
(data (with-current-buffer (mm-handle-buffer handle)
(if beg
(buffer-substring (+ (point-min) beg)
(if end (+ (point-min) end) (point-max)))
(buffer-string))))
(charset (if enable-multibyte-characters
(mail-content-type-get (mm-handle-type handle)
'charset))))
(mm-destroy-parts handle)
(insert (if charset
(mm-decode-string data (mm-charset-to-coding-system charset))
data))
(list (length data) charset)))