Subject: bug#31376: 26.0.50; print-charset-text-property not honored

From: Eli Zaretskii <[email-masked]>
Date: Sun, 13 May 2018 18:29:34 +0300

> From: Noam Postavsky <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked],  [email-masked]
> Date: Sat, 12 May 2018 16:02:01 -0400
> 
> Okay, how about this:
> 
> >From eed29c8e7164cbc13df4d7b4e3974ae90d9ecb51 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <[email-masked]>
> Date: Fri, 11 May 2018 13:44:46 -0400
> Subject: [PATCH] Honor print-charset-text-property value of nil (Bug#31376)
> 
> * src/print.c (print_check_string_charset_prop): Move check
> for nil Vprint_charset_text_property from here...
> (print_prune_string_charset): ... to here.
> (syms_of_print) <print-charset-text-property>: Clarify that any
> non-boolean values are treated the same as `default'.
> * doc/lispref/streams.texi (Output Variables): Add
> print-prune-string-charset.

Could we also have a couple of tests, including the original snippet
from Helmut that started this?

> +@defvar print-charset-text-property
> +This variable controls printing of `charset' text property on printing
> +a string.  The value should be @code{nil}, @code{t}, or
> +@code{default}.
> +
> +If the value is @code{nil}, @code{charset} text properties are never
> +printed.  If @code{t}, they are always printed.  If the value is
> +@code{default}, print the text property @code{charset} only when the
> +value is different from what is guessed in the current charset
> +priorities.  Values other than @code{nil} or @code{t} are treated the
> +same as @code{default}.
> +@end defvar

This LGTM, but the description of 'default' IMO is too
implementation-centric, which doesn't help the user in understanding
what to expect from that value.  How about the variant below?

  If the value is @code{default}, print only those @code{charset} text
  properties that are ``unusual'' for the respective characters under
  the current language environment.  The @code{charset} property of a
  character is considered unusual if its value is different from what
  @code{char-charset} returns for that character.

Thanks.