diff options
| author | Philipp Stephani | 2018-12-17 21:47:46 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2018-12-22 22:10:48 +0100 |
| commit | 039be4e02513e03ae465efae5694bd4e28a74dbe (patch) | |
| tree | 34d43f419b279e7f652ef592332f2021b5eedc66 /src | |
| parent | b41789f31f2355f6de8c15bbbc10cd6bf3dfe61e (diff) | |
| download | emacs-039be4e02513e03ae465efae5694bd4e28a74dbe.tar.gz emacs-039be4e02513e03ae465efae5694bd4e28a74dbe.zip | |
Add file name handler support for 'make-process' (Bug#28691)
* src/process.c (Fmake_process): Add new keyword argument
':file-handler'.
(syms_of_process) <make-process, :file-handler>: Define new symbols.
* lisp/files.el (file-name-non-special): Add support for
'make-process'.
* test/src/process-tests.el (make-process/file-handler/found)
(make-process/file-handler/not-found)
(make-process/file-handler/disable): New unit tests.
(process-tests--file-handler): New helper function.
* test/lisp/files-tests.el
(files-tests-file-name-non-special-make-process): New unit test.
* doc/lispref/files.texi (Magic File Names): Document that
'make-process' can invoke file name handlers.
* doc/lispref/processes.texi (Asynchronous Processes): Document
':file-handlers' argument to 'make-process'.
* etc/NEWS (Lisp Changes in Emacs 27.1): Mention new
:file-handler argument for 'make-process'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c index 8e0b2349f9d..5895f77446b 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1661,6 +1661,11 @@ to the standard error of subprocess. Specifying this implies | |||
| 1661 | `:connection-type' is set to `pipe'. If STDERR is nil, standard error | 1661 | `:connection-type' is set to `pipe'. If STDERR is nil, standard error |
| 1662 | is mixed with standard output and sent to BUFFER or FILTER. | 1662 | is mixed with standard output and sent to BUFFER or FILTER. |
| 1663 | 1663 | ||
| 1664 | :file-handler FILE-HANDLER -- If FILE-HANDLER is non-nil, then look | ||
| 1665 | for a file name handler for the current buffer's `default-directory' | ||
| 1666 | and invoke that file handler to make the process. If there is no | ||
| 1667 | such handler, proceed as if FILE-HANDLER were nil. | ||
| 1668 | |||
| 1664 | usage: (make-process &rest ARGS) */) | 1669 | usage: (make-process &rest ARGS) */) |
| 1665 | (ptrdiff_t nargs, Lisp_Object *args) | 1670 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1666 | { | 1671 | { |
| @@ -1674,6 +1679,15 @@ usage: (make-process &rest ARGS) */) | |||
| 1674 | /* Save arguments for process-contact and clone-process. */ | 1679 | /* Save arguments for process-contact and clone-process. */ |
| 1675 | contact = Flist (nargs, args); | 1680 | contact = Flist (nargs, args); |
| 1676 | 1681 | ||
| 1682 | if (!NILP (Fplist_get (contact, QCfile_handler))) | ||
| 1683 | { | ||
| 1684 | Lisp_Object file_handler | ||
| 1685 | = Ffind_file_name_handler (BVAR (current_buffer, directory), | ||
| 1686 | Qmake_process); | ||
| 1687 | if (!NILP (file_handler)) | ||
| 1688 | return CALLN (Fapply, file_handler, Qmake_process, contact); | ||
| 1689 | } | ||
| 1690 | |||
| 1677 | buffer = Fplist_get (contact, QCbuffer); | 1691 | buffer = Fplist_get (contact, QCbuffer); |
| 1678 | if (!NILP (buffer)) | 1692 | if (!NILP (buffer)) |
| 1679 | buffer = Fget_buffer_create (buffer); | 1693 | buffer = Fget_buffer_create (buffer); |
| @@ -8098,6 +8112,8 @@ init_process_emacs (int sockfd) | |||
| 8098 | void | 8112 | void |
| 8099 | syms_of_process (void) | 8113 | syms_of_process (void) |
| 8100 | { | 8114 | { |
| 8115 | DEFSYM (Qmake_process, "make-process"); | ||
| 8116 | |||
| 8101 | #ifdef subprocesses | 8117 | #ifdef subprocesses |
| 8102 | 8118 | ||
| 8103 | DEFSYM (Qprocessp, "processp"); | 8119 | DEFSYM (Qprocessp, "processp"); |
| @@ -8138,6 +8154,7 @@ syms_of_process (void) | |||
| 8138 | DEFSYM (Qreal, "real"); | 8154 | DEFSYM (Qreal, "real"); |
| 8139 | DEFSYM (Qnetwork, "network"); | 8155 | DEFSYM (Qnetwork, "network"); |
| 8140 | DEFSYM (Qserial, "serial"); | 8156 | DEFSYM (Qserial, "serial"); |
| 8157 | DEFSYM (QCfile_handler, ":file-handler"); | ||
| 8141 | DEFSYM (QCbuffer, ":buffer"); | 8158 | DEFSYM (QCbuffer, ":buffer"); |
| 8142 | DEFSYM (QChost, ":host"); | 8159 | DEFSYM (QChost, ":host"); |
| 8143 | DEFSYM (QCservice, ":service"); | 8160 | DEFSYM (QCservice, ":service"); |