[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Read from stdin in non-batch mode
From: |
Pascal J. Bourguignon |
Subject: |
Re: Read from stdin in non-batch mode |
Date: |
Sat, 19 Oct 2013 17:32:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Thorsten Jolitz <tjolitz@gmail.com> writes:
> Hi List,
>
> how can I (directly) achieve this behaviour in non-batch mode?
>
> ,-------------------------------------------------------------------------
> | t used as a stream means that the input is read from the minibuffer.
> | [...]. If Emacs is running in batch mode, standard input is used
> | instead of the minibuffer. For example,
> |
> | (message "%s" (read t))
> |
> | will read a Lisp expression from standard input and print the result to
> | standard output.
> `-------------------------------------------------------------------------
>
>>From the manual it seems that I have to either pipe in/output through a
> buffer or write a function - there is no input-stream 'stdin' and no
> output-stream 'stdout' mentioned that would allow for the bahaviour
> described above.
There's no stdin, because that's where the keys you're typing
interactively are coming from, normally.
Now, on linux, the program could use /dev/tty for interactive terminal
I/O instead of /dev/stdin, so you could both read a stdin file and have
terminal interaction. But this is specific to linux (AFAIK).
Of course, with X, the keys come from the the X server instead of the
terminal, so again, stdin would be free for an input stream.
But this would require a special case, compared to running emacs in a
terminal on a non linux system. I guess you will have to patch emacs to
get it.
--
__Pascal Bourguignon__
http://www.informatimago.com/