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

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

Re: How to I read from the stdin input stream from inside Emacs?


From: John Mastro
Subject: Re: How to I read from the stdin input stream from inside Emacs?
Date: Sat, 23 Jan 2016 17:37:47 -0800

> I have the following command in my Makefile:
>
> foo:
>      javac *.java |& emacs --batch --load sjs-error.el --funcall doit
>
> I have tried the following code but it doesn't work:
>
> (defun doit ()
>    (while (input-pending-p)
>      (message (format "input %s" last-input-event))))
>
>  I also tried the following code but it doesn't work:
>
> (defun doit ()
>   (while (input-pending-p)
>     (message (read-key-sequence))))
>
> Please could one of you braniacs come up with some code that works!

You could use something like this:

(defun doit ()
  (let (line)
    (while (setq line (read-from-minibuffer ""))
      (message "input: %s" line))))

In batch mode, Emacs essentially treats stdin as minibuffer input.

-- 
john



reply via email to

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