Skip to content

Instantly share code, notes, and snippets.

@barrosfelipe
Created July 20, 2017 19:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barrosfelipe/a177c63331a877864b499b080eb939fd to your computer and use it in GitHub Desktop.
Save barrosfelipe/a177c63331a877864b499b080eb939fd to your computer and use it in GitHub Desktop.
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