Merge from trunk
[bpt/emacs.git] / src / doc.c
index 31f1e5a..c56f0b6 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -36,6 +36,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 Lisp_Object Qfunction_documentation;
 
+extern Lisp_Object Qclosure;
 /* Buffer used for reading from documentation file.  */
 static char *get_doc_string_buffer;
 static int get_doc_string_buffer_size;
@@ -356,6 +357,11 @@ string is passed through `substitute-command-keys'.  */)
       else
        return Qnil;
     }
+  else if (FUNVECP (fun))
+    {
+      /* Unless otherwise handled, funvecs have no documentation.  */
+      return Qnil;
+    }
   else if (STRINGP (fun) || VECTORP (fun))
     {
       return build_string ("Keyboard macro.");
@@ -383,6 +389,8 @@ string is passed through `substitute-command-keys'.  */)
          else
            return Qnil;
        }
+      else if (EQ (funcar, Qclosure))
+       return Fdocumentation (Fcdr (XCDR (fun)), raw);
       else if (EQ (funcar, Qmacro))
        return Fdocumentation (Fcdr (fun), raw);
       else
@@ -475,7 +483,7 @@ aren't strings.  */)
     }
   else if (!STRINGP (tem))
     /* Feval protects its argument.  */
-    tem = Feval (tem);
+    tem = Feval (tem, Qnil);
 
   if (NILP (raw) && STRINGP (tem))
     tem = Fsubstitute_command_keys (tem);
@@ -510,6 +518,8 @@ store_function_docstring (Lisp_Object fun, EMACS_INT offset)
        }
       else if (EQ (tem, Qmacro))
        store_function_docstring (XCDR (fun), offset);
+      else if (EQ (tem, Qclosure))
+       store_function_docstring (Fcdr (XCDR (fun)), offset);
     }
 
   /* Bytecode objects sometimes have slots for it.  */