I have some difficulties to understand how Lisp wanted to receive the arguments. When I look into the documentation about arguments in functions, I need to name the arguments exactly as in the source code, when calling the same function.
When I look into the documentation of Emacs function indent-region
, I get the following:
= runs the command indent-region, which is an interactive compiled
Lisp function in `indent.el'.
It is bound to =, <menu-bar> <emacs-lisp> <indent-region>, C-M-\.
(indent-region START END &optional COLUMN)
Indent each nonblank line in the region.
A numeric prefix argument specifies a column: indent each line to that column.
Then I create a function, that pass the arguments to the function itself, as described in the documentation:
(defun foo (start end)
(interactive)
(indent-region start end)
)
I see no difference when comparing with how another custom functions handles the functionality. When I visually selected a region, and call the function, I got the error that the arguments are of the wrong type.
So this led me to wonder why the start
and end
arguments are not accepted in this case?
(functionname argument1 argument2 argument3)
. You can pass a list as an argument, but generally you need to quote it:(functionname '(item1 item2 item3))
. Try experimenting with functions like+
andapply
.