]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid grave accent quoting in stderr diagnostics
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Jun 2015 06:52:09 +0000 (23:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Jun 2015 06:53:45 +0000 (23:53 -0700)
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.

src/alloc.c
src/buffer.c
src/dispnew.c
src/emacs.c
src/lread.c
src/term.c
src/unexmacosx.c
src/xfns.c
src/xterm.c

index 14baf291bd820a2c86dc05141876669a2048aaf4..a956e95bf1491aa751e616c0b112e099ea9b3eef 100644 (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;
      }
 
index 13843a2ac4ded8897d59e95850b75008498b4801..0b98431eb0ed54f7c8244db653be63eee299c2d3 100644 (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++;
index 7e7afa71d20e0cb869abb3e58a9c72c335cf60ad..1fc3cfeef44b39acc11fae4579426f5d7d67ad21 100644 (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);
     }
 
index bba68068a8397ec489f0a9ade6b65c132ef1a82a..8396f5d4e45788a0e4c3b8fee1e4ac5f41c37188 100644 (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,
index 26c19d8338b71a60f1cdf9c67e8f867f2fa0a8ca..11c8d0031c964d8825c225e3dc732cbf5f42461b 100644 (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)
index d2a9c3d1f300c11dfe2bbf1c6889a6354e4d277e..8ebb620dd9b26ef04ecb4bfee779315f94cd72c9 100644 (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);
     }
index fe6637e2ef5ca4b28ce3ab4aefdc41ecca95b2b5..319ec7956e598204fa4fa9997837c2c576290eac 100644 (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 ();
index 16a568e9153f8b4b346cf4419adcea9ea1be4379..634881d0a66caac23a4879b5cd9631aaebaf9db2 100644 (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;
     }
index 4f5dfed9ae8f37483deebe6ead4cf78a57893abf..17c1a645d987b4e94e1348e1f1a50c26b78b58d9 100644 (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;