Handle `make-process' in Tramp and ange-ftp
* doc/lispref/processes.texi (Asynchronous Processes): Explain, that not all file name handlers support `make-process'. * lisp/net/ange-ftp.el: * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): * lisp/net/tramp.el (tramp-file-name-for-operation): Add `make-process'. * lisp/vc/ediff-util.el: * src/process.c: * test/src/process-tests.el: Use "file name handler" consequently.
This commit is contained in:
parent
072b4c679d
commit
3ea89acac2
13 changed files with 32 additions and 15 deletions
|
@ -700,8 +700,8 @@ output, and both are sent to @var{buffer} or @var{filter}.
|
|||
@item :file-handler @var{file-handler}
|
||||
If @var{file-handler} is non-@code{nil}, then look for a file name
|
||||
handler for the current buffer's @code{default-directory}, and invoke
|
||||
that file handler to make the process. If there is no such handler,
|
||||
proceed as if @var{file-handler} were @code{nil}.
|
||||
that file name handler to make the process. If there is no such
|
||||
handler, proceed as if @var{file-handler} were @code{nil}.
|
||||
@end table
|
||||
|
||||
The original argument list, modified with the actual connection
|
||||
|
@ -709,9 +709,18 @@ 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 directory, pass
|
||||
@code{:file-handler t} to @code{make-process}.
|
||||
determined by @code{unhandled-file-name-directory}), or @file{~}
|
||||
otherwise. If you want to run a process in a remote directory, pass
|
||||
@code{:file-handler t} to @code{make-process}. In that case, the
|
||||
current working directory is the local name component of
|
||||
@code{default-directory} (as determined by @code{file-local-name}).
|
||||
|
||||
Depending on the implementation of the file name handler, it might not
|
||||
be possible to apply @var{filter} or @var{sentinel} to the resulting
|
||||
process object. @xref{Filter Functions}, and @ref{Sentinels}.
|
||||
|
||||
Some file name handlers may not support @code{make-process}. In such
|
||||
cases, this function does nothing and returns @code{nil}.
|
||||
@end defun
|
||||
|
||||
@defun make-pipe-process &rest args
|
||||
|
|
|
@ -4441,10 +4441,11 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
|
|||
|
||||
;; We can handle process-file in a restricted way (just for chown).
|
||||
;; Nothing possible for `start-file-process'.
|
||||
(put 'exec-path 'ange-ftp 'ignore)
|
||||
(put 'make-process 'ange-ftp 'ignore)
|
||||
(put 'process-file 'ange-ftp 'ange-ftp-process-file)
|
||||
(put 'start-file-process 'ange-ftp 'ignore)
|
||||
(put 'shell-command 'ange-ftp 'ange-ftp-shell-command)
|
||||
(put 'exec-path 'ange-ftp 'ignore)
|
||||
|
||||
;;; Define ways of getting at unmodified Emacs primitives,
|
||||
;;; turning off our handler.
|
||||
|
|
|
@ -144,6 +144,7 @@ It is used for TCP/IP devices."
|
|||
(make-directory . tramp-adb-handle-make-directory)
|
||||
(make-directory-internal . ignore)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-handle-make-symbolic-link)
|
||||
(process-file . tramp-adb-handle-process-file)
|
||||
(rename-file . tramp-adb-handle-rename-file)
|
||||
|
|
|
@ -261,6 +261,7 @@ It must be supported by libarchive(3).")
|
|||
(make-directory . tramp-archive-handle-not-implemented)
|
||||
(make-directory-internal . tramp-archive-handle-not-implemented)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-archive-handle-not-implemented)
|
||||
(process-file . ignore)
|
||||
(rename-file . tramp-archive-handle-not-implemented)
|
||||
|
|
|
@ -578,6 +578,7 @@ It has been changed in GVFS 1.14.")
|
|||
(make-directory . tramp-gvfs-handle-make-directory)
|
||||
(make-directory-internal . ignore)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-handle-make-symbolic-link)
|
||||
(process-file . ignore)
|
||||
(rename-file . tramp-gvfs-handle-rename-file)
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
(make-directory . tramp-rclone-handle-make-directory)
|
||||
(make-directory-internal . ignore)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-handle-make-symbolic-link)
|
||||
(process-file . ignore)
|
||||
(rename-file . tramp-rclone-handle-rename-file)
|
||||
|
|
|
@ -995,6 +995,7 @@ of command line.")
|
|||
(make-directory . tramp-sh-handle-make-directory)
|
||||
;; `make-directory-internal' performed by default handler.
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-sh-handle-make-symbolic-link)
|
||||
(process-file . tramp-sh-handle-process-file)
|
||||
(rename-file . tramp-sh-handle-rename-file)
|
||||
|
|
|
@ -268,6 +268,7 @@ See `tramp-actions-before-shell' for more info.")
|
|||
(make-directory . tramp-smb-handle-make-directory)
|
||||
(make-directory-internal . tramp-smb-handle-make-directory-internal)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-smb-handle-make-symbolic-link)
|
||||
(process-file . tramp-smb-handle-process-file)
|
||||
(rename-file . tramp-smb-handle-rename-file)
|
||||
|
|
|
@ -119,6 +119,7 @@ See `tramp-actions-before-shell' for more info.")
|
|||
(make-directory . tramp-sudoedit-handle-make-directory)
|
||||
(make-directory-internal . ignore)
|
||||
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
|
||||
(make-process . ignore)
|
||||
(make-symbolic-link . tramp-sudoedit-handle-make-symbolic-link)
|
||||
(process-file . ignore)
|
||||
(rename-file . tramp-sudoedit-handle-rename-file)
|
||||
|
|
|
@ -2278,7 +2278,7 @@ ARGS are the arguments OPERATION has been called with."
|
|||
;; Emacs 26+ only.
|
||||
make-nearby-temp-file temporary-file-directory
|
||||
;; Emacs 27+ only.
|
||||
exec-path))
|
||||
exec-path make-process))
|
||||
default-directory)
|
||||
;; PROC.
|
||||
((member operation
|
||||
|
|
|
@ -3221,9 +3221,9 @@ Hit \\[ediff-recenter] to reset the windows afterward."
|
|||
short-f (concat ediff-temp-file-prefix short-p)
|
||||
f (cond (given-file)
|
||||
((find-file-name-handler f 'insert-file-contents)
|
||||
;; to thwart file handlers in write-region, e.g., if file
|
||||
;; name ends with .Z or .gz
|
||||
;; This is needed so that patches produced by ediff will
|
||||
;; to thwart file name handlers in write-region,
|
||||
;; e.g., if file name ends with .Z or .gz
|
||||
;; This is needed so that patches produced by ediff will
|
||||
;; have more meaningful names
|
||||
(ediff-make-empty-tmp-file short-f))
|
||||
(prefix
|
||||
|
|
|
@ -1663,7 +1663,7 @@ is mixed with standard output and sent to BUFFER or FILTER.
|
|||
|
||||
:file-handler FILE-HANDLER -- If FILE-HANDLER is non-nil, then look
|
||||
for a file name handler for the current buffer's `default-directory'
|
||||
and invoke that file handler to make the process. If there is no
|
||||
and invoke that file name handler to make the process. If there is no
|
||||
such handler, proceed as if FILE-HANDLER were nil.
|
||||
|
||||
usage: (make-process &rest ARGS) */)
|
||||
|
|
|
@ -217,7 +217,7 @@
|
|||
|
||||
(ert-deftest make-process/file-handler/found ()
|
||||
"Check that the ‘:file-handler’ argument of ‘make-process’
|
||||
works as expected if a file handler is found."
|
||||
works as expected if a file name handler is found."
|
||||
(let ((file-handler-calls 0))
|
||||
(cl-flet ((file-handler
|
||||
(&rest args)
|
||||
|
@ -238,7 +238,7 @@ works as expected if a file handler is found."
|
|||
|
||||
(ert-deftest make-process/file-handler/not-found ()
|
||||
"Check that the ‘:file-handler’ argument of ‘make-process’
|
||||
works as expected if no file handler is found."
|
||||
works as expected if no file name handler is found."
|
||||
(let ((file-name-handler-alist ())
|
||||
(default-directory invocation-directory)
|
||||
(program (expand-file-name invocation-name invocation-directory)))
|
||||
|
@ -248,7 +248,7 @@ works as expected if no file handler is found."
|
|||
|
||||
(ert-deftest make-process/file-handler/disable ()
|
||||
"Check ‘make-process’ works as expected if it shouldn’t use the
|
||||
file handler."
|
||||
file name handler."
|
||||
(let ((file-name-handler-alist (list (cons (rx bos "test-handler:")
|
||||
#'process-tests--file-handler)))
|
||||
(default-directory "test-handler:/dir/")
|
||||
|
@ -259,7 +259,7 @@ file handler."
|
|||
(defun process-tests--file-handler (operation &rest _args)
|
||||
(cl-ecase operation
|
||||
(unhandled-file-name-directory "/")
|
||||
(make-process (ert-fail "file handler called unexpectedly"))))
|
||||
(make-process (ert-fail "file name handler called unexpectedly"))))
|
||||
|
||||
(put #'process-tests--file-handler 'operations
|
||||
'(unhandled-file-name-directory make-process))
|
||||
|
|
Loading…
Add table
Reference in a new issue