diff src/lread.c @ 11079:aeaaa579d967

(Vload_read_function): New variable. (readevalloop): Use that variable. (syms_of_lread): Set up Lisp variable.
author Richard M. Stallman <rms@gnu.org>
date Tue, 21 Mar 1995 20:05:23 +0000
parents 0951bb12c8ee
children e1ca77e22c12
line wrap: on
line diff
--- a/src/lread.c	Tue Mar 21 20:03:04 1995 +0000
+++ b/src/lread.c	Tue Mar 21 20:05:23 1995 +0000
@@ -87,6 +87,9 @@
 /* Name of file actually being read by `load'.  */
 Lisp_Object Vload_file_name;
 
+/* Function to use for reading, in `load' and friends.  */
+Lisp_Object Vload_read_function;
+
 /* List of descriptors now open for Fload.  */
 static Lisp_Object load_descriptor_list;
 
@@ -743,7 +746,10 @@
       else
 	{
 	  UNREAD (c);
-	  val = read0 (readcharfun);
+	  if (NILP (Vload_read_function))
+	    val = read0 (readcharfun);
+	  else
+	    val = call1 (Vload_read_function, readcharfun);
 	}
 
       val = (*evalfun) (val);
@@ -2083,6 +2089,11 @@
     "Used for internal purposes by `load'.");
   Vcurrent_load_list = Qnil;
 
+  DEFVAR_LISP ("load-read-function", &Vload_read_function,
+    "Function used by `load' and `eval-region' for reading expressions.\n\
+The default is nil, which means use the function `read'.");
+  Vload_read_function = Qnil;
+
   load_descriptor_list = Qnil;
   staticpro (&load_descriptor_list);