aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1999-01-11 11:42:52 +0000
committerKenichi Handa1999-01-11 11:42:52 +0000
commita45dc86eeb938f8d325050c4ccd2cb3aa9706acf (patch)
tree7289b4d85b8e62de74f855206b11de695e921dbc /src
parent64d3c10dcb0a4634200da95af17540854497c0f5 (diff)
downloademacs-a45dc86eeb938f8d325050c4ccd2cb3aa9706acf.tar.gz
emacs-a45dc86eeb938f8d325050c4ccd2cb3aa9706acf.zip
(message_dolog): Use insert_1_both to avoid running any
Lisp code here.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 977944e5918..b609812bda0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -329,31 +329,32 @@ message_dolog (m, len, nlflag, multibyte)
329 if (multibyte 329 if (multibyte
330 && NILP (current_buffer->enable_multibyte_characters)) 330 && NILP (current_buffer->enable_multibyte_characters))
331 { 331 {
332 int c, i = 0, nbytes; 332 int i, c, nbytes;
333 unsigned char work[1];
333 /* Convert a multibyte string to single-byte 334 /* Convert a multibyte string to single-byte
334 for the *Message* buffer. */ 335 for the *Message* buffer. */
335 while (i < len) 336 for (i = 0; i < len; i += nbytes)
336 { 337 {
337 c = STRING_CHAR (m + i, len - i); 338 c = STRING_CHAR_AND_LENGTH (m + i, len - i, nbytes);
338 i += CHAR_BYTES (c); 339 work[0] = (SINGLE_BYTE_CHAR_P (c)
339 /* Truncate the character to its last byte--we can only hope 340 ? c
340 the user is happy with the character he gets, 341 : multibyte_char_to_unibyte (c, Qnil));
341 since if it isn't right, there is no way to do it right. */ 342 insert_1_both (work, 1, 1, 1, 0, 0);
342 c &= 0xff;
343 insert_char (c);
344 } 343 }
345 } 344 }
346 else if (! multibyte 345 else if (! multibyte
347 && ! NILP (current_buffer->enable_multibyte_characters)) 346 && ! NILP (current_buffer->enable_multibyte_characters))
348 { 347 {
349 int i = 0; 348 int i, c, nbytes;
350 unsigned char *msg = (unsigned char *) m; 349 unsigned char *msg = (unsigned char *) m;
350 unsigned char *str, work[4];
351 /* Convert a single-byte string to multibyte 351 /* Convert a single-byte string to multibyte
352 for the *Message* buffer. */ 352 for the *Message* buffer. */
353 while (i < len) 353 for (i = 0; i < len; i++)
354 { 354 {
355 int c = unibyte_char_to_multibyte (msg[i++]); 355 c = unibyte_char_to_multibyte (msg[i]);
356 insert_char (c); 356 nbytes = CHAR_STRING (c, work, str);
357 insert_1_both (work, 1, nbytes, 1, 0, 0);
357 } 358 }
358 } 359 }
359 else if (len) 360 else if (len)
@@ -419,7 +420,10 @@ message_dolog (m, len, nlflag, multibyte)
419 if (point_at_end) 420 if (point_at_end)
420 TEMP_SET_PT_BOTH (Z, Z_BYTE); 421 TEMP_SET_PT_BOTH (Z, Z_BYTE);
421 else 422 else
422 Fgoto_char (oldpoint); 423 /* We can't do Fgoto_char (oldpoint) because it will run some
424 Lisp code. */
425 TEMP_SET_PT_BOTH (XMARKER (oldpoint)->charpos,
426 XMARKER (oldpoint)->bytepos);
423 427
424 UNGCPRO; 428 UNGCPRO;
425 free_marker (oldpoint); 429 free_marker (oldpoint);