From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Shuguang Sun Newsgroups: gmane.emacs.devel Subject: Re: Patch of shell-command-to-string in simple for tramp support Date: Thu, 25 Jan 2018 22:11:41 +0800 Message-ID: References: <87efme5bne.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114e70bae8ffe905639a5b04" X-Trace: blaine.gmane.org 1516889842 11551 195.159.176.226 (25 Jan 2018 14:17:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 25 Jan 2018 14:17:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 25 15:17:18 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eeiL7-0002iO-5w for ged-emacs-devel@m.gmane.org; Thu, 25 Jan 2018 15:17:17 +0100 Original-Received: from localhost ([::1]:42797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeiN7-00052j-NN for ged-emacs-devel@m.gmane.org; Thu, 25 Jan 2018 09:19:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeiFj-000067-GK for emacs-devel@gnu.org; Thu, 25 Jan 2018 09:11:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeiFi-0006hK-BS for emacs-devel@gnu.org; Thu, 25 Jan 2018 09:11:43 -0500 Original-Received: from mail-qt0-x22f.google.com ([2607:f8b0:400d:c0d::22f]:37934) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeiFi-0006gV-5z for emacs-devel@gnu.org; Thu, 25 Jan 2018 09:11:42 -0500 Original-Received: by mail-qt0-x22f.google.com with SMTP id z10so19456601qti.5 for ; Thu, 25 Jan 2018 06:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JMUjpRQfr4mNjnPYeob9kDLODQdsQUwtnYL65rr3aRg=; b=PHsfT/rk0zimg4oUpTzW0vUy8CvbOTfK74ItTP7H4+U5LOmKURMWOxl6x+KuP3P9P2 itl9ZvFEaOCiVliNk1KrSOSMisGLhuj4aPsu5ycV9JjVDBjyBdvhAZFo8jd0E+8vfOiQ UWtHy3q+TY9n67Aju57n+yKqWvBcniudFlIQl1cTxL8X+LyGwnaXZtXB9GyvvBJF0tex 4NWekW8KDvPJsiZ25g2D6gcP+pIs47QqMaPlhgHK4u9wBYuyvu3if4/Gyt+Z1/TCJKxz ItslNesZSQg0F0QNAcFrRmj6jiAX85BF6u7abZcQ3qZ9YxOxiLilafYspEwRwoCvoKdv A7fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JMUjpRQfr4mNjnPYeob9kDLODQdsQUwtnYL65rr3aRg=; b=pkzYuwqf8ptr6cmgIWvYNuMEyxAIyUjmXrbuqIg1lQL9Qx4WmOC3NdKMRj2IbTom2d WqHJ+qo+2YhqpU193E+PLm1KeqsHhoYWm7c/JY/Uu9mTnNNB4xvd68NRUHf+hLsim5Fo u95/KDJvuWaOeZ4Zo5DMx5QTZ2d9Rvyg96Hi0rej2m9uJKH5+m+nJQlS0gdP7P1Af7q0 gOOv8NnE2k1lwRERrIwKTGuZ86g5dTg4sKLLSlD+BZNgMJvOqz3uHKy9L9FdJpuPBkNV pwH85/sEkZP/Zgq/5oSigTZR0lt+EO9LLZbGsUJRjLDtNOlnBuTSPjEtc1REC5n0NKyY a05w== X-Gm-Message-State: AKwxytdcvjEybueOFFyqbEhTGROpl7yGbqp/kxcukHx2P8zjerrIbH8O 2sQjUabN1hWQZ2K/7AFYvvHgx/WbLhDYhJDaX3k= X-Google-Smtp-Source: AH8x224NQ5Qdio94WLQMoj8lWbPofYhQuhk6C4CE9EZ6j4dIcXgCjMLsrFs+RVMZKmv2XwAtLJl1Dyz4+R7NY73TrAo= X-Received: by 10.55.87.70 with SMTP id l67mr14265307qkb.319.1516889501661; Thu, 25 Jan 2018 06:11:41 -0800 (PST) Original-Received: by 10.237.58.227 with HTTP; Thu, 25 Jan 2018 06:11:41 -0800 (PST) In-Reply-To: <87efme5bne.fsf@gmx.de> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222228 Archived-At: --001a114e70bae8ffe905639a5b04 Content-Type: text/plain; charset="UTF-8" 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. > --001a114e70bae8ffe905639a5b04 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It works as I expected.
Thanks.

On Thu, Jan 2= 5, 2018 at 9:08 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
Shuguang Sun <shuguang@gmail.com> 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 borr= ow
> 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-aw= are. 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
=C2=A0 =C2=A0(with-output-to-string
=C2=A0 =C2=A0 =C2=A0(with-current-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0standard-output
-=C2=A0 =C2=A0 =C2=A0 (process-file shell-file-name nil t nil shell-command= -switch command))))
+=C2=A0 =C2=A0 =C2=A0 (shell-command command t))))

=C2=A0(defun process-file (program &optional infile buffer display &= ;rest args)
=C2=A0 =C2=A0"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.

--001a114e70bae8ffe905639a5b04--