diff options
| author | Noam Postavsky | 2018-05-11 13:44:46 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2018-05-23 07:53:58 -0400 |
| commit | 6f037f427a25160168e842bff0d12b816d69067d (patch) | |
| tree | fdcb0290e8f9e1a957ffab079b1f4d2f9bfdeb34 /src | |
| parent | 0d224e82411d9471f03fc339890d6a2952b5e239 (diff) | |
| download | emacs-6f037f427a25160168e842bff0d12b816d69067d.tar.gz emacs-6f037f427a25160168e842bff0d12b816d69067d.zip | |
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.
* test/src/print-tests.el (print-charset-text-property-nil)
(print-charset-text-property-default)
(print-charset-text-property-t): New tests.
(print-tests--prints-with-charset-p): New helper function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/print.c b/src/print.c index 7c6856af48c..83943752204 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1317,8 +1317,7 @@ print_check_string_charset_prop (INTERVAL interval, Lisp_Object string) | |||
| 1317 | || CONSP (XCDR (XCDR (val)))) | 1317 | || CONSP (XCDR (XCDR (val)))) |
| 1318 | print_check_string_result |= PRINT_STRING_NON_CHARSET_FOUND; | 1318 | print_check_string_result |= PRINT_STRING_NON_CHARSET_FOUND; |
| 1319 | } | 1319 | } |
| 1320 | if (NILP (Vprint_charset_text_property) | 1320 | if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) |
| 1321 | || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) | ||
| 1322 | { | 1321 | { |
| 1323 | int i, c; | 1322 | int i, c; |
| 1324 | ptrdiff_t charpos = interval->position; | 1323 | ptrdiff_t charpos = interval->position; |
| @@ -1348,7 +1347,8 @@ print_prune_string_charset (Lisp_Object string) | |||
| 1348 | print_check_string_result = 0; | 1347 | print_check_string_result = 0; |
| 1349 | traverse_intervals (string_intervals (string), 0, | 1348 | traverse_intervals (string_intervals (string), 0, |
| 1350 | print_check_string_charset_prop, string); | 1349 | print_check_string_charset_prop, string); |
| 1351 | if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) | 1350 | if (NILP (Vprint_charset_text_property) |
| 1351 | || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) | ||
| 1352 | { | 1352 | { |
| 1353 | string = Fcopy_sequence (string); | 1353 | string = Fcopy_sequence (string); |
| 1354 | if (print_check_string_result & PRINT_STRING_NON_CHARSET_FOUND) | 1354 | if (print_check_string_result & PRINT_STRING_NON_CHARSET_FOUND) |
| @@ -2423,7 +2423,7 @@ that need to be recorded in the table. */); | |||
| 2423 | 2423 | ||
| 2424 | DEFVAR_LISP ("print-charset-text-property", Vprint_charset_text_property, | 2424 | DEFVAR_LISP ("print-charset-text-property", Vprint_charset_text_property, |
| 2425 | doc: /* A flag to control printing of `charset' text property on printing a string. | 2425 | doc: /* A flag to control printing of `charset' text property on printing a string. |
| 2426 | The value must be nil, t, or `default'. | 2426 | The value should be nil, t, or `default'. |
| 2427 | 2427 | ||
| 2428 | If the value is nil, don't print the text property `charset'. | 2428 | If the value is nil, don't print the text property `charset'. |
| 2429 | 2429 | ||
| @@ -2431,7 +2431,8 @@ If the value is t, always print the text property `charset'. | |||
| 2431 | 2431 | ||
| 2432 | If the value is `default', print the text property `charset' only when | 2432 | If the value is `default', print the text property `charset' only when |
| 2433 | the value is different from what is guessed in the current charset | 2433 | the value is different from what is guessed in the current charset |
| 2434 | priorities. */); | 2434 | priorities. Values other than nil or t are also treated as |
| 2435 | `default'. */); | ||
| 2435 | Vprint_charset_text_property = Qdefault; | 2436 | Vprint_charset_text_property = Qdefault; |
| 2436 | 2437 | ||
| 2437 | /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */ | 2438 | /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */ |