It works as I expected. Thanks. On Thu, Jan 25, 2018 at 9:08 PM, Michael Albinus wrote: > Shuguang Sun writes: > > > Hi, > > Hi Shuguang, > > > The shell-command-to-string calls shell-file-name directly and it > > doesn't work in the case of local Windows and remoter Unix. I borrow > > the some code from shell.el and make a patch to simple.el. > > I believe it is wrong to make `shell-command-to-string' Tramp-aware. We > have `shell-command', which runs a (Tramp) file name handler if > needed. The proper change should be: > > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/simple.el b/lisp/simple.el > index e51bc132a6..44f738f07e 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -3844,7 +3844,7 @@ shell-command-to-string > (with-output-to-string > (with-current-buffer > standard-output > - (process-file shell-file-name nil t nil shell-command-switch > command)))) > + (shell-command command t)))) > > (defun process-file (program &optional infile buffer display &rest args) > "Process files synchronously in a separate process. > --8<---------------cut here---------------end--------------->8--- > > Could you, pls, test it in your environment? > > > Best Regards, > > Shuguang > > Best regards, Michael. >