[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20744: shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows ca
From: |
npostavs |
Subject: |
bug#20744: shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows cannot figure out path correctly |
Date: |
Tue, 09 Aug 2016 20:51:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
retitle 20744 python.el tries to undo shell quoting with
split-string-and-unquote
tags 20744 confirmed
found 20744 25.1
quit
Da Zhang <zhangda82@gmail.com> writes:
> From: Da Zhang <zhangda82@gmail.com>
> To: bug-gnu-emacs@gnu.org
> Subject: 24.5; shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows
> cannot figure out path correctly
> --text follows this line--
>
> Dear Emacs developers/maintainers,
>
> I am writing this email to report an issue that has been bothering me
> for a while.
>
> I use python mode (python.el) for some python programming. When I invoke
> the command python-shell-send-buffer, my Emacs always reports "Searching
> for program: no such file or directory,
> c\:/Anaconda3/Scripts/ipython.exe".
>
[...]
>
> The function call
> (shell-quote-argument (executable-find python-shell-interpreter))
> changed the path of my python interpreter from
> "c:/Anaconda3/Scripts/ipython.exe"
> to
> "c\\:/Anaconda3/Scripts/ipython.exe".
>
> I worked around this problem by replacing the function call
> (shell-quote-argument (executable-find python-shell-interpreter))
> with
> (executable-find python-shell-interpreter) ;; edited by DZ on
> 2015/06/05: (shell-quote-argument) caused the problem of
> "c\\:/Anaconda3/Scripts/ipython.exe"
>
> To further analyze the problem, I found the function
> shell-quote-argument defined in subr.el does not deal with the case when
> bash from cygwin is used.
>
[...]
Actually, bash, regardless of being on cygwin or not, should have no
problem with an escaped ":". The actual problem here is that python.el
is using shell-quote-argument but then not using a shell. The result of
python-shell-calculate-command (formerly known as
python-shell-parse-command) gets passed to python-shell-make-comint as
the CMD argument:
(defun python-shell-make-comint (cmd proc-name &optional show internal)
[...]
(let* ((cmdlist (split-string-and-unquote cmd))
(buffer (apply #'make-comint-in-buffer proc-name
proc-buffer-name
interpreter nil args))
make-comint-in-buffer uses start-file-process, i.e., no shell is called.
So python.el is trying to undo shell-quote-argument with
split-string-and-unquote, this is the bug.
To see this on any system, compare
C-u M-x run-python RET 'python' -i
this fails, while
C-u M-x run-python RET "python" -i
this succeeds (assuming you have python in exec-path).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#20744: shell-quote-argument in Emacs 24.5 and Emacs 25 on Windows cannot figure out path correctly,
npostavs <=