unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Eli Zaretskii <eliz@gnu.org>
Cc: eli@barzilay.org, michael.albinus@gmx.de, 18515@debbugs.gnu.org
Subject: bug#18515: 24.3; Documentation of `call-process'
Date: Sun, 02 Apr 2017 12:25:52 -0400	[thread overview]
Message-ID: <87wpb2wzcf.fsf@users.sourceforge.net> (raw)
In-Reply-To: <831stareiy.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 02 Apr 2017 18:54:29 +0300")

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> >> +The process runs in `default-directory'.
>> >
>> > That's not true if `default-directory' is remote.
>> 
>> Aha, good point.  This is an important thing to document.
>
> I think at least the manual should say that the default-directory
> alluded to here is that of the buffer which is current when the
> respective functions are called.

Hmm, seems a bit obvious to me, but okay.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3463 bytes --]

From d750ec77e3f15c1cf4e94e288e097bc75904e5bd Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 1 Apr 2017 23:15:46 -0400
Subject: [PATCH v3] Mention that processes start in default-directory
 (Bug#18515)

* doc/lispref/processes.texi (Synchronous Processes):
(Asynchronous Processes):
* lisp/subr.el (start-process):
* src/callproc.c (call-process): Mention that the subprocess starts in
`default-directory' when local, suggest `start-file-process' and
`process-file' otherwise.
---
 doc/lispref/processes.texi | 13 +++++++++++--
 lisp/subr.el               |  7 ++++++-
 src/callproc.c             |  4 ++++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2a79cc781f..2acb7c99e0 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -300,8 +300,11 @@ Synchronous Processes
 @defun call-process program &optional infile destination display &rest args
 This function calls @var{program} and waits for it to finish.
 
-The current working directory of the subprocess is
-@code{default-directory}.
+The current working directory of the subprocess is set to the current
+buffer's value of @code{default-directory} if that is local (as
+determined by @code{unhandled-file-name-directory}), or "~" otherwise.
+If you want to run a process in a remote directory use
+@code{process-file}.
 
 The standard input for the new process comes from file @var{infile} if
 @var{infile} is not @code{nil}, and from the null device otherwise.
@@ -677,6 +680,12 @@ Asynchronous Processes
 
 The original argument list, modified with the actual connection
 information, is available via the @code{process-contact} function.
+
+The current working directory of the subprocess is set to the current
+buffer's value of @code{default-directory} if that is local (as
+determined by `unhandled-file-name-directory'), or "~" otherwise.  If
+you want to run a process in a remote direcotry use
+@code{start-file-process}.
 @end defun
 
 @defun make-pipe-process &rest args
diff --git a/lisp/subr.el b/lisp/subr.el
index ebac2e0ef5..472f931306 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1970,7 +1970,12 @@ start-process
 
 If you want to separate standard output from standard error, use
 `make-process' or invoke the command through a shell and redirect
-one of them using the shell syntax."
+one of them using the shell syntax.
+
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or \"~\"
+otherwise.  If you want to run a process in a remote directory
+use `start-file-process'."
   (unless (fboundp 'make-process)
     (error "Emacs was compiled without subprocess support"))
   (apply #'make-process
diff --git a/src/callproc.c b/src/callproc.c
index 6d69e13757..a781e47b17 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -240,6 +240,10 @@ t (mix it with ordinary output), or a file name string.
 and returns a numeric exit status or a signal description string.
 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
 
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or "~" otherwise.  If
+you want to run a process in a remote directory use `process-file'.
+
 usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-- 
2.11.1


  reply	other threads:[~2017-04-02 16:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-21  3:20 bug#18515: 24.3; Documentation of `call-process' Eli Barzilay
2017-04-02  3:30 ` npostavs
2017-04-02  7:24   ` Michael Albinus
2017-04-02 13:41     ` npostavs
2017-04-02 15:54       ` Eli Zaretskii
2017-04-02 16:25         ` npostavs [this message]
2017-04-06 23:20           ` npostavs

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=87wpb2wzcf.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=18515@debbugs.gnu.org \
    --cc=eli@barzilay.org \
    --cc=eliz@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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).