comparison src/doc.c @ 4408:8bbabcab2c42

Merge.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 20 Jan 2008 13:09:58 +0100
parents 3906442b491b
children 061e030e3270
comparison
equal deleted inserted replaced
4407:4ee73bbe4f8e 4408:8bbabcab2c42
35 #include "lstream.h" 35 #include "lstream.h"
36 #include "sysfile.h" 36 #include "sysfile.h"
37 37
38 Lisp_Object Vinternal_doc_file_name; 38 Lisp_Object Vinternal_doc_file_name;
39 39
40 Lisp_Object QSsubstitute; 40 Lisp_Object QSsubstitute, Qdefvar;
41 41
42 /* Work out what source file a function or variable came from, taking the 42 /* Work out what source file a function or variable came from, taking the
43 information from the documentation file. */ 43 information from the documentation file. */
44 44
45 static Lisp_Object 45 static Lisp_Object
497 if (!strcmp (weirdness, GETTEXT ("duplicate"))) return; 497 if (!strcmp (weirdness, GETTEXT ("duplicate"))) return;
498 message ("Note: Strange doc (%s) for %s %s @ %d", 498 message ("Note: Strange doc (%s) for %s %s @ %d",
499 weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos); 499 weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos);
500 } 500 }
501 501
502 DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 1, 0, /* 502 DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /*
503 Return the C source file built-in symbol SYM comes from. 503 Return the C source file built-in symbol SYM comes from.
504 Don't use this. Use the more general `symbol-file' (q.v.) instead. 504 Don't use this. Use the more general `symbol-file' (q.v.) instead.
505
506 If TYPE is nil or omitted, any kind of definition is acceptable.
507 If TYPE is `defun', then function, subr, special form or macro definitions
508 are acceptable.
509 If TYPE is `defvar', then variable definitions are acceptable.
505 */ 510 */
506 (symbol)) 511 (symbol, type))
507 { 512 {
508 /* This function can GC */ 513 /* This function can GC */
509 Lisp_Object fun; 514 Lisp_Object fun;
510 Lisp_Object filename = Qnil; 515 Lisp_Object filename = Qnil;
511 516
512 if (EQ(Ffboundp(symbol), Qt)) 517 if (EQ(Ffboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefun)))
513 { 518 {
514 fun = Findirect_function (symbol); 519 fun = Findirect_function (symbol);
515 520
516 if (SUBRP (fun)) 521 if (SUBRP (fun) || (CONSP(fun) && (EQ (Qmacro, Fcar_safe (fun)))
522 && (fun = Fcdr_safe (fun), SUBRP (fun))))
517 { 523 {
518 if (XSUBR (fun)->doc == 0) 524 if (XSUBR (fun)->doc == 0)
519 return Qnil; 525 return Qnil;
520 526
521 if ((EMACS_INT) XSUBR (fun)->doc >= 0) 527 if ((EMACS_INT) XSUBR (fun)->doc >= 0)
527 else 533 else
528 filename = get_object_file_name 534 filename = get_object_file_name
529 (make_int (- (EMACS_INT) XSUBR (fun)->doc)); 535 (make_int (- (EMACS_INT) XSUBR (fun)->doc));
530 } 536 }
531 } 537 }
532 else if (EQ(Fboundp(symbol), Qt)) 538 else if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar)))
533 { 539 {
534 Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil); 540 Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil);
535 541
536 if (!NILP(doc_offset)) 542 if (!NILP(doc_offset))
537 { 543 {
1271 DEFSUBR (Fdocumentation); 1277 DEFSUBR (Fdocumentation);
1272 DEFSUBR (Fdocumentation_property); 1278 DEFSUBR (Fdocumentation_property);
1273 DEFSUBR (Fsnarf_documentation); 1279 DEFSUBR (Fsnarf_documentation);
1274 DEFSUBR (Fverify_documentation); 1280 DEFSUBR (Fverify_documentation);
1275 DEFSUBR (Fsubstitute_command_keys); 1281 DEFSUBR (Fsubstitute_command_keys);
1282
1283 DEFSYMBOL (Qdefvar);
1276 } 1284 }
1277 1285
1278 void 1286 void
1279 vars_of_doc (void) 1287 vars_of_doc (void)
1280 { 1288 {