[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Refer to List of Arguments in Emacs Lisp Function
From: |
Marcin Borkowski |
Subject: |
Re: Refer to List of Arguments in Emacs Lisp Function |
Date: |
Thu, 13 Nov 2014 17:16:52 +0100 |
On 2014-11-13, at 09:02, Alexander Shukaev wrote:
> Hello,
>
> I can't find whether there is a possibility to refer to the whole list of
> arguments of a function in Emacs Lisp. For example:
>
> (defun move (x y z)
> (apply do-move (args))
>
> What I mean by (args) primitive here is a list (x y z). This use case
> illustrates usefulness of such a primitive, i.e. forwarding of arguments to
> another internal call without a need to rewrite them by hand. (length
> (args)) might be useful in some cases too. Is there anything like that in
> Emacs Lisp already?
(defun move (&rest args)
(apply #'do-move args))
Note that (apply do-move (args)) would not work: first, you have to
quote do-move, second, (args) would try to call a function `args'.
Hth,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
Re: Refer to List of Arguments in Emacs Lisp Function, Barry Margolin, 2014/11/13
Re: Refer to List of Arguments in Emacs Lisp Function, Ted Zlatanov, 2014/11/17