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

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

Re: Get the content of a list?


From: Pascal Bourguignon
Subject: Re: Get the content of a list?
Date: Sun, 20 Nov 2005 18:40:15 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Herbert Euler" <herberteuler@hotmail.com> writes:

> Hello everyone,
>
> I'm wanting to create a customized function to
> wrap the standard 'call-process-region'. 'Call-
> process-region' requires several arguments for
> the program it called:
>
>     (call-process-region START END PROGRAM &optional DELETE BUFFER
> DISPLAY &rest ARGS)
>
> That is, several strings may be given as ARGS.
> For example, the arguments can be
>
>     "1" "2" "3"
>
> But I don't know how to construct this series
> of arguments. I can create a list
>
>     ("1" "2" "3")
>
> easily, but don't know how to convert it into
> the former one. Any suggestions?

You can use apply to pass a list as the rest arguments:

(setf args '("1" "2" "3'))
(apply (function call-process-region)
        start end program delete buffer display args)


You can also put some or all previous arguments in the list too:

(setf args (list start end program delete buffer display "1" "2" "3'))
(apply (function call-process-region) args)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Nobody can fix the economy.  Nobody can be trusted with their finger
on the button.  Nobody's perfect.  VOTE FOR NOBODY.


reply via email to

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