comparison src/doc.c @ 5206:39d74978fd32

Keep around file info for dumped functions and variables without docstrings. src/ChangeLog addition: 2010-04-17 Aidan Kehoe <kehoea@parhasard.net> * doc.c (Fdocumentation): If we have a zero length doc string in DOC, as may happen for undocumented compiled function objects which nonetheless have file information stored, return nil. (Fsnarf_documentation): DOC info existing for compiled functions without docstrings is perfectly legitimate, now the file is also used to store file names. * bytecode.c (set_compiled_function_documentation): Allow this function to set the documentation successfully for compiled function objects that don't currently have documentation; most relevant for functions without docstrings which have file information stored in DOC. lib-src/ChangeLog addition: 2010-04-17 Aidan Kehoe <kehoea@parhasard.net> * make-docfile.c (scan_lisp_file): Even if a function doesn't have a doc string, store its file name in DOC. lisp/ChangeLog addition: 2010-04-17 Aidan Kehoe <kehoea@parhasard.net> * loadup.el (load-history): Be a bit more discriminate in the entries we remove from load-history, only removing those where the information is entirely available from DOC. Fixes problems finding the files that dumped undocumented variables were loaded from, reported by Didier Verna. * loadhist.el (symbol-file): Correct a regexp here, I had forgotten to double a backslash.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 17 Apr 2010 10:40:03 +0100
parents 16112448d484
children 308d34e9f07d
comparison
equal deleted inserted replaced
5205:fcdb86afcb91 5206:39d74978fd32
611 return Qnil; 611 return Qnil;
612 tem = compiled_function_documentation (f); 612 tem = compiled_function_documentation (f);
613 if (STRINGP (tem)) 613 if (STRINGP (tem))
614 doc = tem; 614 doc = tem;
615 else if (NATNUMP (tem) || CONSP (tem)) 615 else if (NATNUMP (tem) || CONSP (tem))
616 doc = get_doc_string (tem); 616 {
617 doc = get_doc_string (tem);
618 /* We may have zero length strings in the docfile for file
619 information. */
620 if (STRINGP (doc) && 0 == XSTRING_LENGTH (doc))
621 {
622 return Qnil;
623 }
624 }
617 else 625 else
618 return Qnil; 626 return Qnil;
619 } 627 }
620 else if (KEYMAPP (fun)) 628 else if (KEYMAPP (fun))
621 return build_msg_string ("Prefix command (definition is a keymap of subcommands)."); 629 return build_msg_string ("Prefix command (definition is a keymap of subcommands).");
901 { 909 {
902 /* Compiled-Function objects sometimes have 910 /* Compiled-Function objects sometimes have
903 slots for it. */ 911 slots for it. */
904 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun); 912 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun);
905 913
906 /* This compiled-function object must have a 914 /* If there were multiple definitions for this function,
907 slot for the docstring, since we've found a 915 and the latter one didn't
908 docstring for it. Unless there were multiple 916 have any doc, warn and don't blow up. */
909 definitions of it, and the latter one didn't 917 Lisp_Object old =
910 have any doc, which is a legal if slightly 918 compiled_function_documentation (f);
911 bogus situation, so don't blow up. */ 919 if (!ZEROP (old) && !NILP (old))
912 920 {
913 if (! (f->flags.documentationp)) 921 weird_doc (sym, "duplicate", "bytecode", pos);
914 { 922 /* In the case of duplicate doc file entries,
915 weird_doc (sym, "no doc slot", "bytecode", pos); 923 always take the later one. But if the doc is
916 goto weird; 924 not an int (a string, say) leave it alone. */
917 } 925 if (!INTP (old))
918 else 926 goto weird;
919 { 927 }
920 Lisp_Object old = 928
921 compiled_function_documentation (f); 929 /* This may be a function or variable where we want
922 if (!ZEROP (old)) 930 to make the file name available. */
923 { 931 set_compiled_function_documentation (f, offset);
924 weird_doc (sym, "duplicate", "bytecode", pos);
925 /* In the case of duplicate doc file entries,
926 always take the later one. But if the doc is
927 not an int (a string, say) leave it alone. */
928 if (!INTP (old))
929 goto weird;
930 }
931 set_compiled_function_documentation (f, offset);
932 }
933 } 932 }
934 else 933 else
935 { 934 {
936 /* Otherwise the function is undefined or 935 /* Otherwise the function is undefined or
937 otherwise weird. Ignore it. */ 936 otherwise weird. Ignore it. */