bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on


From: Eli Zaretskii
Subject: bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows
Date: Mon, 07 May 2012 20:40:12 +0300

> From: Chong Yidong <cyd@gnu.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  11348@debbugs.gnu.org
> Date: Mon, 07 May 2012 16:01:15 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> I installed the patch below, which seems to fix this specific problem
> >> (according to my testing under Wine ;-)
> >
> > I'm not sure why it worked for you, because it still doesn't for me.
> 
> I also still see the bug, running under Wine.
> 
> > IOW, the problem is that shell-parse-pcomplete-arguments removes the
> > backslash in "d:\gnu", because the last alternative in the above
> > regexp treats backslashes as escape characters, which on MS-DOS and
> > MS-Windows is true (for shell commands) only when the backslash
> > precedes a quote character (").
> 
> How about something like the following?  (Works for me on Wine with your
> test case, but I don't know if it breaks quoting.)
> 
> 
> === modified file 'lisp/shell.el'
> *** lisp/shell.el     2012-05-05 04:18:49 +0000
> --- lisp/shell.el     2012-05-07 07:59:33 +0000
> ***************
> *** 397,402 ****
> --- 397,408 ----
>                        ((null pcomplete-arg-quote-list)
>                         (goto-char (match-beginning 3)) "\\")
>                        ((= (match-beginning 3) (match-end 3)) "\\")
> +                  ;; On Windows, the backslash is an escape
> +                  ;; character only if it precedes a quote char.
> +                  ((and (memq system-type
> +                              '(ms-dos windows-nt darwin cygwin))
> +                        (not (equal (match-string 3) "\"")))
> +                   (concat "/" (match-string 3)))
>                        (t (match-string 3)))
>                       arg))
>                ((match-beginning 2)       ;Double quote.
> 

This fixes the recipe in the original bug report (I get d:\gnu/), but
again fails in this variant:

  M-! cd "d:\gnu TAB

It produces "d:\/gnu/ (with the leading quote) instead of "d:\gnu/

If I type

  M-! cd "d:/gnu TAB

I get "d:/gnu/, as expected.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]