Subject: bug#18652: 25.0.50; [PATCH] Add fresh-line

From: Andreas Schwab <[email-masked]>
Date: Tue, 07 Oct 2014 15:21:18 +0200

Leo Liu <[email-masked]> writes:

> I often find myself wanting to start printing at a newline and it is a
> lot of work to do it properly. I wonder if we can add something along
> these lines?

What's wrong with this:

(defun fresh-line (printcharfun)
  "Output a newline unless already at the beginning of a line.
Value is non-nil if a newline is printed.
Do nothing and return nil if PRINTCHARFUN is a function."
   (or printcharfun (setq printcharfun standard-output))
   (and (not (functionp printcharfun))
	(not (bolp))
	(princ "\n" printcharfun)))

Andreas.

-- 
Andreas Schwab, SUSE Labs, [email-masked]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."