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

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

Re: reading from standard input in batch mode


From: Eric Abrahamsen
Subject: Re: reading from standard input in batch mode
Date: Tue, 22 May 2018 13:49:15 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> I'm trying to figure out how batch mode works, and I want to do
>> something very simple: call a subordinate emacs process, passing it a
>> string, and have it write the string to a file. It's not working but I
>> don't know how to debug this.
>>
>> In boomerang.el:
>>
>> (defun boomerang ()
>>   (let ((msg (read)))
>>     (append-to-file msg
>>                  nil
>>                  "/home/eric/tmp/results.txt")))
>>
>> In my main emacs:
>>
>> (shell-command
>> "emacs -Q --batch -l boomerang.el -f boomerang \"hi there\"")
>>
>> The subordinate emacs starts and finishes (returning 255, which just
>> came up on a thread in emacs.devel, I think), but no file is written. As
>> far as I know, `read' should be reading from standard-input in this
>> case. What am I doing wrong?
>
> I figured it out, it should have been (read t). Ignore me!

No, dangit, it still doesn't work. I changed the (read) to (read t), and
changed the invocation to:

(shell-command
 "emacs -Q --batch -l boomerang.el -f boomerang \"hi there\"" "*output*"
 "*error*")

And *output* contains "Lisp expression:" (ie, it's still trying to read
from the minibuffer), and *error* contains "Error reading from stdin",
(ie, it couldn't read from the minibuffer).

Am I passing the string in incorrectly?




reply via email to

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