From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.devel Subject: WRITE & linefeed Date: Sun, 19 Jun 2011 22:27:49 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1308522431 25420 80.91.229.12 (19 Jun 2011 22:27:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 19 Jun 2011 22:27:11 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jun 20 00:27:07 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QYQSP-0006lv-0A for guile-devel@m.gmane.org; Mon, 20 Jun 2011 00:27:05 +0200 Original-Received: from localhost ([::1]:47829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYQSO-0008EP-3g for guile-devel@m.gmane.org; Sun, 19 Jun 2011 18:27:04 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYPj1-0003bW-34 for guile-devel@gnu.org; Sun, 19 Jun 2011 17:40:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYPiz-00044D-8h for guile-devel@gnu.org; Sun, 19 Jun 2011 17:40:10 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:44547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYPiy-00042O-RF for guile-devel@gnu.org; Sun, 19 Jun 2011 17:40:09 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QYPiv-0006mK-R0 for guile-devel@gnu.org; Sun, 19 Jun 2011 23:40:05 +0200 Original-Received: from host86-148-144-43.range86-148.btcentralplus.com ([86.148.144.43]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Jun 2011 23:40:05 +0200 Original-Received: from ianprice90 by host86-148-144-43.range86-148.btcentralplus.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Jun 2011 23:40:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 69 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: host86-148-144-43.range86-148.btcentralplus.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:I2ojfDNlViegtd17w88yZiQWwZo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12584 Archived-At: --=-=-= Hello guilers, There's a small aesthetic issue that's been bothering me for a while. Namely, newlines aren't treated like other escape sequences when printed with WRITE. scheme@(guile-user)> (write "\n") " "scheme@(guile-user)> Now, I can see why this would be useful when printing multiple line strings, but the inconsistency with e.g. "\t\f" irks me. What do the rest of you think? I've also attached the patch I've been using to fix this for me. -- Ian Price "There are only two hard problems in Computer Science: cache invalidation and naming things." - Phil Karlton --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-use-escape-sequence-when-printing-newlines-with-writ.patch Content-Description: fix write >From 81bf0d0a4c47b1146395fd9282c1fc2ac3d495d4 Mon Sep 17 00:00:00 2001 From: Ian Price Date: Sun, 19 Jun 2011 12:30:26 +0100 Subject: [PATCH] use escape sequence when printing newlines with 'write' * libguile/print.c (write_character_escaped, write_character): Use '\n' escape sequence rather than the character 0xa0 when printing strings with WRITE. --- libguile/print.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libguile/print.c b/libguile/print.c index 4afd12c..e215f3f 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -1022,7 +1022,7 @@ write_character_escaped (scm_t_wchar ch, int string_escapes_p, SCM port) static const char escapes[7] = "abtnvfr"; char buf[9]; - if (ch >= 0x07 && ch <= 0x0D && ch != 0x0A) + if (ch >= 0x07 && ch <= 0x0D) { /* Use special escapes for some C0 controls. */ buf[0] = '\\'; @@ -1119,7 +1119,7 @@ write_character (scm_t_wchar ch, SCM port, int string_escapes_p) display_character (ch, port, strategy); printed = 1; } - else if (ch == ' ' || ch == '\n') + else if (ch == ' ') { display_character (ch, port, strategy); printed = 1; -- 1.7.5.4 --=-=-=--