diff src/doc.c @ 4408:8bbabcab2c42

Merge.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 20 Jan 2008 13:09:58 +0100
parents 3906442b491b
children 061e030e3270
line wrap: on
line diff
--- a/src/doc.c	Wed Dec 26 17:30:16 2007 +0100
+++ b/src/doc.c	Sun Jan 20 13:09:58 2008 +0100
@@ -37,7 +37,7 @@
 
 Lisp_Object Vinternal_doc_file_name;
 
-Lisp_Object QSsubstitute;
+Lisp_Object QSsubstitute, Qdefvar;
 
 /* Work out what source file a function or variable came from, taking the
    information from the documentation file. */
@@ -499,21 +499,27 @@
            weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos);
 }
 
-DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 1, 0, /*
+DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /*
 Return the C source file built-in symbol SYM comes from. 
 Don't use this.  Use the more general `symbol-file' (q.v.) instead. 
+
+If TYPE is nil or omitted, any kind of definition is acceptable. 
+If TYPE is `defun', then function, subr, special form or macro definitions
+are acceptable.
+If TYPE is `defvar', then variable definitions are acceptable.
 */
-       (symbol))
+       (symbol, type))
 {
   /* This function can GC */
   Lisp_Object fun;
   Lisp_Object filename = Qnil;
 
-  if (EQ(Ffboundp(symbol), Qt))
+  if (EQ(Ffboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefun)))
     {
       fun = Findirect_function (symbol);
 
-      if (SUBRP (fun))
+      if (SUBRP (fun) || (CONSP(fun) && (EQ (Qmacro, Fcar_safe (fun)))
+                          && (fun = Fcdr_safe (fun), SUBRP (fun))))
 	{
 	  if (XSUBR (fun)->doc == 0)
 	    return Qnil;
@@ -529,7 +535,7 @@
 	      (make_int (- (EMACS_INT) XSUBR (fun)->doc));
 	}
     }
-  else if (EQ(Fboundp(symbol), Qt))
+  else if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar)))
     {
       Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil);
 
@@ -1273,6 +1279,8 @@
   DEFSUBR (Fsnarf_documentation);
   DEFSUBR (Fverify_documentation);
   DEFSUBR (Fsubstitute_command_keys);
+
+  DEFSYMBOL (Qdefvar);
 }
 
 void