6

Is there some way to download and show a file from a URI/URL?

I now I can use wget and then open the downloaded file and I guess I could even try to write myself a small function to do this.

But most likely someone did before me so is there a function/package that will let me get a file from the internets (would be great if it did not save the file somewhere first) and open it in a new buffer?

13
M-x url-handler-mode
C-x C-f http://emacs.stackexchange.com/questions/21180/is-there-a-way-to-show-open-a-file-from-a-uri-url

This opens the HTML file of this stackexchange question in your Emacs.

2
  • 1
    yes nice - is there a way to combine this into a single command so I don't have to change the mode of some random buffer first? – Random Dev Mar 23 '16 at 11:51
  • 3
    url-handler-mode is a global minor mode, not a major mode. Just put (url-handler-mode 1) into your init file. – phils Mar 23 '16 at 12:06
2

If you want the file "rendered", you can use the web browser eww - just do M-x eww RET url RET

0

You can turn URLs in a buffer into clickable buttons with Emacs goto-address-mode minor mode. If the URL represents a web page, then you can get Emacs to browse that page by clicking on the URL button.

Turn this mode on/off with: M-x goto-address-mode

This works with Emacs running in Graphics mode and in terminal mode. A special key map is activated when point is over the URL button. The C-c RET key sequence is bound to goto-address-at-point which makes Emacs browse the web page.

It's also possible to add key binding to that special map. In my system I added keys to navigate to the next or previous URL and to copy he content of the file identified by the URL into a local temporary file and then visit it. To do that add a function to the goto-address-mode-hook that maps commands into the goto-address-highlight-keymap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.