emacs-deferred icon indicating copy to clipboard operation
emacs-deferred copied to clipboard

Fix wrong-number-of-arguments error

Open r0man opened this issue 2 years ago • 1 comments

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.

r0man avatar May 26 '22 08:05 r0man

Hi,

I have been bitten by the same bug, and after debugging it I came up with mostly the same solution. I found this PR when trying to open one. I should have checked first :/

Anyway, I can vouch that the bug is real and the fix is good (thank you @r0man ).

One example of a package that expects these functions to work is michelson.el: https://gitlab.com/tezos/tezos/-/blob/master/emacs/michelson-mode.el#L429

@kiwanami , if you could please be so kind as to please merge this, it would make maintaining my emacs config easier as I wouldn't have to carry a patch around.

Thanks in advance :)

Cheers.

edouardklein avatar Aug 29 '22 18:08 edouardklein