aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-04-14 18:37:16 -0700
committerGlenn Morris2012-04-14 18:37:16 -0700
commite153c136436ff5eb106e51284914cb580ba23774 (patch)
tree85e43039f7d4cc83ca3924a3ca015da190e32e84
parent764a3017e2f66af637a3642734e5153eae02b4ef (diff)
downloademacs-e153c136436ff5eb106e51284914cb580ba23774.tar.gz
emacs-e153c136436ff5eb106e51284914cb580ba23774.zip
Doc and manual fixes related to processes
* doc/lispref/processes.texi (Processes, Subprocess Creation, Shell Arguments): (Synchronous Processes): Copyedits. (Subprocess Creation): Discourage modifying exec-path directly. (Synchronous Processes): Update some example output. (Process Information): Fix typo. (Bindat Spec): Use Texinfo-recommended form of quote+punctuation. * lisp/simple.el (process-file-side-effects): Doc fix.
-rw-r--r--doc/lispref/ChangeLog9
-rw-r--r--doc/lispref/processes.texi91
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/simple.el10
4 files changed, 69 insertions, 45 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 61130316461..fd531721553 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,12 @@
12012-04-15 Glenn Morris <rgm@gnu.org>
2
3 * processes.texi (Processes, Subprocess Creation, Shell Arguments):
4 (Synchronous Processes): Copyedits.
5 (Subprocess Creation): Discourage modifying exec-path directly.
6 (Synchronous Processes): Update some example output.
7 (Process Information): Fix typo.
8 (Bindat Spec): Use Texinfo-recommended form of quote+punctuation.
9
12012-04-14 Glenn Morris <rgm@gnu.org> 102012-04-14 Glenn Morris <rgm@gnu.org>
2 11
3 * anti.texi (Antinews): Copyedits. Don't @dfn anything here. 12 * anti.texi (Antinews): Copyedits. Don't @dfn anything here.
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 1b788684d4b..0f1c291bdcd 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -23,7 +23,7 @@ subprocess, the Lisp program waits for the subprocess to terminate
23before continuing execution. When you create an asynchronous 23before continuing execution. When you create an asynchronous
24subprocess, it can run in parallel with the Lisp program. This kind of 24subprocess, it can run in parallel with the Lisp program. This kind of
25subprocess is represented within Emacs by a Lisp object which is also 25subprocess is represented within Emacs by a Lisp object which is also
26called a ``process.'' Lisp programs can use this object to communicate 26called a ``process''. Lisp programs can use this object to communicate
27with the subprocess or to control it. For example, you can send 27with the subprocess or to control it. For example, you can send
28signals, obtain status information, receive output from the process, or 28signals, obtain status information, receive output from the process, or
29send input to it. 29send input to it.
@@ -70,7 +70,9 @@ a program. One of them, @code{start-process}, creates an asynchronous
70process and returns a process object (@pxref{Asynchronous Processes}). 70process and returns a process object (@pxref{Asynchronous Processes}).
71The other two, @code{call-process} and @code{call-process-region}, 71The other two, @code{call-process} and @code{call-process-region},
72create a synchronous process and do not return a process object 72create a synchronous process and do not return a process object
73(@pxref{Synchronous Processes}). 73(@pxref{Synchronous Processes}). There are various higher-level
74functions that make use of these primitives to run particular types of
75process.
74 76
75 Synchronous and asynchronous processes are explained in the following 77 Synchronous and asynchronous processes are explained in the following
76sections. Since the three functions are all called in a similar 78sections. Since the three functions are all called in a similar
@@ -104,16 +106,19 @@ system-dependent.
104 106
105 @strong{Please note:} The argument @var{program} contains only the 107 @strong{Please note:} The argument @var{program} contains only the
106name of the program; it may not contain any command-line arguments. You 108name of the program; it may not contain any command-line arguments. You
107must use @var{args} to provide those. 109must use a separate argument, @var{args}, to provide those, as
110described below.
108 111
109 Each of the subprocess-creating functions has a @var{buffer-or-name} 112 Each of the subprocess-creating functions has a @var{buffer-or-name}
110argument which specifies where the standard output from the program will 113argument that specifies where the standard output from the program will
111go. It should be a buffer or a buffer name; if it is a buffer name, 114go. It should be a buffer or a buffer name; if it is a buffer name,
112that will create the buffer if it does not already exist. It can also 115that will create the buffer if it does not already exist. It can also
113be @code{nil}, which says to discard the output unless a filter function 116be @code{nil}, which says to discard the output unless a filter function
114handles it. (@xref{Filter Functions}, and @ref{Read and Print}.) 117handles it. (@xref{Filter Functions}, and @ref{Read and Print}.)
115Normally, you should avoid having multiple processes send output to the 118Normally, you should avoid having multiple processes send output to the
116same buffer because their output would be intermixed randomly. 119same buffer because their output would be intermixed randomly.
120For synchronous processes, you can send the output to a file instead
121of a buffer.
117 122
118@cindex program arguments 123@cindex program arguments
119 All three of the subprocess-creating functions have a @code{&rest} 124 All three of the subprocess-creating functions have a @code{&rest}
@@ -122,18 +127,16 @@ supplied to @var{program} as separate command line arguments. Wildcard
122characters and other shell constructs have no special meanings in these 127characters and other shell constructs have no special meanings in these
123strings, since the strings are passed directly to the specified program. 128strings, since the strings are passed directly to the specified program.
124 129
125 The subprocess gets its current directory from the value of
126@code{default-directory} (@pxref{File Name Expansion}).
127
128@cindex environment variables, subprocesses 130@cindex environment variables, subprocesses
129 The subprocess inherits its environment from Emacs, but you can 131 The subprocess inherits its environment from Emacs, but you can
130specify overrides for it with @code{process-environment}. @xref{System 132specify overrides for it with @code{process-environment}. @xref{System
131Environment}. 133Environment}. The subprocess gets its current directory from the
134value of @code{default-directory}.
132 135
133@defvar exec-directory 136@defvar exec-directory
134@pindex movemail 137@pindex movemail
135The value of this variable is a string, the name of a directory that 138The value of this variable is a string, the name of a directory that
136contains programs that come with GNU Emacs, programs intended for Emacs 139contains programs that come with GNU Emacs and are intended for Emacs
137to invoke. The program @code{movemail} is an example of such a program; 140to invoke. The program @code{movemail} is an example of such a program;
138Rmail uses it to fetch new mail from an inbox. 141Rmail uses it to fetch new mail from an inbox.
139@end defvar 142@end defvar
@@ -148,6 +151,11 @@ directory (which is the value of @code{default-directory}).
148The value of @code{exec-path} is used by @code{call-process} and 151The value of @code{exec-path} is used by @code{call-process} and
149@code{start-process} when the @var{program} argument is not an absolute 152@code{start-process} when the @var{program} argument is not an absolute
150file name. 153file name.
154
155Generally, you should not modify @code{exec-path} directly. Instead,
156ensure that your @env{PATH} environment variable is set appropriately
157before starting Emacs. Trying to modify @code{exec-path}
158independently of @env{PATH} can lead to confusing results.
151@end defopt 159@end defopt
152 160
153@node Shell Arguments 161@node Shell Arguments
@@ -163,7 +171,7 @@ occur in the file name, they will confuse the shell. To handle these
163characters, use the function @code{shell-quote-argument}: 171characters, use the function @code{shell-quote-argument}:
164 172
165@defun shell-quote-argument argument 173@defun shell-quote-argument argument
166This function returns a string which represents, in shell syntax, 174This function returns a string that represents, in shell syntax,
167an argument whose actual contents are @var{argument}. It should 175an argument whose actual contents are @var{argument}. It should
168work reliably to concatenate the return value into a shell command 176work reliably to concatenate the return value into a shell command
169and then pass it to a shell for execution. 177and then pass it to a shell for execution.
@@ -201,10 +209,10 @@ a shell command:
201 The following two functions are useful for combining a list of 209 The following two functions are useful for combining a list of
202individual command-line argument strings into a single string, and 210individual command-line argument strings into a single string, and
203taking a string apart into a list of individual command-line 211taking a string apart into a list of individual command-line
204arguments. These functions are mainly intended to be used for 212arguments. These functions are mainly intended for
205converting user input in the minibuffer, a Lisp string, into a list of 213converting user input in the minibuffer, a Lisp string, into a list of
206string arguments to be passed to @code{call-process} or 214string arguments to be passed to @code{call-process} or
207@code{start-process}, or for the converting such lists of arguments in 215@code{start-process}, or for converting such lists of arguments into
208a single Lisp string to be presented in the minibuffer or echo area. 216a single Lisp string to be presented in the minibuffer or echo area.
209 217
210@defun split-string-and-unquote string &optional separators 218@defun split-string-and-unquote string &optional separators
@@ -345,7 +353,7 @@ In the examples below, the buffer @samp{foo} is current.
345 @result{} 0 353 @result{} 0
346 354
347---------- Buffer: foo ---------- 355---------- Buffer: foo ----------
348/usr/user/lewis/manual 356/home/lewis/manual
349---------- Buffer: foo ---------- 357---------- Buffer: foo ----------
350@end group 358@end group
351 359
@@ -354,18 +362,18 @@ In the examples below, the buffer @samp{foo} is current.
354 @result{} 0 362 @result{} 0
355 363
356---------- Buffer: bar ---------- 364---------- Buffer: bar ----------
357lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh 365lewis:x:1001:1001:Bil Lewis,,,,:/home/lewis:/bin/bash
358 366
359---------- Buffer: bar ---------- 367---------- Buffer: bar ----------
360@end group 368@end group
361@end smallexample 369@end smallexample
362 370
363Here is a good example of the use of @code{call-process}, which used to 371Here is an example of the use of @code{call-process}, as used to
364be found in the definition of @code{insert-directory}: 372be found in the definition of the @code{insert-directory} function:
365 373
366@smallexample 374@smallexample
367@group 375@group
368(call-process insert-directory-program nil t nil @var{switches} 376(call-process insert-directory-program nil t nil switches
369 (if full-directory-p 377 (if full-directory-p
370 (concat (file-name-as-directory file) ".") 378 (concat (file-name-as-directory file) ".")
371 file)) 379 file))
@@ -375,9 +383,9 @@ be found in the definition of @code{insert-directory}:
375 383
376@defun process-file program &optional infile buffer display &rest args 384@defun process-file program &optional infile buffer display &rest args
377This function processes files synchronously in a separate process. It 385This function processes files synchronously in a separate process. It
378is similar to @code{call-process} but may invoke a file handler based 386is similar to @code{call-process}, but may invoke a file handler based
379on the value of the variable @code{default-directory}. The current 387on the value of the variable @code{default-directory}, which specifies
380working directory of the subprocess is @code{default-directory}. 388the current working directory of the subprocess.
381 389
382The arguments are handled in almost the same way as for 390The arguments are handled in almost the same way as for
383@code{call-process}, with the following differences: 391@code{call-process}, with the following differences:
@@ -390,15 +398,15 @@ file handlers might not support separating standard output and error
390output by way of the @var{buffer} argument. 398output by way of the @var{buffer} argument.
391 399
392If a file handler is invoked, it determines the program to run based 400If a file handler is invoked, it determines the program to run based
393on the first argument @var{program}. For instance, consider that a 401on the first argument @var{program}. For instance, suppose that a
394handler for remote files is invoked. Then the path that is used for 402handler for remote files is invoked. Then the path that is used for
395searching the program might be different than @code{exec-path}. 403searching for the program might be different from @code{exec-path}.
396 404
397The second argument @var{infile} may invoke a file handler. The file 405The second argument @var{infile} may invoke a file handler. The file
398handler could be different from the handler chosen for the 406handler could be different from the handler chosen for the
399@code{process-file} function itself. (For example, 407@code{process-file} function itself. (For example,
400@code{default-directory} could be on a remote host, whereas 408@code{default-directory} could be on one remote host, and
401@var{infile} is on another remote host. Or @code{default-directory} 409@var{infile} on a different remote host. Or @code{default-directory}
402could be non-special, whereas @var{infile} is on a remote host.) 410could be non-special, whereas @var{infile} is on a remote host.)
403 411
404If @var{buffer} is a list of the form @code{(@var{real-destination} 412If @var{buffer} is a list of the form @code{(@var{real-destination}
@@ -415,16 +423,16 @@ file names.
415@end defun 423@end defun
416 424
417@defvar process-file-side-effects 425@defvar process-file-side-effects
418This variable indicates, whether a call of @code{process-file} changes 426This variable indicates whether a call of @code{process-file} changes
419remote files. 427remote files.
420 428
421Per default, this variable is always set to @code{t}, meaning that a 429By default, this variable is always set to @code{t}, meaning that a
422call of @code{process-file} could potentially change any file on a 430call of @code{process-file} could potentially change any file on a
423remote host. When set to @code{nil}, a file handler could optimize 431remote host. When set to @code{nil}, a file handler could optimize
424its behavior with respect to remote file attributes caching. 432its behavior with respect to remote file attribute caching.
425 433
426This variable should never be changed by @code{setq}. Instead of, it 434You should only ever change this variable with a let-binding; never
427shall be set only by let-binding. 435with @code{setq}.
428@end defvar 436@end defvar
429 437
430@defun call-process-region start end program &optional delete destination display &rest args 438@defun call-process-region start end program &optional delete destination display &rest args
@@ -440,7 +448,7 @@ as it comes in. For details, see the description of
440@code{call-process}, above. If @var{destination} is the integer 0, 448@code{call-process}, above. If @var{destination} is the integer 0,
441@code{call-process-region} discards the output and returns @code{nil} 449@code{call-process-region} discards the output and returns @code{nil}
442immediately, without waiting for the subprocess to finish (this only 450immediately, without waiting for the subprocess to finish (this only
443works if asynchronous subprocesses are supported). 451works if asynchronous subprocesses are supported; i.e. not on MS-DOS).
444 452
445The remaining arguments, @var{args}, are strings that specify command 453The remaining arguments, @var{args}, are strings that specify command
446line arguments for the program. 454line arguments for the program.
@@ -474,18 +482,18 @@ inputinput@point{}
474@end group 482@end group
475@end smallexample 483@end smallexample
476 484
477 The @code{shell-command-on-region} command uses 485 For example, the @code{shell-command-on-region} command uses
478@code{call-process-region} like this: 486@code{call-process-region} in a manner similar to this:
479 487
480@smallexample 488@smallexample
481@group 489@group
482(call-process-region 490(call-process-region
483 start end 491 start end
484 shell-file-name ; @r{Name of program.} 492 shell-file-name ; @r{name of program}
485 nil ; @r{Do not delete region.} 493 nil ; @r{do not delete region}
486 buffer ; @r{Send output to @code{buffer}.} 494 buffer ; @r{send output to @code{buffer}}
487 nil ; @r{No redisplay during output.} 495 nil ; @r{no redisplay during output}
488 "-c" command) ; @r{Arguments for the shell.} 496 "-c" command) ; @r{arguments for the shell}
489@end group 497@end group
490@end smallexample 498@end smallexample
491@end defun 499@end defun
@@ -508,6 +516,9 @@ This function executes @var{command} (a string) as a shell command,
508then returns the command's output as a string. 516then returns the command's output as a string.
509@end defun 517@end defun
510 518
519@c There is also shell-command-on-region, but that is more of a user
520@c command, not something to use in programs.
521
511@defun process-lines program &rest args 522@defun process-lines program &rest args
512This function runs @var{program}, waits for it to finish, and returns 523This function runs @var{program}, waits for it to finish, and returns
513its output as a list of strings. Each string in the list holds a 524its output as a list of strings. Each string in the list holds a
@@ -864,7 +875,7 @@ closed the connection, or Emacs did @code{delete-process}.
864@end defun 875@end defun
865 876
866@defun process-live-p process 877@defun process-live-p process
867This function returns nin-@code{nil} if @var{process} is alive. A 878This function returns non-@code{nil} if @var{process} is alive. A
868process is considered alive if its status is @code{run}, @code{open}, 879process is considered alive if its status is @code{run}, @code{open},
869@code{listen}, @code{connect} or @code{stop}. 880@code{listen}, @code{connect} or @code{stop}.
870@end defun 881@end defun
@@ -2662,7 +2673,7 @@ specification}, a special nested list describing named and typed
2662@dfn{fields}. This specification controls length of each field to be 2673@dfn{fields}. This specification controls length of each field to be
2663processed, and how to pack or unpack it. We normally keep bindat specs 2674processed, and how to pack or unpack it. We normally keep bindat specs
2664in variables whose names end in @samp{-bindat-spec}; that kind of name 2675in variables whose names end in @samp{-bindat-spec}; that kind of name
2665is automatically recognized as ``risky.'' 2676is automatically recognized as ``risky''.
2666 2677
2667@cindex endianness 2678@cindex endianness
2668@cindex big endian 2679@cindex big endian
@@ -2672,7 +2683,7 @@ is automatically recognized as ``risky.''
2672that the field represents and, in the case of multibyte fields, how 2683that the field represents and, in the case of multibyte fields, how
2673the bytes are ordered within the field. The two possible orderings 2684the bytes are ordered within the field. The two possible orderings
2674are ``big endian'' (also known as ``network byte ordering'') and 2685are ``big endian'' (also known as ``network byte ordering'') and
2675``little endian.'' For instance, the number @code{#x23cd} (decimal 2686``little endian''. For instance, the number @code{#x23cd} (decimal
26769165) in big endian would be the two bytes @code{#x23} @code{#xcd}; 26879165) in big endian would be the two bytes @code{#x23} @code{#xcd};
2677and in little endian, @code{#xcd} @code{#x23}. Here are the possible 2688and in little endian, @code{#xcd} @code{#x23}. Here are the possible
2678type values: 2689type values:
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 94e9044b2d6..8c9f5b9f035 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12012-04-15 Glenn Morris <rgm@gnu.org>
2
3 * simple.el (process-file-side-effects): Doc fix.
4
12012-04-14 Glenn Morris <rgm@gnu.org> 52012-04-14 Glenn Morris <rgm@gnu.org>
2 6
3 * international/mule-cmds.el (set-language-environment): Doc fix. 7 * international/mule-cmds.el (set-language-environment): Doc fix.
diff --git a/lisp/simple.el b/lisp/simple.el
index c345734c37b..0ee19b71636 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1,6 +1,6 @@
1;;; simple.el --- basic editing commands for Emacs 1;;; simple.el --- basic editing commands for Emacs
2 2
3;; Copyright (C) 1985-1987, 1993-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1985-1987, 1993-2012 Free Software Foundation, Inc.
4 4
5;; Maintainer: FSF 5;; Maintainer: FSF
6;; Keywords: internal 6;; Keywords: internal
@@ -2677,13 +2677,13 @@ value passed."
2677(defvar process-file-side-effects t 2677(defvar process-file-side-effects t
2678 "Whether a call of `process-file' changes remote files. 2678 "Whether a call of `process-file' changes remote files.
2679 2679
2680Per default, this variable is always set to `t', meaning that a 2680By default, this variable is always set to `t', meaning that a
2681call of `process-file' could potentially change any file on a 2681call of `process-file' could potentially change any file on a
2682remote host. When set to `nil', a file handler could optimize 2682remote host. When set to `nil', a file handler could optimize
2683its behavior with respect to remote file attributes caching. 2683its behavior with respect to remote file attribute caching.
2684 2684
2685This variable should never be changed by `setq'. Instead of, it 2685You should only ever change this variable with a let-binding;
2686shall be set only by let-binding.") 2686never with `setq'.")
2687 2687
2688(defun start-file-process (name buffer program &rest program-args) 2688(defun start-file-process (name buffer program &rest program-args)
2689 "Start a program in a subprocess. Return the process object for it. 2689 "Start a program in a subprocess. Return the process object for it.