Skip to content

Instantly share code, notes, and snippets.

@barrosfelipe
Created July 20, 2017 19:27
Embed
What would you like to do?
Inserts the content of an URL into the Emacs buffer, like VIm's :r <url>
(defun insert-url-1 (url insert-func)
(let* ((tem (funcall insert-func url)))
(push-mark (+ (point) (car (cdr tem))))))
(defun insert-url (url)
"Insert contents of URL into buffer after point.
Set mark after the inserted text.
This function is meant for the user to run interactively.
Don't call it from programs!
Use `url-insert-file-contents' instead.
\(Its calling sequence is different; see its documentation)."
(declare (interactive-only url-insert-file-contents))
(interactive "*sInsert URL: ")
(insert-url-1 url #'url-insert-file-contents))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment