Subject: Re: bug#3224: 23.0.92; vc-dir vs uniquify: wrong directory used

From: Dan Nicolaescu <[email-masked]>
Date: Tue, 4 Aug 2009 05:30:26 -0700 (PDT)

Magnus Henoch <[email-masked]> writes:

  > Please write in English if possible, because the Emacs maintainers
  > usually do not have translators to read other languages for them.
  > 
  > Your bug report will be posted to the [email-masked] mailing list.
  > 
  > Please describe exactly what actions triggered the bug
  > and the precise symptoms of the bug:
  > 
  > I have uniquify-buffer-name-style set to post-forward, which means that
  > I expect buffers with the same name to be called BUFFER|DIR.  This
  > doesn't quite work with vc-dir: the DIR part corresponds to the setting
  > of `default-directory' in the buffer where I invoke the command, instead
  > of the directory I specify.
  > 
  > To reproduce, start "emacs -Q" and evaluate:
  > 
  > (progn
  >   (require 'uniquify)
  >   (setq uniquify-buffer-name-style 'post-forward)
  >   (cd "/tmp")
  >   (make-directory "foo")
  >   (make-directory "bar")
  >   (vc-dir "/tmp/foo")
  >   (cd "/tmp/foo")
  >   (vc-dir "/tmp/bar"))
  > 
  > You will get two buffers, "*vc-dir*|foo" displaying /tmp/bar, and
  > "*vc-dir*|/tmp" displaying /tmp/foo.
  > 
  > I tried to fix this by binding default-directory around
  > create-file-buffer in vc-dir-prepare-status-buffer, which partly fixed
  > the problem: the buffer for bar had a correct name, but the buffer for
  > foo was still "*vc-dir*|/tmp".

I am not familiar with uniquify, but after binding default-directory in
vc-dir-prepare-status-buffer, I get the result above.
And it is identical to what happens when doing:

(progn
  (require 'uniquify)
  (setq uniquify-buffer-name-style 'post-forward)
  (cd "/tmp")
  (make-directory "foo")
  (make-directory "bar")
  (cd "/tmp/foo")
  (create-file-buffer "*vc-dir*")
  (cd "/tmp/bar")
  (create-file-buffer "*vc-dir*"))

so either this is a problem with uniquify, or uniquify it's just working
as expected.