Function: url-insert-buffer-contents

url-insert-buffer-contents is an autoloaded and byte-compiled function defined in url-handlers.el.gz.

Signature

(url-insert-buffer-contents BUFFER URL &optional VISIT BEG END REPLACE)

Documentation

Insert the contents of BUFFER into current buffer.

This is like url-insert, but also decodes the current buffer as if it had been inserted from a file named URL.

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-handlers.el.gz
;;;###autoload
(defun url-insert-buffer-contents (buffer url &optional visit beg end replace)
  "Insert the contents of BUFFER into current buffer.
This is like `url-insert', but also decodes the current buffer as
if it had been inserted from a file named URL."
  (if visit (setq buffer-file-name url))
  (save-excursion
    (let ((start (point))
          (size-and-charset (url-insert buffer beg end)))
      (kill-buffer buffer)
      (when replace
        (delete-region (point-min) start)
        (delete-region (point) (point-max)))
      (unless (cadr size-and-charset)
        ;; If the headers don't specify any particular charset, use the
        ;; usual heuristic/rules that we apply to files.
        (decode-coding-inserted-region (point-min) (point) url
                                       visit beg end replace))
      (let ((inserted (car size-and-charset)))
        (list url (or (after-insert-file-set-coding inserted visit)
                      inserted))))))