changeset 22240:4e4c377f3310

(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.
author Richard M. Stallman <rms@gnu.org>
date Mon, 25 May 1998 20:29:54 +0000
parents 0a666cecb85d
children 0a93e911af6b
files src/print.c
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/print.c	Mon May 25 20:28:28 1998 +0000
+++ b/src/print.c	Mon May 25 20:29:54 1998 +0000
@@ -130,6 +130,11 @@
 
 Lisp_Object Qprint_escape_newlines;
 
+/* Nonzero means to print single-byte non-ascii characters in strings as
+   octal escapes.  */
+
+int print_escape_nonascii;
+
 /* Nonzero means print (quote foo) forms as 'foo, etc.  */
 
 int print_quoted;
@@ -1248,9 +1253,10 @@
 		}
 	      else if (SINGLE_BYTE_CHAR_P (c)
 		       && ! ASCII_BYTE_P (c)
-		       && ! NILP (current_buffer->enable_multibyte_characters))
+		       && (! NILP (current_buffer->enable_multibyte_characters)
+			   || print_escape_nonascii))
 		{
-		  /* When multibyte is enabled,
+		  /* When multibyte is enabled or when explicitly requested,
 		     print single-byte non-ASCII string chars
 		     using octal escapes.  */
 		  unsigned char outbuf[5];
@@ -1807,6 +1813,12 @@
 Also print formfeeds as backslash-f.");
   print_escape_newlines = 0;
 
+  DEFVAR_BOOL ("print-escape-nonascii", &print_escape_nonascii,
+    "Non-nil means print non-ASCII characters in strings as backslash-NNN.\n\
+NNN is the octal representation of the character's value.\n\
+Only single-byte characters are affected.");
+  print_escape_nonascii = 0;
+
   DEFVAR_BOOL ("print-quoted", &print_quoted,
     "Non-nil means print quoted forms with reader syntax.\n\
 I.e., (quote foo) prints as 'foo, (function foo) as #'foo, and, backquoted\n\