GNU bug report logs - #18652
25.0.50; [PATCH] Add fresh-line

Previous Next

Package: emacs;

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

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Leo Liu <sdl.web <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#18652: closed (25.0.50; [PATCH] Add fresh-line)
Date: Wed, 08 Oct 2014 22:25:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 09 Oct 2014 06:24:42 +0800
with message-id <m3tx3e42tx.fsf <at> gmail.com>
and subject line Re: bug#18652: 25.0.50; [PATCH] Add fresh-line
has caused the debbugs.gnu.org bug report #18652,
regarding 25.0.50; [PATCH] Add fresh-line
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
18652: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18652
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; [PATCH] Add fresh-line
Date: Tue, 07 Oct 2014 21:03:05 +0800
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?

Thanks,
Leo

=== modified file 'src/print.c'
--- src/print.c	2014-09-11 06:21:55 +0000
+++ src/print.c	2014-10-07 13:01:46 +0000
@@ -530,6 +530,30 @@
   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.
+Do nothing and return nil if PRINTCHARFUN is a function.  */)
+  (Lisp_Object printcharfun)
+{
+  PRINTDECLARE;
+  if (NILP (printcharfun))
+    printcharfun = Vstandard_output;
+  PRINTPREPARE;
+
+  if (!FUNCTIONP (printcharfun) && 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 +2358,7 @@
   defsubr (&Sprinc);
   defsubr (&Sprint);
   defsubr (&Sterpri);
+  defsubr (&Sfresh_line);
   defsubr (&Swrite_char);
 #ifdef WITH_REDIRECT_DEBUGGING_OUTPUT
   defsubr (&Sredirect_debugging_output);


[Message part 3 (message/rfc822, inline)]
From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 18652-done <at> debbugs.gnu.org
Subject: Re: bug#18652: 25.0.50; [PATCH] Add fresh-line
Date: Thu, 09 Oct 2014 06:24:42 +0800
Version: 25.1

On 2014-10-08 14:26 -0400, Stefan Monnier wrote:
> That's no excuse for creating a completely separate function which does
> the same as terpri, just slightly differently.
> IOW, please make it an argument to terpri, and if you want you can M-x
> report-emacs-bug about terpri requesting a new name for it.

I am actually fine with terpri now that I have remembered it ;)
Patch committed hopefully satisfying these comments.

Thanks,
Leo


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.