emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Info-insert-dir


From: martin rudalics
Subject: Re: Info-insert-dir
Date: Mon, 19 Mar 2007 10:50:21 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> This nonexistent directory came from `Info-additional-directory-list',
> right?  So I think that if this is a bug, the bug would be at the
> earlier stage, where the value of `Info-additional-directory-list' was
> set up.  Do you disagree?

Probably.  It's a customizable variable and `wid-edit' doesn't even
check if the user puts valid directory names in there.  Also, whether a
directory exists at the time of calling `call-process' may depend on a
number of factors - whether the directory is remote, a drive is
mounted...  I think it would be better if `Info-insert-dir' refrained
from using an obscure source such as `Info-additional-directory-list' to
set the default directory of its buffer.

>       More disconcerting,
>     however, is that any part of Emacs that relies on a valid, existing
>     default directory won't work reliably.
>
> You can set `default-directory' to any string, so Emacs facilities
> should not assume it is an existing directory unless it part of
> their definition to need that.
>
> Therefore, those other features such as spell checking should be
> changed not to depend on this.  As far as I know, ispell and aspell
> have no need to use the default directory.  Indeed one call-process
> call in ispell.el already handles the case of nonexistent default
> directory.

You mean the

      (unless (file-exists-p default-directory)
        (setq default-directory (expand-file-name "~/")))

AFAICT this is the only occurrence of such a test in the entire Emacs
sources.  It might fail if default-directory equals the name of an
existing non-directory file - an unlikely case, though.

> Does this patch make it work?

I'm not sure.  Before I already wrapped every occurrence of these in a

        (let ((default-directory
                (if (file-directory-p default-directory) default-directory 
"~/")))

including the `start-process' instance in ispell.el and it worked (BTW
`flyspell' has another instance of `call-process-region').  But isn't it
a bit tedious to search for all occurrences of `call-process' etc?
Couldn't such a check make it to `call-process', `start-process' ...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]