unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 11348@debbugs.gnu.org
Subject: bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows
Date: Sat, 05 May 2012 09:33:04 +0300	[thread overview]
Message-ID: <83fwbf5e8v.fsf@gnu.org> (raw)
In-Reply-To: <jwv8vh79tx4.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 11348@debbugs.gnu.org
> Date: Sat, 05 May 2012 00:20:17 -0400
> 
> >> This said, based on your description, the problem may simply come from
> >> shell.el's setting of pcomplete-arg-quote-list which tells pcomplete
> >> that \ is an escape char.
> >> I.e. does the patch below fix the problem?
> > No, I still get "d:\/gnu/".
> 
> 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.
Are you applying the changes to the emacs-24 branch?  Because that's
what I do, this bug being against Emacs 24.0.96 and a regression from
Emacs 23.4.

According to my debugging inside shell-parse-pcomplete-arguments, what
happens there is that this fragment

          (while (looking-at
                  (eval-when-compile
                    (concat
                     "\\(?:[^\s\t\n\\\"']+"
                     "\\|'\\([^']*\\)'?"
                     "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
                     "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))

decides that \g is an escape sequence.  (Btw, what's the purpose of
using eval-when-compile here?)  Therefore, the value of args at the
end of the loop is

   ("nu" "g" "d:")

After this line:

          (push (mapconcat #'identity (nreverse arg) "") args)))

it becomes

   ("d:" "g" "nu")

and the result of the function is therefore

   (("cd" "d:gnu") 16 19)

By contrast, if I type "M-! cd d:/gnu TAB", the results are,
correspondingly,

   ("d:/gnu")

and

   (("cd" "d:/gnu") 16 19)

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 (").

Thanks.





  reply	other threads:[~2012-05-05  6:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 11:09 bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows Eli Zaretskii
2012-05-04  7:10 ` Eli Zaretskii
2012-05-04 14:29   ` Chong Yidong
2012-05-04 14:54     ` Eli Zaretskii
2012-05-04 15:07       ` Drew Adams
2012-05-04 15:36       ` Chong Yidong
2012-05-04 15:02     ` Eli Zaretskii
2012-05-04 15:46       ` Chong Yidong
2012-05-04 17:01         ` Eli Zaretskii
2012-05-04 17:59 ` Stefan Monnier
2012-05-04 18:15   ` Eli Zaretskii
2012-05-04 23:32     ` Stefan Monnier
2012-05-05  0:22       ` Drew Adams
2012-05-05 12:47       ` Eli Zaretskii
2012-05-05  4:20     ` Stefan Monnier
2012-05-05  6:33       ` Eli Zaretskii [this message]
2012-05-07  8:01         ` Chong Yidong
2012-05-07 17:40           ` Eli Zaretskii
2012-05-07 15:27         ` Stefan Monnier
2012-05-07 15:44           ` Drew Adams
2012-05-07 16:11           ` Chong Yidong
2012-05-08  0:27             ` Stefan Monnier
2012-05-08 18:56               ` Eli Zaretskii
2012-05-09 17:22                 ` Stefan Monnier
2012-05-09 18:07                   ` Eli Zaretskii

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=83fwbf5e8v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=11348@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).