Avoid grave accent quoting in stderr diagnostics

A few Emacs diagnostics go directly to stderr, and so can't easily
contain curved quotes (as non-UTF-8 locales might mishandle them).
Instead of bothering to add support for this rarity, reword the
diagnostics so that they don't use grave accent to quote.
* src/alloc.c (mark_memory): Fix comment.
* src/buffer.c (init_buffer):
* src/dispnew.c (init_display):
* src/emacs.c (main, sort_args):
* src/lread.c (dir_warning):
* src/term.c (init_tty):
* src/unexmacosx.c (unexec):
* src/xfns.c (select_visual):
* src/xterm.c (cvt_string_to_pixel, x_io_error_quitter):
Reword stderr diagnostics to avoid quoting `like this'.
* src/unexmacosx.c: Include errno.h.
* src/xfns.c (select_visual): Encode value for locale.
This commit is contained in:
Paul Eggert 2015-05-31 23:52:09 -07:00
parent 467af178f5
commit 2c656f7deb
9 changed files with 27 additions and 24 deletions

View file

@ -4775,7 +4775,7 @@ mark_memory (void *start, void *end)
Lisp_Object obj = build_string ("test");
struct Lisp_String *s = XSTRING (obj);
Fgarbage_collect ();
fprintf (stderr, "test `%s'\n", s->data);
fprintf (stderr, "test '%s'\n", s->data);
return Qnil;
}

View file

@ -5285,7 +5285,7 @@ init_buffer (int initialized)
pwd = get_current_dir_name ();
if (!pwd)
fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
fatal ("get_current_dir_name: %s\n", strerror (errno));
/* Maybe this should really use some standard subroutine
whose definition is filename syntax dependent. */
@ -5295,7 +5295,7 @@ init_buffer (int initialized)
/* Grow buffer to add directory separator and '\0'. */
pwd = realloc (pwd, len + 2);
if (!pwd)
fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
fatal ("get_current_dir_name: %s\n", strerror (errno));
pwd[len] = DIRECTORY_SEP;
pwd[len + 1] = '\0';
len++;

View file

@ -6036,10 +6036,10 @@ init_display (void)
{
#ifdef HAVE_WINDOW_SYSTEM
if (! inhibit_window_system)
fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see `tset').\n");
fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see 'tset').\n");
else
#endif /* HAVE_WINDOW_SYSTEM */
fprintf (stderr, "Please set the environment variable TERM; see `tset'.\n");
fprintf (stderr, "Please set the environment variable TERM; see 'tset'.\n");
exit (1);
}

View file

@ -776,12 +776,12 @@ main (int argc, char **argv)
tem2 = Fsymbol_value (intern_c_string ("emacs-copyright"));
if (!STRINGP (tem))
{
fprintf (stderr, "Invalid value of `emacs-version'\n");
fprintf (stderr, "Invalid value of 'emacs-version'\n");
exit (1);
}
if (!STRINGP (tem2))
{
fprintf (stderr, "Invalid value of `emacs-copyright'\n");
fprintf (stderr, "Invalid value of 'emacs-copyright'\n");
exit (1);
}
else
@ -1796,7 +1796,7 @@ sort_args (int argc, char **argv)
options[from] = standard_args[i].nargs;
priority[from] = standard_args[i].priority;
if (from + standard_args[i].nargs >= argc)
fatal ("Option `%s' requires an argument\n", argv[from]);
fatal ("Option '%s' requires an argument\n", argv[from]);
from += standard_args[i].nargs;
goto done;
}
@ -1833,7 +1833,7 @@ sort_args (int argc, char **argv)
if (equals != 0)
options[from] = 0;
if (from + options[from] >= argc)
fatal ("Option `%s' requires an argument\n", argv[from]);
fatal ("Option '%s' requires an argument\n", argv[from]);
from += options[from];
}
/* FIXME When match < 0, shouldn't there be some error,

View file

@ -4418,9 +4418,10 @@ init_lread (void)
void
dir_warning (char const *use, Lisp_Object dirname)
{
static char const format[] = "Warning: %s `%s': %s\n";
static char const format[] = "Warning: %s '%s': %s\n";
int access_errno = errno;
fprintf (stderr, format, use, SSDATA (dirname), strerror (access_errno));
fprintf (stderr, format, use, SSDATA (ENCODE_SYSTEM (dirname)),
strerror (access_errno));
/* Don't log the warning before we've initialized!! */
if (initialized)

View file

@ -4028,12 +4028,12 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
"Terminal type %s is not defined",
"Terminal type %s is not defined.\n\
If that is not the actual type of terminal you have,\n\
use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
`setenv TERM ...') to specify the correct type. It may be necessary\n"
use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
'setenv TERM ...') to specify the correct type. It may be necessary\n"
#ifdef TERMINFO
"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
"to do 'unset TERMINFO' (C-shell: 'unsetenv TERMINFO') as well.",
#else
"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
"to do 'unset TERMCAP' (C-shell: 'unsetenv TERMCAP') as well.",
#endif
terminal_type);
}
@ -4307,12 +4307,12 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
"Terminal type \"%s\" is not powerful enough to run Emacs.\n\
It lacks the ability to position the cursor.\n\
If that is not the actual type of terminal you have,\n\
use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
`setenv TERM ...') to specify the correct type. It may be necessary\n"
use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
'setenv TERM ...') to specify the correct type. It may be necessary\n"
# ifdef TERMINFO
"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
"to do 'unset TERMINFO' (C-shell: 'unsetenv TERMINFO') as well.",
# else /* TERMCAP */
"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
"to do 'unset TERMCAP' (C-shell: 'unsetenv TERMCAP') as well.",
# endif /* TERMINFO */
terminal_type);
}

View file

@ -99,6 +99,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "unexec.h"
#include "lisp.h"
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdarg.h>
@ -1264,14 +1265,14 @@ unexec (const char *outfile, const char *infile)
infd = emacs_open (infile, O_RDONLY, 0);
if (infd < 0)
{
unexec_error ("cannot open input file `%s'", infile);
unexec_error ("%s: %s", infile, strerror (errno));
}
outfd = emacs_open (outfile, O_WRONLY | O_TRUNC | O_CREAT, 0777);
if (outfd < 0)
{
emacs_close (infd);
unexec_error ("cannot open output file `%s'", outfile);
unexec_error ("%s: %s", outfile, strerror (errno));
}
build_region_list ();

View file

@ -4519,7 +4519,8 @@ select_visual (struct x_display_info *dpyinfo)
if (class == -1
|| !XMatchVisualInfo (dpy, XScreenNumberOfScreen (screen),
dpyinfo->n_planes, class, &vinfo))
fatal ("Invalid visual specification `%s'", SDATA (value));
fatal ("Invalid visual specification '%s'",
SSDATA (ENCODE_SYSTEM (value)));
dpyinfo->visual = vinfo.visual;
}

View file

@ -2091,7 +2091,7 @@ cvt_string_to_pixel (Display *dpy, XrmValue *args, Cardinal *nargs,
params[0] = color_name;
XtAppWarningMsg (XtDisplayToApplicationContext (dpy),
"badValue", "cvt_string_to_pixel",
"XtToolkitError", "Invalid color `%s'",
"XtToolkitError", "Invalid color '%s'",
params, &nparams);
return False;
}
@ -9388,7 +9388,7 @@ x_io_error_quitter (Display *display)
{
char buf[256];
snprintf (buf, sizeof buf, "Connection lost to X server `%s'",
snprintf (buf, sizeof buf, "Connection lost to X server '%s'",
DisplayString (display));
x_connection_closed (display, buf, true);
return 0;