unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: problem with call-process function
Date: Tue, 01 Dec 2015 01:15:13 +0100	[thread overview]
Message-ID: <877fkzvxbi.fsf@debian.uxu> (raw)
In-Reply-To: 1123318547.39321.1448904524817.JavaMail.help@alum.mit.edu

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




      parent reply	other threads:[~2015-12-01  0:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 17:28 problem with call-process function Bostjan Vilfan
2015-11-30 18:12 ` Eli Zaretskii
2015-12-01  0:15 ` Emanuel Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fkzvxbi.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).