18

Most of the open source software around expose its code over some HTTP service. I would like to open and browse such code from Emacs, but AFAICS tramp only allows for ssh and ftp.

My first question is thus how to open an HTTP URL for reading from within Emacs. Then, the possibly more advanced question is how to do that from the shell and emacsclient.

How would you do it?

skuro
  • 13,094
  • 1
  • 43
  • 65
  • Why not use your favourite browser and use the `save page` option placing the HTML/CSS onto your local file system? – Ed Heal Mar 09 '13 at 09:37
  • 1
    I can of course do it, but the lazy bastard in me will keep all that unused "garbage" forever. I would rather have my editor open the file for me, then trash it as soon as I'm done. I can already do `vim http://some/url`, but I'd rather stick to emacs. – skuro Mar 09 '13 at 09:40
  • 3
    @Ed Heal: I start to wander, do you really consider manual actions with lousy schedules as a better option over finding the proper command to invoke? :-) – skuro Mar 09 '13 at 10:50
  • Just thinking that it is better to just make a copy - use your local machine to update (presumably a live) web site and get it right on your machine before copying it across. Some operations are better done manually. As to lousy schedules - better learn time keeping. Comes in useful in other places. – Ed Heal Mar 09 '13 at 11:00
  • 2
    You're absolutely right. Still, as a software developer I tend to believe that manual operations on software products is only necessary when automation fails. Besides, I can see myself needing this some million times in the next years, and those half a seconds I can spare really add up. – skuro Mar 09 '13 at 23:41
  • See also http://emacs.stackexchange.com/questions/21180/is-there-a-way-to-show-open-a-file-from-a-uri-url – Erik Jan 21 '17 at 21:04

2 Answers2

19

M-x browse-url-emacs RET http... RET

You might need to use M-x normal-mode RET afterwards to set the appropriate mode for the buffer.

phils
  • 66,286
  • 9
  • 132
  • 174
  • 1
    For Emacs 24, see also: http://stackoverflow.com/questions/19632185/display-contents-of-remote-html-in-emacs – phils Aug 19 '14 at 11:46
3

There are two or three html viewers for emacs; I'd use emacs-w3m. If you want to edit something remote via HTTP(S), perhaps Tramp's dav external method will work for you.

db48x
  • 2,886
  • 20
  • 16