[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: buffer:// under home directory
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Tue, 21 May 2013 18:20:40 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 12019
- References: <87bo86ms3c.fsf@xxxxxxxxx>
In [emacs-w3m : No.12018] Kevin Ryde wrote:
> 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.
I see what the patch does, but don't see why default-directory gets
"~/":
emacs -Q -batch "~/foo.html" -eval '(message "%s" default-directory)'
=> /home/yamaoka/
Because of this, I don't get such an error. It is of no importance,
though.
> 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>.
Indeed.
> 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.
The buffer: scheme is of emacs-w3m internal; Aota-san created it
in response to a question I posted in August 2008. My question
was how to follow a name anchor within an html mail, that contains
a link <a href="#a">...</a> and an anchor <a name="a">...</a>.
There was no way to express the place of such an anchor, that
exists in an Emacs buffer, until then.
I haven't been taking part in the development of that feature,
so I don't know how it is now. But I believe the door is open
for further improvements. (Isn't it you? ;-)
> 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.
I usually use `M-x w3m-buffer' to preview the html source that
I'm editing. Undo makes it revert to the source.