Subject: Re: 23.0.60; read-shell-command completion problem

From: Chong Yidong <[email-masked]>
Date: Sat, 15 Aug 2009 19:57:13 -0400

>   emacs -Q
>   M-!
>   ls d:/gnu/emacs/lisp
>
> Move point so that the cursor is on the slash between "emacs" and
> "lisp", and type TAB.  At this point, the *Completions* buffer pops up
>
>   Click <mouse-2> on a completion to select it.
>   In this buffer, type RET to select the completion near point.
>
>   Possible completions are:
>   emacs-21.4/            emacs-22-branch/      emacs-22.x/
>   emacs-23.pre-unicode/  emacs-bidi/           emacs-rtf/
>   emacs/
>
> Clicking on "emacs-22-branch/" produces this in the minibuffer:
>
>   emacs-22-branch//lisp

Could you test the following patch (admittedly a bit of a hack)?

*** trunk/lisp/simple.el.~1.1003.~	2009-08-13 10:30:54.000000000 -0400
--- trunk/lisp/simple.el	2009-08-15 19:53:04.000000000 -0400
***************
*** 5843,5849 ****
--- 5843,5857 ----
  	(if base-size
  	    (delete-region (+ base-size (field-beginning)) (point))
  	  (choose-completion-delete-max-match choice))
+ 
+ 	;; Insert the choice.  When reading a file name and the choice
+ 	;; is a directory, avoid having an extra "/" (Bug#1206).
  	(insert choice)
+ 	(and minibuffer-completing-file-name
+ 	     (looking-at "/")
+ 	     (= (aref choice (1- (length choice))) ?/)
+ 	     (delete-char 1))
+ 
  	(remove-text-properties (- (point) (length choice)) (point)
  				'(mouse-face nil))
  	;; Update point in the window that BUFFER is showing in.