diff options
author | Phillip Lord <phillip.lord@russet.org.uk> | 2016-07-18 23:28:05 +0100 |
---|---|---|
committer | Phillip Lord <phillip.lord@russet.org.uk> | 2017-01-14 12:07:27 +0000 |
commit | 86a2c93b3b62a1decad326fd66ed5cc1a9e64d5f (patch) | |
tree | 2bba44a75181d40df367217f4d9f2d5ec5b05925 /lisp/simple.el | |
parent | 9569916d94c6c448862d02919e52fc3bfb9b9c8d (diff) | |
download | emacs-feature/stdout-stderr-stream.tar.gz |
Support standard input, output and error streamsfeature/stdout-stderr-stream
* doc/lispref/streams.texi: Update doc
* lisp/simple.el (external-standard-input): New function
* src/fns.c (external-standard-input-read-char,
external-standard-input-read-line): New functions
* src/print.c: (external-standard-output,
external-standard-input): New functions
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index a757876328b..17697f9be2b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8718,6 +8718,21 @@ to capitalize ARG words." (capitalize-region (region-beginning) (region-end)) (capitalize-word arg))) +(defvar external-standard-input-pushback nil + "Pushback character for `external-standard-input'.") + +(defun external-standard-input (&optional char) + "Read a character from the system standard input. + +If CHAR is non-nil, then do not read but return CHAR +on the next invocation." + (if char + (setq external-standard-input-pushback char) + (if (eq nil external-standard-input-pushback) + (external-standard-input-read-char) + (let ((rtn external-standard-input-pushback)) + (setq external-standard-input-pushback nil) + rtn)))) (provide 'simple) |