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

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

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


From: Andreas Schwab
Subject: bug#18652: 25.0.50; [PATCH] Add fresh-line
Date: Tue, 07 Oct 2014 15:21:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Leo Liu <sdl.web@gmail.com> 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, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





reply via email to

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