(Fdocumentation, Fdocumentation_property, Fsubstitute_command_keys):
[bpt/emacs.git] / src / lread.c
index f281c92..a4660ab 100644 (file)
@@ -50,10 +50,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #ifdef MSDOS
 #include "msdos.h"
-/* These are redefined (correctly, but differently) in values.h.  */
-#undef INTBITS
-#undef LONGBITS
-#undef SHORTBITS
 #endif
 
 #include <math.h>
@@ -68,13 +64,16 @@ extern int errno;
 Lisp_Object Qread_char, Qget_file_char, Qstandard_input, Qcurrent_load_list;
 Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist;
 Lisp_Object Qascii_character, Qload, Qload_file_name;
-Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot;
+Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
 
 extern Lisp_Object Qevent_symbol_element_mask;
 
 /* non-zero if inside `load' */
 int load_in_progress;
 
+/* Directory in which the sources were found.  */
+Lisp_Object Vsource_directory;
+
 /* Search path for files to be loaded. */
 Lisp_Object Vload_path;
 
@@ -265,7 +264,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii)
     goto retry;
 
   /* switch-frame events are put off until after the next ASCII
-     character.  This is better than signalling an error just because
+     character.  This is better than signaling an error just because
      the last characters were typed to a separate minibuffer frame,
      for example.  Eventually, some code which can deal with
      switch-frame events will read it and process it.  */
@@ -1203,9 +1202,8 @@ read1 (readcharfun, pch, first_in_list)
          if (c == '"')
            {
              Lisp_Object tmp, val;
-             int bits_per_char = INTBITS / sizeof (int);
-             int size_in_chars = ((XFASTINT (length) + bits_per_char)
-                                  / bits_per_char);
+             int size_in_chars = ((XFASTINT (length) + BITS_PER_CHAR)
+                                  / BITS_PER_CHAR);
 
              UNREAD (c);
              tmp = read1 (readcharfun, pch, first_in_list);
@@ -1317,6 +1315,9 @@ read1 (readcharfun, pch, first_in_list)
        }
       if (c == '$')
        return Vload_file_name;
+      if (c == '\'')
+       return Fcons (Qfunction, Fcons (read0 (readcharfun), Qnil));
+
 
       UNREAD (c);
       Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil));
@@ -1963,6 +1964,8 @@ oblookup (obarray, ptr, size)
       obarray = check_obarray (obarray);
       obsize = XVECTOR (obarray)->size;
     }
+  /* This is sometimes needed in the middle of GC.  */
+  obsize &= ~ARRAY_MARK_FLAG;
   /* Combining next two lines breaks VMS C 2.3.  */
   hash = hash_string (ptr, size);
   hash %= obsize;
@@ -2244,6 +2247,10 @@ init_lread ()
       Lisp_Object dump_path;
 
       dump_path = decode_env_path (0, PATH_DUMPLOADSEARCH);
+
+      Vsource_directory = Fexpand_file_name (build_string ("../"),
+                                            Fcar (dump_path));
+
       if (! NILP (Fequal (dump_path, Vload_path)))
        {
          Vload_path = decode_env_path (0, normal);
@@ -2281,13 +2288,16 @@ init_lread ()
        }
     }
   else
-    Vload_path = decode_env_path (0, normal);
+    /* ../lisp refers to the build directory.
+       NORMAL refers to the lisp dir in the source directory.  */
+    Vload_path = Fcons (build_string ("../lisp"),
+                                     decode_env_path (0, normal));
 #endif
 
 #ifndef WINDOWSNT
   /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is 
      almost never correct, thereby causing a warning to be printed out that 
-     confuses users.  Since PATH_LOADSEARCH is always overriden by the
+     confuses users.  Since PATH_LOADSEARCH is always overridden by the
      EMACSLOADPATH environment variable below, disable the warning on NT.  */
 
   /* Warn if dirs in the *standard* path don't exist.  */
@@ -2407,6 +2417,10 @@ The default is nil, which means use the function `read'.");
 This is useful when the file being loaded is a temporary copy.");
   load_force_doc_strings = 0;
 
+  DEFVAR_LISP ("source-directory", &Vsource_directory,
+     "Directory in which Emacs sources were found when Emacs was built.\n\
+You cannot count on them to still be there!");
+  Vsource_directory = Qnil;
   load_descriptor_list = Qnil;
   staticpro (&load_descriptor_list);
 
@@ -2434,6 +2448,9 @@ This is useful when the file being loaded is a temporary copy.");
   Qascii_character = intern ("ascii-character");
   staticpro (&Qascii_character);
 
+  Qfunction = intern ("function");
+  staticpro (&Qfunction);
+
   Qload = intern ("load");
   staticpro (&Qload);