comparison src/doc.c @ 4539:061e030e3270

Fix some bugs in load-history construction, built-in symbol file names. lib-src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * make-docfile.c (main): Allow more than one -d argument, followed by a directory to change to. (put_filename): Don't strip directory information; with previous change, allows retrieval of Lisp function and variable origin files from #'built-in-symbol-file relative to lisp-directory. (scan_lisp_file): Don't add an extraneous newline after the file name, put_filename has added the newline already. lisp/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * loadup.el (load-history): Add the contents of current-load-list to load-history before clearing it. Move the variable declarations earlier in the file to a format understood by make-docfile.c. * custom.el (custom-declare-variable): Add the variable's symbol to the current file's load history entry correctly, don't use a cons. Eliminate a comment that we don't need to worry about, we don't need to check the `initialized' C variable in Lisp. * bytecomp.el (byte-compile-output-file-form): Merge Andreas Schwab's pre-GPLv3 GNU change of 19970831 here; treat #'custom-declare-variable correctly, generating the docstrings in a format understood by make-docfile.c. * loadhist.el (symbol-file): Correct behaviour for checking autoloaded macros and functions when supplied with a TYPE argument. Accept fully-qualified paths from #'built-in-symbol-file; if a path is not fully-qualified, return it relative to lisp-directory if the filename corresponds to a Lisp file, and relative to (concat source-directory "/src/") otherwise. * make-docfile.el (preloaded-file-list): Rationalise some let bindings a little. Use the "-d" argument to make-docfile.c to supply Lisp paths relative to lisp-directory, not absolutely. Add in loadup.el explicitly to the list of files to be processed by make-docfile.c--it doesn't make sense to add it to preloaded-file-list, since that is used for purposes of byte-compilation too. src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * doc.c (Fbuilt_in_symbol_file): Return a subr's filename immediately if we've found it. Check for compiled function and compiled macro docstrings in DOC too, and return them if they exist. The branch of the if statement focused on functions may have executed, but we may still want to check variable bindings; an else clause isn't appropriate.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 27 Dec 2008 14:05:50 +0000
parents 3906442b491b
children 755ae5b97edb 19a72041c5ed
comparison
equal deleted inserted replaced
4535:69a1eda3da06 4539:061e030e3270
529 weird_doc (symbol, "No file info available for function", 529 weird_doc (symbol, "No file info available for function",
530 GETTEXT("function"), 0); 530 GETTEXT("function"), 0);
531 return Qnil; 531 return Qnil;
532 } 532 }
533 else 533 else
534 filename = get_object_file_name 534 {
535 (make_int (- (EMACS_INT) XSUBR (fun)->doc)); 535 filename = get_object_file_name
536 } 536 (make_int (- (EMACS_INT) XSUBR (fun)->doc));
537 } 537 return filename;
538 else if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar))) 538 }
539 }
540
541 if (COMPILED_FUNCTIONP (fun) || (CONSP(fun) &&
542 (EQ (Qmacro, Fcar_safe (fun)))
543 && (fun = Fcdr_safe (fun),
544 COMPILED_FUNCTIONP (fun))))
545 {
546 Lisp_Object tem;
547 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun);
548
549 if (! (f->flags.documentationp))
550 return Qnil;
551 tem = compiled_function_documentation (f);
552 if (NATNUMP (tem) || CONSP (tem))
553 {
554 filename = get_object_file_name (tem);
555 return filename;
556 }
557 }
558 }
559
560 if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar)))
539 { 561 {
540 Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil); 562 Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil);
541 563
542 if (!NILP(doc_offset)) 564 if (!NILP(doc_offset))
543 { 565 {
549 } 571 }
550 else if (CONSP(doc_offset)) 572 else if (CONSP(doc_offset))
551 { 573 {
552 filename = get_object_file_name(doc_offset); 574 filename = get_object_file_name(doc_offset);
553 } 575 }
554 } 576 return filename;
555 } 577 }
556 return filename; 578 }
579
580 return Qnil;
557 } 581 }
558 582
559 DEFUN ("documentation", Fdocumentation, 1, 2, 0, /* 583 DEFUN ("documentation", Fdocumentation, 1, 2, 0, /*
560 Return the documentation string of FUNCTION. 584 Return the documentation string of FUNCTION.
561 Unless a non-nil second argument RAW is given, the 585 Unless a non-nil second argument RAW is given, the