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

From: Juanma Barranquero <[email-masked]>
Date: Fri, 8 Jan 2010 00:05:51 +0100

On Thu, Jan 7, 2010 at 20:53, Stefan Monnier <[email-masked]> wrote:

> Feel free to rename it to uniquify-buffer-dir-name and adjust the docstring.

I'm not sure how to describe what it does. It returns the name of the
parent directory of the buffer; something like that.

BTW, in that function, this bit

	       (if (memq major-mode uniquify-list-buffers-directory-modes)
		   list-buffers-directory))))

and the whole `uniquify-list-buffers-directory-modes' seem a bit
redundant; adding a mode to the variable won't work unless the mode
function defines `list-buffers-directory', and even so, if the buffer
has a `buffer-file-name', `list-buffers-directory' won't be used. So
it would be easier to remove the variable and do the check so:

     (let ((filename
 	   (or buffer-file-name
-	       (if (memq major-mode uniquify-list-buffers-directory-modes)
-		   list-buffers-directory))))
+	       (bound-and-true-p list-buffers-directory))))
       (when filename
 	(directory-file-name

It is even more general, because any mode for buffers that do not have
a buffer-file-name but do define list-buffers-directory will
automatically work with uniquify.

    Juanma