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

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

Re: problem with call-process function


From: Emanuel Berg
Subject: Re: problem with call-process function
Date: Tue, 01 Dec 2015 01:15:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Bostjan Vilfan <bostjanv@alum.mit.edu> writes:

> Hello, I'm using emacs version 24.5.1 on Windows 10,

Mega-gulp!

> The simple cases are straightforward enough.
> For example,
>
> (call-process "myprog.exe" nil t nil <additional> arguments>)
>
> will place the output plus error output of
> myprog.exe into the current buffer. However, when
> I tried to separate the output from the error
> output, I ran into problems. According to my reading
> of the manual (see above) one should replace
> "destination" (1st line of manual text) with
> ‘(REAL-DESTINATION ERROR-DESTINATION)’ where
> REAL-DESTINATION and ERROR-DESTINATION are one of
> the given alternatives; for example:
>
> (call-process "myprog.exe" nil (t nil) nil
> <additional arguments>)

Yeah, you need to quote the (t nil) otherwise it is
not a list with data but a *form*, i.e. a unary
function which named `t' to which you upon invocation
send the argument nil!

It works with '(t nil)

You can try this with this zsh script:

    #!/bin/zsh

    echo "This output is so standard, it even goes to stdout."

    echo "I always do things the opposite way - it is so immature!" >&2

And this Elisp:

    (call-process "~/chatty-program"                  ; the program to run
              nil                                     ; (no INFILE)
              `(,(get-buffer-create "stdout-buffer")  ; create #<buffer 
stdout-buffer>
                "~/chatty-errors")                    ; send errors to this file
              ) ; evaluate me

The backquote (`) creates a list, only it allows for
evaluation if something is preceeded by a comma (,).

Or, put it like this:

    (list (get-buffer-create "stdout-buffer")
          "~/chatty-errors")

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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