0, 1);
printbufidx = size;
if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame))
- printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame);
+ {
+ printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame);
+ /* Rewind incomplete multi-byte form. */
+ while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0)
+ printbufidx--;
+ }
bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx);
+ message_enable_multibyte = 1;
}
- message_enable_multibyte
- = ! NILP (current_buffer->enable_multibyte_characters);
if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len)
bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len),
}
message_dolog (ptr, size_byte, 0, multibyte);
+
+ /* Convert message to multibyte if we are now adding multibyte text. */
+ if (multibyte
+ && ! message_enable_multibyte
+ && printbufidx > 0)
+ {
+ int size = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame),
+ printbufidx);
+ unsigned char *tembuf = (unsigned char *) alloca (size + 1);
+ copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx,
+ 0, 1);
+ printbufidx = size;
+ if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame))
+ {
+ printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame);
+ /* Rewind incomplete multi-byte form. */
+ while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0)
+ printbufidx--;
+ }
+
+ bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx);
+ message_enable_multibyte = 1;
+ }
+
+ /* Compute how much of the new text will fit there. */
if (size_byte > FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1)
{
size_byte = FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1;
/* Rewind incomplete multi-byte form. */
- while (size_byte && (unsigned char) ptr[size] >= 0xA0) size--;
+ while (size_byte && (unsigned char) ptr[size_byte] >= 0xA0)
+ size_byte--;
}
+
+ /* Put that part of the new text in. */
bcopy (ptr, &FRAME_MESSAGE_BUF (mini_frame) [printbufidx], size_byte);
printbufidx += size_byte;
- echo_area_glyphs_length = printbufidx;
FRAME_MESSAGE_BUF (mini_frame) [printbufidx] = 0;
+ echo_area_glyphs_length = printbufidx;
return;
}
current_buffer->directory = old->directory;
current_buffer->read_only = Qnil;
+ current_buffer->filename = Qnil;
+ current_buffer->undo_list = Qt;
+ current_buffer->overlays_before = Qnil;
+ current_buffer->overlays_after = Qnil;
+ current_buffer->enable_multibyte_characters
+ = buffer_defaults.enable_multibyte_characters;
Ferase_buffer ();
XSETBUFFER (buf, current_buffer);
Lisp_Object
internal_with_output_to_temp_buffer (bufname, function, args)
char *bufname;
- Lisp_Object (*function) ();
+ Lisp_Object (*function) P_ ((Lisp_Object));
Lisp_Object args;
{
int count = specpdl_ptr - specpdl;
/* If we just had a hex escape, and this character
could be taken as part of it,
output `\ ' to prevent that. */
- if (need_nonhex
- && ((c >= 'a' && c <= 'f')
+ if (need_nonhex)
+ {
+ need_nonhex = 0;
+ if ((c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F')
- || (c >= '0' && c <= '9')))
- strout ("\\ ", -1, -1, printcharfun, 0);
+ || (c >= '0' && c <= '9'))
+ strout ("\\ ", -1, -1, printcharfun, 0);
+ }
if (c == '\"' || c == '\\')
PRINTCHAR ('\\');