Mercurial > emacs
changeset 24040:d178122d6122
(message_dolog): Use insert_1_both to avoid running any
Lisp code here.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 11 Jan 1999 11:42:52 +0000 |
parents | 4ebd54e1f82c |
children | 2eed8853546f |
files | src/xdisp.c |
diffstat | 1 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xdisp.c Mon Jan 11 11:41:57 1999 +0000 +++ b/src/xdisp.c Mon Jan 11 11:42:52 1999 +0000 @@ -329,31 +329,32 @@ if (multibyte && NILP (current_buffer->enable_multibyte_characters)) { - int c, i = 0, nbytes; + int i, c, nbytes; + unsigned char work[1]; /* Convert a multibyte string to single-byte for the *Message* buffer. */ - while (i < len) + for (i = 0; i < len; i += nbytes) { - c = STRING_CHAR (m + i, len - i); - i += CHAR_BYTES (c); - /* Truncate the character to its last byte--we can only hope - the user is happy with the character he gets, - since if it isn't right, there is no way to do it right. */ - c &= 0xff; - insert_char (c); + c = STRING_CHAR_AND_LENGTH (m + i, len - i, nbytes); + work[0] = (SINGLE_BYTE_CHAR_P (c) + ? c + : multibyte_char_to_unibyte (c, Qnil)); + insert_1_both (work, 1, 1, 1, 0, 0); } } else if (! multibyte && ! NILP (current_buffer->enable_multibyte_characters)) { - int i = 0; + int i, c, nbytes; unsigned char *msg = (unsigned char *) m; + unsigned char *str, work[4]; /* Convert a single-byte string to multibyte for the *Message* buffer. */ - while (i < len) + for (i = 0; i < len; i++) { - int c = unibyte_char_to_multibyte (msg[i++]); - insert_char (c); + c = unibyte_char_to_multibyte (msg[i]); + nbytes = CHAR_STRING (c, work, str); + insert_1_both (work, 1, nbytes, 1, 0, 0); } } else if (len) @@ -419,7 +420,10 @@ if (point_at_end) TEMP_SET_PT_BOTH (Z, Z_BYTE); else - Fgoto_char (oldpoint); + /* We can't do Fgoto_char (oldpoint) because it will run some + Lisp code. */ + TEMP_SET_PT_BOTH (XMARKER (oldpoint)->charpos, + XMARKER (oldpoint)->bytepos); UNGCPRO; free_marker (oldpoint);