unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#15033: [PATCH] Fix display of symbols containing backslashes
@ 2013-08-06 13:44 David Kastrup
  2013-08-06 22:04 ` Mark H Weaver
  0 siblings, 1 reply; 2+ messages in thread
From: David Kastrup @ 2013-08-06 13:44 UTC (permalink / raw)
  To: 15033; +Cc: David Kastrup

Symbols printed with `#{...#}' notation need to double backslashes when
displaying as they serve as escape characters when reading.  The
behavior before this patch is clearly erroneous:

GNU Guile 2.0.7
[...]
scheme@(guile-user)> (string->symbol "\\(")
$1 = #{\\x28;}#
scheme@(guile-user)> (symbol->string '#{\\x28;}#)
$2 = "\\x28;"
---
 libguile/print.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libguile/print.c b/libguile/print.c
index 50f5a3e..bb7fd84 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -448,7 +448,8 @@ print_extended_symbol (SCM sym, SCM port)
                                             SUBSEQUENT_IDENTIFIER_MASK
                                             | UC_CATEGORY_MASK_Zs))
         {
-          if (!display_character (c, port, strategy))
+          if (!display_character (c, port, strategy)
+	      || (c == '\\' && !display_character (c, port, strategy)))
             scm_encoding_error ("print_extended_symbol", errno,
                                 "cannot convert to output locale",
                                 port, SCM_MAKE_CHAR (c));
-- 
1.8.1.2






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#15033: [PATCH] Fix display of symbols containing backslashes
  2013-08-06 13:44 bug#15033: [PATCH] Fix display of symbols containing backslashes David Kastrup
@ 2013-08-06 22:04 ` Mark H Weaver
  0 siblings, 0 replies; 2+ messages in thread
From: Mark H Weaver @ 2013-08-06 22:04 UTC (permalink / raw)
  To: David Kastrup; +Cc: 15033-done

David Kastrup <dak@gnu.org> writes:

> Symbols printed with `#{...#}' notation need to double backslashes when
> displaying as they serve as escape characters when reading.  The
> behavior before this patch is clearly erroneous:
>
> GNU Guile 2.0.7
> [...]
> scheme@(guile-user)> (string->symbol "\\(")
> $1 = #{\\x28;}#
> scheme@(guile-user)> (symbol->string '#{\\x28;}#)
> $2 = "\\x28;"
> ---
>  libguile/print.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libguile/print.c b/libguile/print.c
> index 50f5a3e..bb7fd84 100644
> --- a/libguile/print.c
> +++ b/libguile/print.c
> @@ -448,7 +448,8 @@ print_extended_symbol (SCM sym, SCM port)
>                                              SUBSEQUENT_IDENTIFIER_MASK
>                                              | UC_CATEGORY_MASK_Zs))
>          {
> -          if (!display_character (c, port, strategy))
> +          if (!display_character (c, port, strategy)
> +	      || (c == '\\' && !display_character (c, port, strategy)))
>              scm_encoding_error ("print_extended_symbol", errno,
>                                  "cannot convert to output locale",
>                                  port, SCM_MAKE_CHAR (c));

Applied in b4a099883d20d7852c95acf07ab6cbc56bce18c4.

     Thanks!
       Mark





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-06 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-06 13:44 bug#15033: [PATCH] Fix display of symbols containing backslashes David Kastrup
2013-08-06 22:04 ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).