summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2014-10-09 06:05:48 +0800
committerLeo Liu <sdl.web@gmail.com>2014-10-09 06:05:48 +0800
commit2dbd7a37a809e2dcef6c8e7323ac15c98b051cd9 (patch)
tree3325d872642948f831a9acb971a2c06ce7d10b4d /lisp/emacs-lisp
parent289a43910e29999f125d76a48602b63cea7ed9b9 (diff)
downloademacs-2dbd7a37a809e2dcef6c8e7323ac15c98b051cd9.tar.gz
emacs-2dbd7a37a809e2dcef6c8e7323ac15c98b051cd9.tar.bz2
emacs-2dbd7a37a809e2dcef6c8e7323ac15c98b051cd9.zip
Enhance terpri to allow conditionally output a newline
* doc/lispref/streams.texi (Output Functions): Document new argument ENSURE to terpri. * doc/misc/cl.texi (Porting Common Lisp): Remove parse-integer. * lisp/emacs-lisp/cl-extra.el (cl-fresh-line): New function. * src/keymap.c (describe_vector_princ): * src/keyboard.c (Fcommand_error_default_function): Adapt to change to Fterpri. * src/print.c (printchar_stdout_last): Declare. (printchar): Record the last char written to stdout. (Fterpri): Add optional argument ENSURE. * test/automated/print-tests.el: New file. (terpri): Tests for terpri. (Bug#18652)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-extra.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index e10844069ef..a7970261608 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -647,6 +647,13 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
(progn (setplist sym (cdr (cdr plist))) t)
(cl--do-remf plist tag))))
+;;; Streams.
+
+;;;###autoload
+(defun cl-fresh-line (&optional stream)
+ "Output a newline unless already at the beginning of a line."
+ (terpri stream 'ensure))
+
;;; Some debugging aids.
(defun cl-prettyprint (form)