How to understand Elisp function
There are lots of stuff in Elisp function prototype. Let's use
call-process
as our example.
call-process
create an synchronous subprocess. The function will wait until its process finish.
call-process program &optional infile destination display &rest args
↑ | | ↑ ↑ | |
"ls" ↑ | | ↑
optional argument | | list of arguments
↑ | "a" "b" ⟹ ("a" "b")
nil '(:file "/tmp/o") |
↑ ↑ |
stand input buffer name nil
"foo"
&optional infile => Optional argument like C/C++
&rest args => It is like argument list in C | "a" "b" => ("a" "b") is passed to function
// SEE: ~/.emacs.d/init.el
(call-process "ls" nil '(:file "/tmp/o") nil "-lah")