Title vc-dired-mode bug: dired-subdir-alist seems to be mangled
Type defect Module vc
Severity inconvenience Platform N/A
Keywords has patch Nosy List mike.kupfer
These controls should only be changed by committers and tracker administrators.
Status new   Reason
Priority normal   Assigned To

Created on 2009-03-03.19:07:51 by anonymous, last changed 2009-06-30.15:03:40 by rsparapa.

msg1217 [hidden] ([hidden]) Date: 2009-06-18.18:31:21
  Message-ID: <>
All patches, except msg1200, have been applied: unfortunately, this
patch is also necessary in my experience (and harmless, so what is the
problem?).  I suppose there should also be a patch to fix the "mangled"
error message since it is misleading.
msg1200 [hidden] ([hidden]) Date: 2009-05-05.19:04:56
  Message-ID: <>
As I said earlier, somewhere you need to define vc-dired-terse-mode:

--- vc-hooks.el~        Tue Mar  3 09:10:43 2009
+++ vc-hooks.el Mon May  4 15:03:50 2009
@@ -38,6 +38,8 @@
   (require 'cl))

+(defvar vc-dired-terse-mode nil)
 ;; Customization Variables (the rest is in vc.el)

 (defvar vc-ignore-vc-files nil)
msg1191 [hidden] ([hidden]) Date: 2009-04-27.20:20:02
  Message-ID: <>
This makes vc-dired work in all ways that I have tried with svn.
But beware, the comment on the first line was longish which created
what we used to call a "flowed" line.

diff -u .dired-1.19/dired.el dired/dired.el
--- .dired-1.19/dired.el	Sun Jan 13 08:51:20 2008
+++ dired/dired.el	Mon Apr 27 15:06:17 2009
@@ -4801,6 +4803,7 @@
   ;; With optional second arg NO-REVERT, don't refresh the listing
   ;; If subdir is non-nil, only changes the switches for the
   ;; sudirectory.
+  (dired-build-subdir-alist); why has this not been called by now?
   (if subdir
       (let ((elt (assoc subdir dired-subdir-alist)))
 	(if elt (setcar (nthcdr 3 elt) switches)))
msg1185 [hidden] ([hidden]) Date: 2009-04-23.14:36:23
  Message-ID: <>
Well the fresh port is a dead end since it is implicated in a crash; see
bug 517 (an assertion really; that shouldn't be happening either, but I
digress).  In any case, I think the original bug is squashed, however,
more testing is needed to say that definitively; read on.

Mats Lidell wrote:
Dired doesn't set the buffer to vc-dired-mode. This patch fixes
this. There are still unresolved issues but with this it is possible
to get a working buffer sometimes if you don't give up ...  ;-) 

"cvs diff -u" in /src/xemacs/packages/xemacs-packages/dired/

Index: dired.el
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/dired/dired.el,v
retrieving revision 1.11
diff -u -r1.11 dired.el
--- dired.el	13 Jan 2008 14:51:20 -0000	1.11
+++ dired.el	21 Apr 2009 22:44:39 -0000
@@ -1751,7 +1751,8 @@
 	(setq default-directory (file-name-directory dirname)
 	      wildcard t))
       (or switches (setq switches dired-listing-switches))
-      (dired-mode dirname switches)
+      (if mode (funcall mode)
+	(dired-mode dirname switches))
       ;; default-directory and dired-internal-switches are set now
       ;; (buffer-local), so we can call dired-readin:
       (let ((failed t))

Actually it is like this. The patch ensures that the buffer is in the
right mode when it is created.  Partial success: Modified files seems
to be listed at this time but why not all!?. Calling vc-directory now
a second time on the same directory fills it with the normal dired
info while keeping it still in the right mode. So that the commands

Michael Sperber wrote:
I've applied that change upstream.  Thanks!

Rodney Sparapani wrote:
> > (defvar vc-dired-terse-mode nil)
> > 
> > I need that, but then I have a different problem:
> > 
> > Debugger entered--Lisp error: (wrong-type-argument natnump -1)
> > dired-sort-other((?a ?l ?R))
> > dired-internal-noselect("/home/rsparapa/svn/ess/" "-alR" vc-dired-mode)
> > vc-directory("/home/rsparapa/svn/ess/" nil)
> > call-interactively(vc-directory)
> > command-execute(vc-directory t)
> > execute-extended-command(nil)
> > call-interactively(execute-extended-command)
> > 
> > But, I can't see where that is coming from.
> > 

And wrote...
Ok, I see the problem.  dired-subdir-alist is nil.  So that causes line
4835-6 in dired-sort-other from dired.el to blow up:

(nth (1- (length dired-subdir-alist))

(1- 0) --> -1
(nth -1 ...) --> explodes

Aha!  dired-subdir-alist should never be nil.  Why is it nil? 
Apparently, (dired-build-subdir-alist) has not been called.  If
you place that at the beginning of the definition of dired-sort-other,
say line 4806, then it works!  But, where should this call have been 
made in the first place?

And note that vc-dired-terse-mode is actually being set to nil on
line 2458 of vc.el.  But, for me, that's too late.  Hence the need
for my earlier change above.  Let's move this defvar to the top of the file.
msg1060 [hidden] ([hidden]) Date: 2009-03-03.19:07:51
Ville Skyttä wrote:
vc-dired-mode quite broken; I get "dired-subdir-alist seems to 
be mangled" when I try to do something in a vc-dired-mode buffer.

Rodney Sparapani wrote:
this bug occurs in XEmacs 21.4.22 and 21.5.28
and in vc 1.45 and 1.46 
futile attempts to workaround the problems
which come from dired-current-directory and 
dired-get-subdir; need help from somebody who
understands dired.el
Date User Action Args
2009-06-30 15:03:40rsparapasetmessages: - msg1227
2009-06-23 17:49:55rsparapasetmessages: + msg1227
2009-06-18 18:31:22rsparapasetmessages: + msg1217
2009-05-05 19:05:37rsparapasetmessages: - msg1079
2009-05-05 19:04:56rsparapasetmessages: + msg1200
2009-04-27 20:20:02rsparapasetmessages: + msg1191
keyword: + has patch, - needs test, needs patch
2009-04-23 14:36:34rsparapasetfiles: - vc-new-port.tgz
2009-04-23 14:36:23rsparapasetstatus: new
messages: + msg1185
keyword: + needs test, needs patch
2009-03-12 22:01:37mike.kupfersetnosy: + mike.kupfer
2009-03-09 17:05:43rsparapasetfiles: + vc-new-port.tgz
messages: + msg1079
2009-03-06 13:38:28stephensetnosy: - anonymous
2009-03-03 19:07:51anonymouscreate