[issue488] Re: VC submenu under Tools

Rodney Sparapani rsparapa at mcw.edu
Tue Mar 3 10:32:48 EST 2009


Rodney Sparapani wrote:
> Rodney Sparapani wrote:
>>> BTW, I just tried using vc+dired integration for the first time and either I 
>>> don't understand how it works (which is quite likely as I've never really 
>>> used dired either) or it's quite broken; I get "dired-subdir-alist seems to 
>>> be mangled" when I try to do something in a vc-dired-mode buffer.
>> Same here and, for me, dired-subdir-alist is nil.  This variable comes 
>> from dired.el and the error message must be coming from the function
>> also defined therein, dired-current-directory
>>
> 
> I get it now.  dired-current-directory is supposed to look at your 
> vc-dired buffer and determine if the file you are checking in is
> in the current default-directory or in a subdirectory thereof.
> However, it can't seem to figure out the way subdirectories are
> encoded in the buffer.  So, it barfs.  But, if you have it return
> something sensible, like default-directory, then it prompts you for
> a log and checks in the marked file.  I haven't tried multiple
> files yet.  No idea how to fix it completely.
> 

I suppose, technically, some of these are separate issues, but all will 
crop up if you use the VC submenu sooner or later.  So, I've shoe-horned
in an ugly workaround, that will at least allow VC dired mode to work.
However, marking still pukes with:

Debugger entered--Lisp error: (wrong-type-argument 
number-char-or-marker-p nil)
   dired-get-subdir()
   dired-mark(1)
   call-interactively(dired-mark)

So there is some disagreement between dired and VC, however, dired only 
seems to be working fine.  Hopefully, the hack will not create more 
havoc than it fixes.  But, this investigation led to another bug 
discovery.  vc-directory does not turn on vc-dired-mode!  FYI.  Here's 
my combo hack/bug-fix for vc.el FWIW:

(defun vc-directory (dir read-switches)
   "Create a buffer in VC Dired Mode for directory DIR.

See Info node `VC Dired Mode'.

With prefix arg READ-SWITCHES, specify a value to override
`dired-listing-switches' when generating the listing."
   (interactive "DDired under VC (directory): \nP")
   (let ((vc-dired-switches (concat vc-dired-listing-switches
                                    (if vc-dired-recurse "R" ""))))
     (if (eq (string-match tramp-file-name-regexp dir) 0)
         (error "Sorry, vc-directory does not work over Tramp"))
     (if read-switches
         (setq vc-dired-switches
               (read-string "Dired listing switches: "
                            vc-dired-switches)))
     (require 'dired)
     ;; XEmacs change: we don't have/need(?) dired-aux
     ;(require 'dired-aux)
     (switch-to-buffer
      (dired-internal-noselect (expand-file-name (file-name-as-directory 
dir))
                               vc-dired-switches
                               'vc-dired-mode))
;the above line does not turn on vc-dired-mode, why god, why?
;so I added the next one
(vc-dired-mode)

;3/3/9
;This is a temporary workaround until the problems between dired and VC
;can be finally fixed.  As long as vc-dired is only used on one subdir
;at a time this should work.  However, if you need to do anything with 
;dired afterwards, you may run into trouble.  Beware!
(defun dired-current-directory (&optional localp)
   "Return the name of the subdirectory to which this line belongs.
This returns a string with trailing slash, like `default-directory'.
Optional argument means return a file name relative to `default-directory'.
In this it returns \"\" for the top directory."
   (interactive)
   (if localp "./" default-directory))

))

Rodney




More information about the XEmacs-Beta mailing list