]> code.delx.au - gnu-emacs/blobdiff - src/doc.c
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / src / doc.c
index 1d3d1e644426d18e5761943088f9b1daa893e4e4..16c0d4090a08e77b3e48d4bd30d988e429fb273c 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,6 +1,7 @@
 /* Record indices of function doc strings stored in a file.
 
-Copyright (C) 1985-1986, 1993-1995, 1997-2012 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993-1995, 1997-2013 Free Software Foundation,
+Inc.
 
 This file is part of GNU Emacs.
 
@@ -83,24 +84,23 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
   ptrdiff_t minsize;
   int offset;
   EMACS_INT position;
-  Lisp_Object file, tem;
+  Lisp_Object file, tem, pos;
   USE_SAFE_ALLOCA;
 
   if (INTEGERP (filepos))
     {
       file = Vdoc_file_name;
-      position = XINT (filepos);
+      pos = filepos;
     }
   else if (CONSP (filepos))
     {
       file = XCAR (filepos);
-      position = XINT (XCDR (filepos));
+      pos = XCDR (filepos);
     }
   else
     return Qnil;
 
-  if (position < 0)
-    position = - position;
+  position = eabs (XINT (pos));
 
   if (!STRINGP (Vdoc_directory))
     return Qnil;
@@ -338,6 +338,14 @@ string is passed through `substitute-command-keys'.  */)
 
   doc = Qnil;
 
+  if (SYMBOLP (function))
+    {
+      Lisp_Object tem = Fget (function, Qfunction_documentation);
+      if (!NILP (tem))
+       return Fdocumentation_property (function, Qfunction_documentation,
+                                       raw);
+    }
+
   fun = Findirect_function (function, Qnil);
   if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
     fun = XCDR (fun);