Don't misencode C-generated messages
Also, be more consistent about calls to 'Fmessage' vs 'message'. * src/alloc.c (Fgc_status): Prefer AUTO_STRING to build_string for Fmessage call. * src/data.c (Fmake_variable_buffer_local) (Fmake_local_variable, Fmake_variable_frame_local): * src/doc.c (store_function_docstring): Use Fmessage, not message, since the argument can contain non-ASCII characters, and this can cause the resulting message to be incorrectly encoded for the current environment. * src/fns.c (maybe_resize_hash_table): * src/xselect.c (x_clipboard_manager_save_all): Use message, not Fmessage, since Fmessage's power isn't needed here. * src/process.c (Fmake_network_process): Reword message to avoid %s. * src/xdisp.c (vmessage): Document restrictions on message contents. (message_nolog) [false]: Remove unused code.
This commit is contained in:
parent
85aa6ede9f
commit
75f8653bfe
7 changed files with 36 additions and 39 deletions
|
@ -4542,9 +4542,9 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
|
|||
Lisp_Object zombie_list = Qnil;
|
||||
for (int i = 0; i < min (MAX_ZOMBIES, nzombies); i++)
|
||||
zombie_list = Fcons (zombies[i], zombie_list);
|
||||
return CALLN (Fmessage,
|
||||
build_string ("%d GCs, avg live/zombies = %.2f/%.2f"
|
||||
" (%f%%), max %d/%d\nzombies: %S"),
|
||||
AUTO_STRING (format, ("%d GCs, avg live/zombies = %.2f/%.2f (%f%%),"
|
||||
" max %d/%d\nzombies: %S"));
|
||||
return CALLN (Fmessage, format,
|
||||
make_number (ngcs), make_float (avg_live),
|
||||
make_float (avg_zombies),
|
||||
make_float (avg_zombies / avg_live / 100),
|
||||
|
|
27
src/data.c
27
src/data.c
|
@ -1647,8 +1647,10 @@ The function `default-value' gets the default value and `set-default' sets it.
|
|||
Lisp_Object symbol;
|
||||
XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
|
||||
if (let_shadows_global_binding_p (symbol))
|
||||
message ("Making %s buffer-local while let-bound!",
|
||||
SDATA (SYMBOL_NAME (variable)));
|
||||
{
|
||||
AUTO_STRING (format, "Making %s buffer-local while let-bound!");
|
||||
CALLN (Fmessage, format, SYMBOL_NAME (variable));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1730,9 +1732,11 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
|
|||
Lisp_Object symbol;
|
||||
XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
|
||||
if (let_shadows_global_binding_p (symbol))
|
||||
message ("Making %s local to %s while let-bound!",
|
||||
SDATA (SYMBOL_NAME (variable)),
|
||||
SDATA (BVAR (current_buffer, name)));
|
||||
{
|
||||
AUTO_STRING (format, "Making %s local to %s while let-bound!");
|
||||
CALLN (Fmessage, format, SYMBOL_NAME (variable),
|
||||
BVAR (current_buffer, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1742,8 +1746,11 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
|
|||
if (NILP (tem))
|
||||
{
|
||||
if (let_shadows_buffer_binding_p (sym))
|
||||
message ("Making %s buffer-local while locally let-bound!",
|
||||
SDATA (SYMBOL_NAME (variable)));
|
||||
{
|
||||
AUTO_STRING (format,
|
||||
"Making %s buffer-local while locally let-bound!");
|
||||
CALLN (Fmessage, format, SYMBOL_NAME (variable));
|
||||
}
|
||||
|
||||
/* Swap out any local binding for some other buffer, and make
|
||||
sure the current value is permanently recorded, if it's the
|
||||
|
@ -1908,8 +1915,10 @@ frame-local bindings). */)
|
|||
Lisp_Object symbol;
|
||||
XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
|
||||
if (let_shadows_global_binding_p (symbol))
|
||||
message ("Making %s frame-local while let-bound!",
|
||||
SDATA (SYMBOL_NAME (variable)));
|
||||
{
|
||||
AUTO_STRING (format, "Making %s frame-local while let-bound!");
|
||||
CALLN (Fmessage, format, SYMBOL_NAME (variable));
|
||||
}
|
||||
}
|
||||
return variable;
|
||||
}
|
||||
|
|
|
@ -516,8 +516,13 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
|
|||
if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING)
|
||||
ASET (fun, COMPILED_DOC_STRING, make_number (offset));
|
||||
else
|
||||
message ("No docstring slot for %s",
|
||||
SYMBOLP (obj) ? SSDATA (SYMBOL_NAME (obj)) : "<anonymous>");
|
||||
{
|
||||
AUTO_STRING (format, "No docstring slot for %s");
|
||||
CALLN (Fmessage, format,
|
||||
(SYMBOLP (obj)
|
||||
? SYMBOL_NAME (obj)
|
||||
: build_string ("<anonymous>")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3954,8 +3954,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
|
|||
#ifdef ENABLE_CHECKING
|
||||
if (HASH_TABLE_P (Vpurify_flag)
|
||||
&& XHASH_TABLE (Vpurify_flag) == h)
|
||||
CALLN (Fmessage, build_string ("Growing hash table to: %d"),
|
||||
make_number (new_size));
|
||||
message ("Growing hash table to: %"pI"d", new_size);
|
||||
#endif
|
||||
|
||||
set_hash_key_and_value (h, larger_vector (h->key_and_value,
|
||||
|
|
|
@ -3292,8 +3292,7 @@ usage: (make-network-process &rest ARGS) */)
|
|||
{
|
||||
if (!NILP (host))
|
||||
{
|
||||
message (":family local ignores the :host \"%s\" property",
|
||||
SDATA (host));
|
||||
message (":family local ignores the :host property");
|
||||
contact = Fplist_put (contact, QChost, Qnil);
|
||||
host = Qnil;
|
||||
}
|
||||
|
|
24
src/xdisp.c
24
src/xdisp.c
|
@ -10223,7 +10223,11 @@ message_with_string (const char *m, Lisp_Object string, bool log)
|
|||
|
||||
|
||||
/* Dump an informative message to the minibuf. If M is 0, clear out
|
||||
any existing message, and let the mini-buffer text show through. */
|
||||
any existing message, and let the mini-buffer text show through.
|
||||
|
||||
The message must be safe ASCII only. If strings may contain escape
|
||||
sequences or non-ASCII characters, convert them to Lisp strings and
|
||||
use Fmessage. */
|
||||
|
||||
static void ATTRIBUTE_FORMAT_PRINTF (1, 0)
|
||||
vmessage (const char *m, va_list ap)
|
||||
|
@ -10291,24 +10295,6 @@ message (const char *m, ...)
|
|||
}
|
||||
|
||||
|
||||
#if false
|
||||
/* The non-logging version of message. */
|
||||
|
||||
void
|
||||
message_nolog (const char *m, ...)
|
||||
{
|
||||
Lisp_Object old_log_max;
|
||||
va_list ap;
|
||||
va_start (ap, m);
|
||||
old_log_max = Vmessage_log_max;
|
||||
Vmessage_log_max = Qnil;
|
||||
vmessage (m, ap);
|
||||
Vmessage_log_max = old_log_max;
|
||||
va_end (ap);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Display the current message in the current mini-buffer. This is
|
||||
only called from error handlers in process.c, and is not time
|
||||
critical. */
|
||||
|
|
|
@ -2208,8 +2208,7 @@ x_clipboard_manager_save_all (void)
|
|||
local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
|
||||
if (FRAME_LIVE_P (XFRAME (local_frame)))
|
||||
{
|
||||
AUTO_STRING (saving, "Saving clipboard to X clipboard manager...");
|
||||
Fmessage (1, &saving);
|
||||
message ("Saving clipboard to X clipboard manager...");
|
||||
internal_condition_case_1 (x_clipboard_manager_save, local_frame,
|
||||
Qt, x_clipboard_manager_error_2);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue