From: Stefan Monnier Date: Tue, 2 Apr 2002 21:58:53 +0000 (+0000) Subject: (reread_doc_file): Return whether reload was attempted. X-Git-Tag: ttn-vms-21-2-B4~15818 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e5aa79fa2590bf16b154545e6309fc17a159691e;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 061dc2cb591..d8ae770d63e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,10 +1,17 @@ +2002-04-02 Stefan Monnier + + * doc.c (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. + + * Makefile.in (lisp, shortlisp): Add ucs-tables.elc. + 2002-04-02 Eli Zaretskii * keyboard.c (read_char): If the event was Qselect_window, restore timer_idleness_start_time to its previous value. - * msdos.c (dos_rawgetc): Generate SELECT_WINDOW_EVENTs when - required. + * msdos.c (dos_rawgetc): Generate SELECT_WINDOW_EVENTs when required. 2002-04-01 Stefan Monnier @@ -13,7 +20,7 @@ * marker.c (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Use BEG and BEG_BYTE. - * doc.c (get_doc_string): Return nil of the location is wrong. + * doc.c (get_doc_string): Return nil if the location is wrong. (reread_doc_file): New fun. (Fdocumentation, Fdocumentation_property): Call it if get_doc_string fails. 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) return get_doc_string (filepos, 0, 1); } -static void +static int reread_doc_file (file) { Lisp_Object reply, prompt[3]; @@ -347,12 +347,14 @@ reread_doc_file (file) reply = Fy_or_n_p (Fconcat (3, prompt)); UNGCPRO; if (NILP (reply)) - error ("Aborted"); + return 0; if (NILP (file)) Fsnarf_documentation (Vdoc_file_name); else Fload (file, Qt, Qt, Qt, Qnil); + + return 1; } DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, @@ -365,6 +367,9 @@ string is passed through `substitute-command-keys'. */) Lisp_Object fun; Lisp_Object funcar; Lisp_Object tem, doc; + int try_reload = 1; + + documentation: doc = Qnil; @@ -433,18 +438,24 @@ string is passed through `substitute-command-keys'. */) Fsignal (Qinvalid_function, Fcons (fun, Qnil)); } - if (INTEGERP (doc) || CONSP (doc)) + /* If DOC is 0, it's typically because of a dumped file missing + from the DOC file (bug in src/Makefile.in). */ + if (INTEGERP (doc) && !EQ (tem, make_number (0)) || CONSP (doc)) { Lisp_Object tem; tem = get_doc_string (doc, 0, 0); - if (NILP (tem)) + if (NILP (tem) && try_reload) { /* The file is newer, we need to reset the pointers. */ struct gcpro gcpro1, gcpro2; GCPRO2 (function, raw); - reread_doc_file (Fcar_safe (doc)); + try_reload = reread_doc_file (Fcar_safe (doc)); UNGCPRO; - return Fdocumentation (function, raw); + if (try_reload) + { + try_reload = 0; + goto documentation; + } } else doc = tem; @@ -467,21 +478,29 @@ aren't strings. */) (symbol, prop, raw) Lisp_Object symbol, prop, raw; { + int try_reload = 1; Lisp_Object tem; + documentation_property: + tem = Fget (symbol, prop); - if (INTEGERP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem)))) + if (INTEGERP (tem) && !EQ (tem, make_number (0)) + || (CONSP (tem) && INTEGERP (XCDR (tem)))) { Lisp_Object doc = tem; tem = get_doc_string (tem, 0, 0); - if (NILP (tem)) + if (NILP (tem) && try_reload) { /* The file is newer, we need to reset the pointers. */ struct gcpro gcpro1, gcpro2, gcpro3; GCPRO3 (symbol, prop, raw); - reread_doc_file (Fcar_safe (doc)); + try_reload = reread_doc_file (Fcar_safe (doc)); UNGCPRO; - return Fdocumentation_property (symbol, prop, raw); + if (try_reload) + { + try_reload = 0; + goto documentation_property; + } } } else if (!STRINGP (tem))