diff options
| author | Richard M. Stallman | 1998-05-25 20:29:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-25 20:29:54 +0000 |
| commit | 38940e93efbbd73e5062665814629aafb15b2fb1 (patch) | |
| tree | f9b1bc6a440c557cd36e90ce5ef618cc89e93060 /src | |
| parent | 29b7163fa98cfa8e8c4b0d5027737d92f91346c4 (diff) | |
| download | emacs-38940e93efbbd73e5062665814629aafb15b2fb1.tar.gz emacs-38940e93efbbd73e5062665814629aafb15b2fb1.zip | |
(print_escape_nonascii): New variable.
(print) <Lisp_String>: Use it to force printing single-byte
non-ASCII characters as octal escapes.
(syms_of_print): Define print-escape-nonascii.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c index 879b48933c9..e9faec91188 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -130,6 +130,11 @@ int print_escape_newlines; | |||
| 130 | 130 | ||
| 131 | Lisp_Object Qprint_escape_newlines; | 131 | Lisp_Object Qprint_escape_newlines; |
| 132 | 132 | ||
| 133 | /* Nonzero means to print single-byte non-ascii characters in strings as | ||
| 134 | octal escapes. */ | ||
| 135 | |||
| 136 | int print_escape_nonascii; | ||
| 137 | |||
| 133 | /* Nonzero means print (quote foo) forms as 'foo, etc. */ | 138 | /* Nonzero means print (quote foo) forms as 'foo, etc. */ |
| 134 | 139 | ||
| 135 | int print_quoted; | 140 | int print_quoted; |
| @@ -1248,9 +1253,10 @@ print (obj, printcharfun, escapeflag) | |||
| 1248 | } | 1253 | } |
| 1249 | else if (SINGLE_BYTE_CHAR_P (c) | 1254 | else if (SINGLE_BYTE_CHAR_P (c) |
| 1250 | && ! ASCII_BYTE_P (c) | 1255 | && ! ASCII_BYTE_P (c) |
| 1251 | && ! NILP (current_buffer->enable_multibyte_characters)) | 1256 | && (! NILP (current_buffer->enable_multibyte_characters) |
| 1257 | || print_escape_nonascii)) | ||
| 1252 | { | 1258 | { |
| 1253 | /* When multibyte is enabled, | 1259 | /* When multibyte is enabled or when explicitly requested, |
| 1254 | print single-byte non-ASCII string chars | 1260 | print single-byte non-ASCII string chars |
| 1255 | using octal escapes. */ | 1261 | using octal escapes. */ |
| 1256 | unsigned char outbuf[5]; | 1262 | unsigned char outbuf[5]; |
| @@ -1807,6 +1813,12 @@ A value of nil means no limit."); | |||
| 1807 | Also print formfeeds as backslash-f."); | 1813 | Also print formfeeds as backslash-f."); |
| 1808 | print_escape_newlines = 0; | 1814 | print_escape_newlines = 0; |
| 1809 | 1815 | ||
| 1816 | DEFVAR_BOOL ("print-escape-nonascii", &print_escape_nonascii, | ||
| 1817 | "Non-nil means print non-ASCII characters in strings as backslash-NNN.\n\ | ||
| 1818 | NNN is the octal representation of the character's value.\n\ | ||
| 1819 | Only single-byte characters are affected."); | ||
| 1820 | print_escape_nonascii = 0; | ||
| 1821 | |||
| 1810 | DEFVAR_BOOL ("print-quoted", &print_quoted, | 1822 | DEFVAR_BOOL ("print-quoted", &print_quoted, |
| 1811 | "Non-nil means print quoted forms with reader syntax.\n\ | 1823 | "Non-nil means print quoted forms with reader syntax.\n\ |
| 1812 | I.e., (quote foo) prints as 'foo, (function foo) as #'foo, and, backquoted\n\ | 1824 | I.e., (quote foo) prints as 'foo, (function foo) as #'foo, and, backquoted\n\ |