1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
From 226734f06196d31971d8ca2026a9ce432d5227d0 Mon Sep 17 00:00:00 2001
From: r0man <roman@burningswell.com>
Date: Thu, 26 May 2022 10:42:25 +0200
Subject: [PATCH] Fix wrong-number-of-arguments error
With Emacs 28 I'm seeing the following error when running the tests.
```
deferred error : (wrong-number-of-arguments #<subr start-process-shell-command> 4)
```
I believe this is because the `start-process-shell-command` function
is called with the command arguments as &rest parameters. This is the
function signature of `start-process-shell-command`, and it only takes
3 arguments, the name, buffer, and command. The command argument can
be a shell string like "ls -l" for example.
```
(defun start-process-shell-command (name buffer command) ...)
```
The `start-process` function on the other hand has &rest parameters
and can be called with a list of arguments.
```
(defun start-process (name buffer program &rest program-args) ...)
```
This PR fixes the issue by concatenating the command and it's argument
before calling out to `deferred:process-buffer-gen`, which is used in
both cases, when calling `start-process-shell-command`, and when
calling `start-process`.
---
deferred.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/deferred.el b/deferred.el
index 041c90b..3092ac0 100644
--- a/deferred.el
+++ b/deferred.el
@@ -754,7 +754,7 @@ object. The process name and buffer name of the argument of the
`start-process-shell-command' are generated by this function automatically.
The next deferred object receives stdout and stderr string from
the command process."
- (deferred:process-gen 'start-process-shell-command command args))
+ (deferred:process-gen 'start-process-shell-command (string-join (cons command args) " ") nil))
(defun deferred:process-buffer (command &rest args)
"A deferred wrapper of `start-process'. Return a deferred
@@ -770,7 +770,7 @@ object. The process name and buffer name of the argument of the
`start-process-shell-command' are generated by this function automatically.
The next deferred object receives stdout and stderr buffer from
the command process."
- (deferred:process-buffer-gen 'start-process-shell-command command args))
+ (deferred:process-buffer-gen 'start-process-shell-command (string-join (cons command args) " ") nil))
(defun deferred:process-gen (f command args)
"[internal]"
|