[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Virtual Info files and nodes
From: |
Juri Linkov |
Subject: |
Re: Virtual Info files and nodes |
Date: |
Wed, 01 Jul 2009 03:01:02 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) |
>>>>> - Why check (stringp filename) in Info-virtual-file? Isn't it an
>>>>> error to call it with something else than a string.
>>>> Really only nil can be expected now,
>>> Can it? In which circumstance?
>> `filename' can be nil when `Info-virtual-fun' is called with non-nil
>> `nodename'
>
> That part is obvious enough.
>
>> to check for a node name when a file name is irrelevant -
>> its argument value is nil in this case.
>
> But again: is that ever the case?
> I'd think a node name can only be meaningful when accompagnied by a filename.
There are valid calls with filename=nil where nil means the current
Info file: in Info-find-node-2 filename=nil means to not re-read
the current Info file, other places rely on the value nil returned
from Info-find-file when its argument filename is nil since this
function checks for (stringp filename). So the same check should be
also in Info-virtual-fun because a call to Info-virtual-fun is outside
of branches that check for a non-string filename in Info-find-file
and Info-find-node-2.
>> This is done in the next version below with other fixes including the
>> handling of "dir":
>
> Thanks, looks fairly good now. I just worry a little bit about binding
> inhibit-read-only around the call to (Info-virtual-call virtual-fun
> filename nodename no-going-back) since that may involve a lot of code
> that accesses other buffers. Maybe (setq buffer-read-only nil) would be
> a better choice here.
This code was a copy from a branch that reads a static Info file.
But this could be different like:
(let ((filename (or filename Info-current-file)))
(setq buffer-file-name nil)
(setq buffer-read-only nil)
(erase-buffer)
(setq Info-current-file filename)
(Info-virtual-call virtual-fun filename nodename no-going-back)
(set-marker Info-tag-table-marker nil)
(setq buffer-read-only t)
(set-buffer-modified-p nil)
(set (make-local-variable 'Info-current-node-virtual) t))
--
Juri Linkov
http://www.jurta.org/emacs/