comparison src/doc.c @ 5596:3b1d4fa716a4

Ignore lazy docstring info, #'built-in-symbol-file; nothing built-in uses it. 2011-11-13 Aidan Kehoe <kehoea@parhasard.net> * doc.c (Fbuilt_in_symbol_file): Don't attempt to take file information from lazy docstring information in compiled functions; those functions are not built-in, and as such it's appropriate to give nil. Fix some indentation in passing.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 13 Nov 2011 17:13:52 +0000
parents 56144c8593a8
children 2014ff433daf
comparison
equal deleted inserted replaced
5595:391d809fa4e9 5596:3b1d4fa716a4
511 { 511 {
512 /* This function can GC */ 512 /* This function can GC */
513 Lisp_Object fun; 513 Lisp_Object fun;
514 Lisp_Object filename = Qnil; 514 Lisp_Object filename = Qnil;
515 515
516 if (EQ(Ffboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefun))) 516 CHECK_SYMBOL (symbol);
517
518 if (!UNBOUNDP (XSYMBOL_FUNCTION (symbol))
519 && (NILP (type) || EQ (type, Qdefun)))
517 { 520 {
518 fun = Findirect_function (symbol); 521 fun = Findirect_function (symbol);
519 522
520 if (SUBRP (fun) || (CONSP(fun) && (EQ (Qmacro, Fcar_safe (fun))) 523 if (EQ (Qmacro, Fcar_safe (fun)))
521 && (fun = Fcdr_safe (fun), SUBRP (fun)))) 524 {
525 fun = XCDR (fun);
526 }
527
528 if (SUBRP (fun))
522 { 529 {
523 if (XSUBR (fun)->doc == 0) 530 if (XSUBR (fun)->doc == 0)
524 return Qnil; 531 return Qnil;
525 532
526 if ((EMACS_INT) XSUBR (fun)->doc >= 0) 533 if ((EMACS_INT) XSUBR (fun)->doc >= 0)
535 (make_fixnum (- (EMACS_INT) XSUBR (fun)->doc)); 542 (make_fixnum (- (EMACS_INT) XSUBR (fun)->doc));
536 return filename; 543 return filename;
537 } 544 }
538 } 545 }
539 546
540 if (COMPILED_FUNCTIONP (fun) || (CONSP(fun) && 547 if (COMPILED_FUNCTIONP (fun))
541 (EQ (Qmacro, Fcar_safe (fun)))
542 && (fun = Fcdr_safe (fun),
543 COMPILED_FUNCTIONP (fun))))
544 { 548 {
545 Lisp_Object tem; 549 Lisp_Object tem;
546 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun); 550 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (fun);
547 551
548 if (! (f->flags.documentationp)) 552 if (! (f->flags.documentationp))
549 return Qnil; 553 return Qnil;
550 tem = compiled_function_documentation (f); 554 tem = compiled_function_documentation (f);
551 if (NATNUMP (tem) || CONSP (tem)) 555 if (NATNUMP (tem))
552 { 556 {
553 filename = get_object_file_name (tem); 557 return get_object_file_name (tem);
554 return filename; 558 }
555 } 559 }
556 } 560 }
557 } 561
558 562 if (!UNBOUNDP (XSYMBOL_VALUE (symbol)) && (NILP (type) || EQ (type, Qdefvar)))
559 if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar)))
560 { 563 {
561 Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil); 564 Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil);
562 565
563 if (!NILP(doc_offset)) 566 if (!NILP (doc_offset))
564 { 567 {
565 if (FIXNUMP(doc_offset)) 568 if (FIXNUMP (doc_offset))
566 { 569 {
567 filename = get_object_file_name 570 filename = get_object_file_name
568 (XFIXNUM (doc_offset) > 0 ? doc_offset 571 (XFIXNUM (doc_offset) > 0 ? doc_offset
569 : make_fixnum (- XFIXNUM (doc_offset))); 572 : make_fixnum (- XFIXNUM (doc_offset)));
570 }
571 else if (CONSP(doc_offset))
572 {
573 filename = get_object_file_name(doc_offset);
574 } 573 }
575 return filename; 574 return filename;
576 } 575 }
577 } 576 }
578 577