emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: woman doesn't work if current buffer's directory doesn't exist


From: Kevin Rodgers
Subject: Re: woman doesn't work if current buffer's directory doesn't exist
Date: Thu, 25 Jan 2007 02:24:01 -0700
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)

Chris Moore wrote:
Kevin Rodgers <address@hidden> writes:

It should signal an error, that the directory doesn't exist.  How
does one create a buffer whose default-directory doesn't exist?

One finds a file or creates a buffer which isn't associated with a
file, but has default-directory set anyway, and then has someone else:

  rename the directory containing the file
or
  rename one of the directories higher up the tree
or
  umount the filesystem holding the file
or
  ...

I don't find those scenarios compelling, but I did find out that it's
even easier: C-x C-f /this/directory/doesn't/exist/and_neither_does_this_file RET

I don't see why I shouldn't be allowed to pipe the contents of a
buffer through 'wc -w' for example to count the words in the buffer
just because the buffer's default-directory doesn't exist.

Now _that_ is a compelling argument.

In the case where I first saw this bug, the buffer in question wasn't
associated with a file at all.  I had simply typed "C-x b tmp RET" to
create a temporary buffer.  I was in a '*shell*' buffer at the time,
which was in the "~/tmp/foo" directory.  The 'tmp' buffer which I
created therefore had a default-directory of "~/tmp/foo" - a directory
which I then deleted before attempting to run a shell command on the
contents of the tmp buffer.

Hmmm.  So what is the appropriate directory to use in that situation?
As someone else pointed out, that will affect how relative pathnames
are interpreted: usefully and safely, or not.

Note that when checking for the existance of default-directory, we
need to take the filename handlers into account.  /ssh:address@hidden:/tmp
might look like a bad pathname, but it makes sense to Tramp.

That is a whole other can of worms.  In that case, Tramp is responsible
for ensuring that file-directory-p returns the correct result (which is
noncontroversial) and also for ensuring that shell-command, call-process,
etc. Do The Right Thing i.e. run the command on the remote host in the
specified directory (which may or may not be implemented yet).

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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