help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refer to List of Arguments in Emacs Lisp Function


From: Barry Margolin
Subject: Re: Refer to List of Arguments in Emacs Lisp Function
Date: Thu, 13 Nov 2014 11:02:41 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.13526.1415865742.1147.help-gnu-emacs@gnu.org>,
 Alexander Shukaev <haroogan@gmail.com> 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?

I don't think there's any built-in way to get a list of the arguments 
that were named separately in the argument list. Emacs Lisp's argument 
processing is very similar to Common Lisp's, and it doesn't have a way 
to do it, either. So you have to refer to the named arguments themselves:

(defun move (x y z)
  (apply do-move (list x y z)))

(defun move (x y z)
  (funcall do-move x y z))

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]