[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
buffer:// under home directory
- From: Kevin Ryde <user42@xxxxxxxxxx>
- Date: Mon, 20 May 2013 10:07:35 +1000
- X-ml-name: emacs-w3m
- X-mail-count: 12018
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.
--- w3m.el.~1.1599.~ 2013-04-06 07:20:42.000000000 +1100
+++ w3m.el 2013-05-20 09:23:39.000000000 +1000
@@ -9417,7 +9417,7 @@
(w3m-search-name-anchor fragment-part))
((not (string= file-part ""))
(w3m-goto-url (w3m-expand-url (substring url (match-beginning 4))
- (concat "file://" default-directory))
+ (concat "file://" (expand-file-name default-directory)))
reload charset post-data referer handler element))
(t (w3m-message "No URL at point")))))
((w3m-url-valid url)
--
It's a long way to the shop if you want a sausage roll.