diff src/lread.c @ 91015:b83d0dadb2a7

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 857-865) - Update from CVS - Merge from emacs--rel--22 - Update from CVS: lisp/emacs-lisp/avl-tree.el: New file. - Remove RCS keywords * emacs--rel--22 (patch 97-100) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 246-247) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-252
author Miles Bader <miles@gnu.org>
date Wed, 29 Aug 2007 05:03:40 +0000
parents 424b655804ca 92ccd83174e6
children bdb3fe0ba9fa
line wrap: on
line diff
--- a/src/lread.c	Thu Aug 23 12:13:43 2007 +0000
+++ b/src/lread.c	Wed Aug 29 05:03:40 2007 +0000
@@ -203,6 +203,7 @@
    Fread initializes this to zero, so we need not specbind it
    or worry about what happens to it when there is an error.  */
 static int new_backquote_flag;
+static Lisp_Object Vold_style_backquotes, Qold_style_backquotes;
 
 /* A list of file names for files being loaded in Fload.  Used to
    check for recursive loads.  */
@@ -882,6 +883,20 @@
   return Qnil;
 }
 
+static Lisp_Object
+load_warn_old_style_backquotes (file)
+     Lisp_Object file;
+{
+  if (!NILP (Vold_style_backquotes))
+    {
+      Lisp_Object args[2];
+      args[0] = build_string ("!! File %s uses old-style backquotes !!");
+      args[1] = file;
+      Fmessage (2, args);
+    }
+  return Qnil;
+}
+
 DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
        doc: /* Return the suffixes that `load' should try if a suffix is \
 required.
@@ -946,7 +961,6 @@
   register FILE *stream;
   register int fd = -1;
   int count = SPECPDL_INDEX ();
-  Lisp_Object temp;
   struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object found, efound, hist_file_name;
   /* 1 means we printed the ".el is newer" message.  */
@@ -1083,6 +1097,11 @@
                     : found) ;
 
   version = -1;
+
+  /* Check fore the presence of old-style quotes and warn about them.  */
+  specbind (Qold_style_backquotes, Qnil);
+  record_unwind_protect (load_warn_old_style_backquotes, file);
+
   if (!bcmp (SDATA (found) + SBYTES (found) - 4,
 	     ".elc", 4)
       || (version = safe_to_load_p (fd)) > 0)
@@ -1579,8 +1598,6 @@
 static void
 end_of_file_error ()
 {
-  Lisp_Object data;
-
   if (STRINGP (Vload_file_name))
     xsignal1 (Qend_of_file, Vload_file_name);
 
@@ -2571,7 +2588,10 @@
 
     case '`':
       if (first_in_list)
-	goto default_label;
+	{
+	  Vold_style_backquotes = Qt;
+	  goto default_label;
+	}
       else
 	{
 	  Lisp_Object value;
@@ -2606,7 +2626,10 @@
 	  return Fcons (comma_type, Fcons (value, Qnil));
 	}
       else
-	goto default_label;
+	{
+	  Vold_style_backquotes = Qt;
+	  goto default_label;
+	}
 
     case '?':
       {
@@ -4322,6 +4345,12 @@
 	       doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'.  */);
   Veval_buffer_list = Qnil;
 
+  DEFVAR_LISP ("old-style-backquotes", &Vold_style_backquotes,
+	       doc: /* Set to non-nil when `read' encounters an old-style backquote.  */);
+  Vold_style_backquotes = Qnil;
+  Qold_style_backquotes = intern ("old-style-backquotes");
+  staticpro (&Qold_style_backquotes);
+
   /* Vsource_directory was initialized in init_lread.  */
 
   load_descriptor_list = Qnil;