Next: , Previous: , Up: Creating Synchronous Subprocesses   [Index]


I.1.2.7 process-file

Function: process-file program &optional infile buffer display &rest args

This function processes files synchronously in a separate process. It is similar to call-process, but may invoke a file handler based on the value of the variable default-directory, which specifies the current working directory of the subprocess.

The arguments are handled in almost the same way as for call-process, with the following differences:

  1. Some file handlers may not support all combinations and forms of the arguments INFILE, BUFFER, and DISPLAY. For example, some file handlers might behave as if DISPLAY were ‘nil’, regardless of the value actually passed. As another example, some file handlers might not support separating standard output and error output by way of the BUFFER argument.
  2. If a file handler is invoked, it determines the program to run based on the first argument PROGRAM. For instance, suppose that a handler for remote files is invoked. Then the path that is used for searching for the program might be different from ‘exec-path’.
  3. The second argument INFILE may invoke a file handler. The file handler could be different from the handler chosen for the ‘process-file’ function itself. (For example, ‘default-directory’ could be on one remote host, and INFILE on a different remote host. Or ‘default-directory’ could be non-special, whereas INFILE is on a remote host.)
  4. If BUFFER is a list of the form ‘(REAL-DESTINATION ERROR-DESTINATION)’, and ERROR-DESTINATION names a file, then the same remarks as for INFILE apply.
  5. The remaining arguments (ARGS) will be passed to the process verbatim. Emacs is not involved in processing file names that are present in ARGS. To avoid confusion, it may be best to avoid absolute file names in ARGS, but rather to specify all file names as relative to ‘default-directory’. The function ‘file-relative-name’ is useful for constructing such relative file names. Alternatively, you can use ‘file-local-name’ (*note Magic File Names::) to obtain an absolute file name as seen from the remote host’s perspective.

Next: process-file-shell-command, Previous: process-lines, Up: Creating Synchronous Subprocesses   [Index]