all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18515: 24.3; Documentation of `call-process'
@ 2014-09-21  3:20 Eli Barzilay
  2017-04-02  3:30 ` npostavs
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Barzilay @ 2014-09-21  3:20 UTC (permalink / raw)
  To: 18515

The documentation of `call-process' doesn't say anything about which
directory the process is started at, or the fact that it switches to
the directory in some way.

As the example that I ran into, I setq `ring-bell-function' in my
environment so it plays a nice ding.  In some cases the dings didn't
play at all, or played after a huge delay etc.  Since this is running
in a VM, I "obviously" concluded that something bad with the sound
driver configuration happened, and went on a wild chase that lead to
nothing.

Eventually, I noticed that the delay happens only when I have a file
open over sshfs -- and then I wrapped the `call-process' with a
(let ((default-directory "/")) ...) and all is well.  A note about
switching to the directory in the documentation of `call-process', or
even just a mention of the directory in which it runs could have saved
me that chase...

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18515: 24.3; Documentation of `call-process'
  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
  0 siblings, 1 reply; 7+ messages in thread
From: npostavs @ 2017-04-02  3:30 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 18515

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

tags 18515 patch
quit

Eli Barzilay <eli@barzilay.org> writes:
>
> Eventually, I noticed that the delay happens only when I have a file
> open over sshfs -- and then I wrapped the `call-process' with a
> (let ((default-directory "/")) ...) and all is well.  A note about
> switching to the directory in the documentation of `call-process', or
> even just a mention of the directory in which it runs could have saved
> me that chase...

It's easy enough to add that of course, though I wonder if it really
would have helped.  What other directory would the process run in?



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

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

* lisp/subr.el (start-process):
* src/callproc.c (call-process): Mention that process starts in
`default-directory'.
---
 lisp/subr.el   | 4 +++-
 src/callproc.c | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index ebac2e0ef5..0c9c852370 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1970,7 +1970,9 @@ 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'."
   (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..1c37fa7054 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -239,6 +239,7 @@ t (mix it with ordinary output), or a file name string.
 Otherwise it waits for PROGRAM to terminate
 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'.
 
 usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
-- 
2.11.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#18515: 24.3; Documentation of `call-process'
  2017-04-02  3:30 ` npostavs
@ 2017-04-02  7:24   ` Michael Albinus
  2017-04-02 13:41     ` npostavs
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Albinus @ 2017-04-02  7:24 UTC (permalink / raw)
  To: npostavs; +Cc: Eli Barzilay, 18515

npostavs@users.sourceforge.net writes:

> --- a/src/callproc.c
> +++ b/src/callproc.c
> @@ -239,6 +239,7 @@ t (mix it with ordinary output), or a file name string.
>  Otherwise it waits for PROGRAM to terminate
>  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'.

That's not true if `default-directory' is remote.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18515: 24.3; Documentation of `call-process'
  2017-04-02  7:24   ` Michael Albinus
@ 2017-04-02 13:41     ` npostavs
  2017-04-02 15:54       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: npostavs @ 2017-04-02 13:41 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Eli Barzilay, 18515

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

retitle 18515 Document call-process behaviour with respect to default-directory
quit

Michael Albinus <michael.albinus@gmx.de> 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.


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

From 6c450de9b474f1eb6255f8474b3dc5c5be81b9c7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 1 Apr 2017 23:15:46 -0400
Subject: [PATCH v2] 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 | 9 ++++++++-
 lisp/subr.el               | 7 ++++++-
 src/callproc.c             | 4 ++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2a79cc781f..c76ca025d9 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -301,7 +301,9 @@ Synchronous Processes
 This function calls @var{program} and waits for it to finish.
 
 The current working directory of the subprocess is
-@code{default-directory}.
+@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 +679,11 @@ 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
+@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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#18515: 24.3; Documentation of `call-process'
  2017-04-02 13:41     ` npostavs
@ 2017-04-02 15:54       ` Eli Zaretskii
  2017-04-02 16:25         ` npostavs
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-04-02 15:54 UTC (permalink / raw)
  To: npostavs; +Cc: eli, michael.albinus, 18515

> From: npostavs@users.sourceforge.net
> Date: Sun, 02 Apr 2017 09:41:48 -0400
> Cc: Eli Barzilay <eli@barzilay.org>, 18515@debbugs.gnu.org
> 
> retitle 18515 Document call-process behaviour with respect to default-directory
> quit
> 
> Michael Albinus <michael.albinus@gmx.de> 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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#18515: 24.3; Documentation of `call-process'
  2017-04-02 15:54       ` Eli Zaretskii
@ 2017-04-02 16:25         ` npostavs
  2017-04-06 23:20           ` npostavs
  0 siblings, 1 reply; 7+ messages in thread
From: npostavs @ 2017-04-02 16:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eli, michael.albinus, 18515

[-- 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#18515: 24.3; Documentation of `call-process'
  2017-04-02 16:25         ` npostavs
@ 2017-04-06 23:20           ` npostavs
  0 siblings, 0 replies; 7+ messages in thread
From: npostavs @ 2017-04-06 23:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eli, michael.albinus, 18515

tags 18515 fixed
close 18515 25.2
quit

npostavs@users.sourceforge.net writes:

> 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.

Pushed to emacs-25 [1: c7ed57eaef].

1: 2017-04-06 18:50:54 -0400 c7ed57eaef46ed74ce926fc05dec9eaa5737f3d9
  Mention that processes start in default-directory (Bug#18515)






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-06 23:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-04-06 23:20           ` npostavs

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.