[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: |
Sat, 05 May 2012 09:33:04 +0300 |
> 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.
- bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, (continued)
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Stefan Monnier, 2012/05/04
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Stefan Monnier, 2012/05/07
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Drew Adams, 2012/05/07
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Chong Yidong, 2012/05/07
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Stefan Monnier, 2012/05/07
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Eli Zaretskii, 2012/05/08
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Stefan Monnier, 2012/05/09
bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows, Eli Zaretskii, 2012/05/09