all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Read from stdin in non-batch mode
@ 2013-10-19  8:43 Thorsten Jolitz
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-10-19  8:43 UTC (permalink / raw
  To: help-gnu-emacs


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.

--
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Read from stdin in non-batch mode
       [not found] <mailman.4294.1382172228.10748.help-gnu-emacs@gnu.org>
@ 2013-10-19 15:32 ` Pascal J. Bourguignon
  2013-10-19 16:25   ` Thorsten Jolitz
  0 siblings, 1 reply; 3+ messages in thread
From: Pascal J. Bourguignon @ 2013-10-19 15:32 UTC (permalink / raw
  To: help-gnu-emacs

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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Read from stdin in non-batch mode
  2013-10-19 15:32 ` Read from stdin in non-batch mode Pascal J. Bourguignon
@ 2013-10-19 16:25   ` Thorsten Jolitz
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-10-19 16:25 UTC (permalink / raw
  To: help-gnu-emacs

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> 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.

Ok, thanks, I just wanted to make sure I don't miss the obvious (solution)
here. In this case I rather use a temporary buffer as input stream than
patching Emacs. 

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-19 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.4294.1382172228.10748.help-gnu-emacs@gnu.org>
2013-10-19 15:32 ` Read from stdin in non-batch mode Pascal J. Bourguignon
2013-10-19 16:25   ` Thorsten Jolitz
2013-10-19  8:43 Thorsten Jolitz

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.