From: Juanma Barranquero <lekktu@gmail.com>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: Magnus Henoch <mange@freemail.hu>, 3224@debbugs.gnu.org
Subject: bug#3224: 23.0.92; vc-dir vs uniquify: wrong directory used
Date: Wed, 6 Jan 2010 05:00:38 +0100 [thread overview]
Message-ID: <f7ccd24b1001052000k2e829152ob1362be6d4d63516@mail.gmail.com> (raw)
In-Reply-To: <200908041230.n74CUQUd025123@godzilla.ics.uci.edu>
On Tue, Aug 4, 2009 at 13:30, Dan Nicolaescu <dann@ics.uci.edu> wrote:
> 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*"))
In fact, I think the two problems are not exactly the same, though
they are related. If my analysis, and the following patch, are
correct, Dan's example is caused by a bug in
`uniquify-rationalize-file-buffer-names', which sometimes, while
trying to refresh the dirname of a candidate, fails to check that it
is setting it to nil. Fixing that problem makes Dan's example to work,
but Magnus' vc-dir example still fails.
The reason of the other bug is twofold:
On one hand, vc-dir (specifically `vc-dir-prepare-status-buffer') is
calling `create-file-buffer' passing "*vc-dir*" to it; but that
function expects to be passed a filename; in this case, the difference
is relevant because uniquify tries to use that filename's directory
information to decide the dirname for the candidates.
On the other hand, `uniquify-buffer-file-name' should return a
directory, but fails to deal with the case that the "filename" is
already a directory (which can happen, for example, when it is getting
this "filename" from `list-buffers-directory'). In this case it should
just remove any trailing slash and pass it back unscathed.
Please, try the attached patch to see whether it helps.
Thanks,
Juanma
2010-01-06 Juanma Barranquero <lekktu@gmail.com>
Bug#3224
* uniquify.el (uniquify-rationalize-file-buffer-names):
Don't set uniquify-item-dirname to nil.
(uniquify-buffer-file-name): If the "filename" is already a directory
name, do not modify it.
* vc-dir.el (vc-dir-prepare-status-buffer): Pass a (fake) filename
to `create-file-buffer' as it expects, not just a buffer name.
=== modified file 'lisp/uniquify.el'
--- lisp/uniquify.el 2010-01-04 05:35:18 +0000
+++ lisp/uniquify.el 2010-01-06 03:22:51 +0000
@@ -232,9 +232,9 @@
;; of code like in set-visited-file-name:
;; (or (string= new-name (buffer-name)) (rename-buffer new-name t))
;; So we need to refresh the dirname of the uniquify-item.
- (setf (uniquify-item-dirname (car items))
- (uniquify-buffer-file-name
- (uniquify-item-buffer (car items))))
+ (let ((bfn (uniquify-buffer-file-name (uniquify-item-buffer (car
items)))))
+ (when bfn
+ (setf (uniquify-item-dirname (car items)) bfn)))
;; This shouldn't happen, but maybe there's no dirname any more.
(unless (uniquify-item-dirname (car items))
(with-current-buffer (uniquify-item-buffer (car items))
@@ -265,9 +265,11 @@
list-buffers-directory))))
(when filename
(directory-file-name
- (file-name-directory
- (expand-file-name
- (directory-file-name filename))))))))
+ (if (file-directory-p filename)
+ (file-name-as-directory filename)
+ (file-name-directory
+ (expand-file-name
+ (directory-file-name filename)))))))))
(defun uniquify-rerationalize-w/o-cb (fix-list)
"Re-rationalize the buffers in FIX-LIST, but ignoring `current-buffer'."
=== modified file 'lisp/vc-dir.el'
--- lisp/vc-dir.el 2009-12-05 00:24:03 +0000
+++ lisp/vc-dir.el 2010-01-06 03:26:33 +0000
@@ -101,7 +101,7 @@
(return buffer))))))))
(or buf
;; Create a new buffer named BNAME.
- (with-current-buffer (create-file-buffer bname)
+ (with-current-buffer (create-file-buffer (expand-file-name bname dir))
(cd dir)
(vc-setup-buffer (current-buffer))
;; Reset the vc-parent-buffer-name so that it does not appear
next prev parent reply other threads:[~2010-01-06 4:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f7ccd24b1001071940k28f0f35y508b7f1c26640f9f@mail.gmail.com>
2009-05-05 15:19 ` bug#3224: 23.0.92; vc-dir vs uniquify: wrong directory used Magnus Henoch
2009-08-04 12:30 ` Dan Nicolaescu
2010-01-06 4:00 ` Juanma Barranquero [this message]
2010-01-06 4:55 ` Dan Nicolaescu
2010-01-06 5:38 ` Stefan Monnier
2010-01-06 10:17 ` Juanma Barranquero
2010-01-06 14:28 ` Stefan Monnier
2010-01-07 11:14 ` Juanma Barranquero
2010-01-07 14:54 ` Stefan Monnier
2010-01-07 15:09 ` Juanma Barranquero
2010-01-07 19:53 ` Stefan Monnier
2010-01-07 23:05 ` Juanma Barranquero
2010-01-08 3:22 ` Stefan Monnier
2010-01-07 15:10 ` Dan Nicolaescu
2010-01-07 15:19 ` Juanma Barranquero
2010-01-07 19:57 ` Stefan Monnier
2010-01-08 3:41 ` bug#3224: marked as done (23.0.92; vc-dir vs uniquify: wrong directory used) Emacs bug Tracking System
2009-09-24 20:53 ` bug#4553: 23.1; uniquify gives *vc-dir* buffer the wrong name Tom Tromey
2009-09-24 21:32 ` Dan Nicolaescu
2009-09-24 21:40 ` Processed: " Emacs bug Tracking System
2010-01-08 3:41 ` bug#4553: marked as done (23.1; uniquify gives *vc-dir* buffer the wrong name) Emacs bug Tracking System
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7ccd24b1001052000k2e829152ob1362be6d4d63516@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=3224@debbugs.gnu.org \
--cc=dann@ics.uci.edu \
--cc=mange@freemail.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).