aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.c
diff options
context:
space:
mode:
authorStefan Monnier2002-04-02 21:58:53 +0000
committerStefan Monnier2002-04-02 21:58:53 +0000
commite5aa79fa2590bf16b154545e6309fc17a159691e (patch)
treec3f62bf54fc8af12444383ac69a05a0803714029 /src/doc.c
parente4b653e1b2ff456e3d92b1231b1d0f52d08a11b0 (diff)
downloademacs-e5aa79fa2590bf16b154545e6309fc17a159691e.tar.gz
emacs-e5aa79fa2590bf16b154545e6309fc17a159691e.zip
(reread_doc_file): Return whether reload was attempted.
(Fdocumentation, Fdocumentation_property): Don't try to reload if the doc is 0 and only ask once.
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/doc.c b/src/doc.c
index 71a9368d6f2..7ac598e126b 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -335,7 +335,7 @@ read_doc_string (filepos)
335 return get_doc_string (filepos, 0, 1); 335 return get_doc_string (filepos, 0, 1);
336} 336}
337 337
338static void 338static int
339reread_doc_file (file) 339reread_doc_file (file)
340{ 340{
341 Lisp_Object reply, prompt[3]; 341 Lisp_Object reply, prompt[3];
@@ -347,12 +347,14 @@ reread_doc_file (file)
347 reply = Fy_or_n_p (Fconcat (3, prompt)); 347 reply = Fy_or_n_p (Fconcat (3, prompt));
348 UNGCPRO; 348 UNGCPRO;
349 if (NILP (reply)) 349 if (NILP (reply))
350 error ("Aborted"); 350 return 0;
351 351
352 if (NILP (file)) 352 if (NILP (file))
353 Fsnarf_documentation (Vdoc_file_name); 353 Fsnarf_documentation (Vdoc_file_name);
354 else 354 else
355 Fload (file, Qt, Qt, Qt, Qnil); 355 Fload (file, Qt, Qt, Qt, Qnil);
356
357 return 1;
356} 358}
357 359
358DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, 360DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0,
@@ -365,6 +367,9 @@ string is passed through `substitute-command-keys'. */)
365 Lisp_Object fun; 367 Lisp_Object fun;
366 Lisp_Object funcar; 368 Lisp_Object funcar;
367 Lisp_Object tem, doc; 369 Lisp_Object tem, doc;
370 int try_reload = 1;
371
372 documentation:
368 373
369 doc = Qnil; 374 doc = Qnil;
370 375
@@ -433,18 +438,24 @@ string is passed through `substitute-command-keys'. */)
433 Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 438 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
434 } 439 }
435 440
436 if (INTEGERP (doc) || CONSP (doc)) 441 /* If DOC is 0, it's typically because of a dumped file missing
442 from the DOC file (bug in src/Makefile.in). */
443 if (INTEGERP (doc) && !EQ (tem, make_number (0)) || CONSP (doc))
437 { 444 {
438 Lisp_Object tem; 445 Lisp_Object tem;
439 tem = get_doc_string (doc, 0, 0); 446 tem = get_doc_string (doc, 0, 0);
440 if (NILP (tem)) 447 if (NILP (tem) && try_reload)
441 { 448 {
442 /* The file is newer, we need to reset the pointers. */ 449 /* The file is newer, we need to reset the pointers. */
443 struct gcpro gcpro1, gcpro2; 450 struct gcpro gcpro1, gcpro2;
444 GCPRO2 (function, raw); 451 GCPRO2 (function, raw);
445 reread_doc_file (Fcar_safe (doc)); 452 try_reload = reread_doc_file (Fcar_safe (doc));
446 UNGCPRO; 453 UNGCPRO;
447 return Fdocumentation (function, raw); 454 if (try_reload)
455 {
456 try_reload = 0;
457 goto documentation;
458 }
448 } 459 }
449 else 460 else
450 doc = tem; 461 doc = tem;
@@ -467,21 +478,29 @@ aren't strings. */)
467 (symbol, prop, raw) 478 (symbol, prop, raw)
468 Lisp_Object symbol, prop, raw; 479 Lisp_Object symbol, prop, raw;
469{ 480{
481 int try_reload = 1;
470 Lisp_Object tem; 482 Lisp_Object tem;
471 483
484 documentation_property:
485
472 tem = Fget (symbol, prop); 486 tem = Fget (symbol, prop);
473 if (INTEGERP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem)))) 487 if (INTEGERP (tem) && !EQ (tem, make_number (0))
488 || (CONSP (tem) && INTEGERP (XCDR (tem))))
474 { 489 {
475 Lisp_Object doc = tem; 490 Lisp_Object doc = tem;
476 tem = get_doc_string (tem, 0, 0); 491 tem = get_doc_string (tem, 0, 0);
477 if (NILP (tem)) 492 if (NILP (tem) && try_reload)
478 { 493 {
479 /* The file is newer, we need to reset the pointers. */ 494 /* The file is newer, we need to reset the pointers. */
480 struct gcpro gcpro1, gcpro2, gcpro3; 495 struct gcpro gcpro1, gcpro2, gcpro3;
481 GCPRO3 (symbol, prop, raw); 496 GCPRO3 (symbol, prop, raw);
482 reread_doc_file (Fcar_safe (doc)); 497 try_reload = reread_doc_file (Fcar_safe (doc));
483 UNGCPRO; 498 UNGCPRO;
484 return Fdocumentation_property (symbol, prop, raw); 499 if (try_reload)
500 {
501 try_reload = 0;
502 goto documentation_property;
503 }
485 } 504 }
486 } 505 }
487 else if (!STRINGP (tem)) 506 else if (!STRINGP (tem))