]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle `make-process' in Tramp and ange-ftp
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 23 Dec 2018 08:48:05 +0000 (09:48 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 23 Dec 2018 08:48:05 +0000 (09:48 +0100)
* 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.

13 files changed:
doc/lispref/processes.texi
lisp/net/ange-ftp.el
lisp/net/tramp-adb.el
lisp/net/tramp-archive.el
lisp/net/tramp-gvfs.el
lisp/net/tramp-rclone.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp-sudoedit.el
lisp/net/tramp.el
lisp/vc/ediff-util.el
src/process.c
test/src/process-tests.el

index d72f5b880a20e02406d239017fded7fefae52658..c6ffb2815e02d705d0cd89acef0c3afa3c0a7c7c 100644 (file)
@@ -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
index 37df79304695cd85b733285e7d7f48df0a0693cd..8828010ab41e167591ddadb2363f778518559833 100644 (file)
@@ -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)
 \f
 ;;; Define ways of getting at unmodified Emacs primitives,
 ;;; turning off our handler.
index 4d92ae91fa5b272804b585160e58c24a444fba31..5f0b9dad31de5fc904b769a04488176630629020 100644 (file)
@@ -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)
index 02580359f730f20b97321f02c25d7c46ee4bfa8b..03b1eed97043f49d0f28217c62ab02a22ea3114d 100644 (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)
index 2321617b0ac9bcded1fc3a0bd6776e2c25a19bda..718db34f2680f9ac748fdecc882045771a465ed8 100644 (file)
@@ -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)
index f1a2cd81c67915264ccde6a28e3fed601372bba5..d5e268eb20c9d0af7f26356360303289c609011d 100644 (file)
     (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)
index ba652bddd3569930c017144eefa33efa5551ff27..308f33896c6bf540ace1259f1631336703b4da0b 100644 (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)
index ee19f9859f80ce855f89d651be7c838b5f85c2b0..c9f23afeccf2e20cbb79bc86a38630c0c7faf1f4 100644 (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)
index 3d25e13073d9519cf1c162f73eaa7c496bc864ec..f7a3b30ffcda1ec93b7053dfb0660c38a5ecc618 100644 (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)
index cf7c51fec10245a843fed9f6be6a7f7c5982635b..757f90061c5da185ce0b6a84f2a1425360d875bc 100644 (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
index b1652e7efd4401a746ae7a5d2ee22daf7cd634e6..a70fd0a97aebf4a7cab9b9a02df13114bb08e67c 100644 (file)
@@ -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
index 5895f77446b285d295e3674dc51e2d5bdc75fca7..34045b4977a8a89eca8d561746f25d312f76e4cd 100644 (file)
@@ -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)  */)
index af5bc737574f4d0d88b3d80785be3bdf2c91bc28..35890af4822c1dc5d1f30f8993f3650748247730 100644 (file)
 
 (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))