20 May 2013 02:07
[emacs-w3m:12018] buffer:// under home directory
Kevin Ryde <user42 <at> zip.com.au>
2013-05-20 00:07:35 GMT
2013-05-20 00:07:35 GMT
With recent debian i386 emacs 24.3 and the current cvs w3m, if you have
a file foo.html in your home directory then
M-x find-file ~/foo.html # into buffer foo.html
M-x w3m-browse-url buffer://foo.html
gets
Cannot retrieve URL: file://~/foo.html
default-directory starts with a "~" when under the home directory which
it seems is no good for file://.
An expand-file-name per below does the trick. But then I wondered if
perhaps
(buffer-file-name (get-buffer ...))
would help if the buffer name isn't the filename, eg. foo.html<2>.
Is buffer:// a documented feature? I suppose it could do something like
w3m-region to take the buffer content instead of the file content in
case you haven't saved, or for a non-file buffer. But perhaps it's not
that sophisticated yet.
I struck this when tinkering with a way to have w3m preview html while
editing, and perhaps rendering buffers like a tar file member if
browsing source archive etc. I made a copy to a temp file, but that
loses the current directory for relative links. Perhaps there's
something better already which I don't know.
(Continue reading)
RSS Feed