GNU bug report logs -
#18652
25.0.50; [PATCH] Add fresh-line
Previous Next
Reported by: Leo Liu <sdl.web <at> gmail.com>
Date: Tue, 7 Oct 2014 13:04:02 UTC
Severity: wishlist
Tags: patch
Found in version 25.0.50
Fixed in version 25.1
Done: Leo Liu <sdl.web <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 2014-10-07 16:45 -0400, Stefan Monnier wrote:
> Oh, I missed this part. Then, maybe it's OK. But in the case where
> printcharfun is a function, it should signal an error rather than
> silently returning nil.
How about something like this? Thanks, Leo.
=== modified file 'src/print.c'
--- src/print.c 2014-09-11 06:21:55 +0000
+++ src/print.c 2014-10-08 01:51:45 +0000
@@ -530,6 +530,33 @@
return Qt;
}
+DEFUN ("fresh-line", Ffresh_line, Sfresh_line, 0, 1, 0,
+ doc: /* Output a newline unless already at the beginning of a line.
+Value is non-nil if a newline is printed.
+Signal an error if PRINTCHARFUN is a function. */)
+ (Lisp_Object printcharfun)
+{
+ PRINTDECLARE;
+ if (NILP (printcharfun))
+ printcharfun = Vstandard_output;
+ PRINTPREPARE;
+
+ if (FUNCTIONP (printcharfun))
+ signal_error ("Unsupported function argument", printcharfun);
+
+ if (NILP (Fbolp ()))
+ {
+ PRINTCHAR ('\n');
+ PRINTFINISH;
+ return Qt;
+ }
+ else
+ {
+ PRINTFINISH;
+ return Qnil;
+ }
+}
+
DEFUN ("prin1", Fprin1, Sprin1, 1, 2, 0,
doc: /* Output the printed representation of OBJECT, any Lisp object.
Quoting characters are printed when needed to make output that `read'
@@ -2334,6 +2361,7 @@
defsubr (&Sprinc);
defsubr (&Sprint);
defsubr (&Sterpri);
+ defsubr (&Sfresh_line);
defsubr (&Swrite_char);
#ifdef WITH_REDIRECT_DEBUGGING_OUTPUT
defsubr (&Sredirect_debugging_output);
This bug report was last modified 10 years and 233 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.