# HG changeset patch # User address@hidden # Date 1232909742 -3600 # Node ID 471b76de96c9cf256b721d694603bdd2c3924d9c # Parent a687e52c398f7a1d2a1f703421901d447b549558 Display sensible error message when the help text of an undocumented function is requested diff -r a687e52c398f -r 471b76de96c9 scripts/ChangeLog --- a/scripts/ChangeLog Sun Jan 25 17:25:15 2009 +0100 +++ b/scripts/ChangeLog Sun Jan 25 19:55:42 2009 +0100 @@ -1,3 +1,8 @@ +2009-01-25 Soren Hauberg + + * help/help.m, help/print_usage.m, help/get_first_help_sentence.m: + print sensible error message when function is found but not documented. + 2009-01-25 Soren Hauberg * help/help.m: Allow displaying 'Contents.m' files. diff -r a687e52c398f -r 471b76de96c9 scripts/help/get_first_help_sentence.m --- a/scripts/help/get_first_help_sentence.m Sun Jan 25 17:25:15 2009 +0100 +++ b/scripts/help/get_first_help_sentence.m Sun Jan 25 19:55:42 2009 +0100 @@ -61,6 +61,8 @@ [retval, status] = first_sentence_texinfo (help_text, max_len); case "html" [retval, status] = first_sentence_html (help_text, max_len); + case "not documented" + error ("get_first_help_sentence: `%s' is not documented\n", name); case "not found" error ("get_first_help_sentence: `%s' not found\n", name); otherwise diff -r a687e52c398f -r 471b76de96c9 scripts/help/help.m --- a/scripts/help/help.m Sun Jan 25 17:25:15 2009 +0100 +++ b/scripts/help/help.m Sun Jan 25 19:55:42 2009 +0100 @@ -60,6 +60,8 @@ [text, status] = makeinfo (text, "plain text"); case "html" [text, status] = strip_html_tags (text); + case "not documented" + error ("help: `%s' is not documented\n", name); case "not found" [text, status] = do_contents (name); if (status != 0) diff -r a687e52c398f -r 471b76de96c9 scripts/help/print_usage.m --- a/scripts/help/print_usage.m Sun Jan 25 17:25:15 2009 +0100 +++ b/scripts/help/print_usage.m Sun Jan 25 19:55:42 2009 +0100 @@ -47,6 +47,8 @@ [usage_string, status] = get_usage_texinfo (text, max_len); case "html" [usage_string, status] = get_usage_html (text, max_len); + case "not documented" + error ("print_usage: `%s' is not documented\n", name); case "not found" error ("print_usage: `%s' not found\n", name); otherwise diff -r a687e52c398f -r 471b76de96c9 src/ChangeLog --- a/src/ChangeLog Sun Jan 25 17:25:15 2009 +0100 +++ b/src/ChangeLog Sun Jan 25 19:55:42 2009 +0100 @@ -1,3 +1,8 @@ +2009-01-25 Soren Hauberg + + * help.cc (do_get_help_text, raw_help_from_symbol_table): new output to + flag the a function is found but not documented. + 2009-01-25 Soren Hauberg * help.cc (raw_help_from_file): No longer search for files called diff -r a687e52c398f -r 471b76de96c9 src/help.cc --- a/src/help.cc Sun Jan 25 17:25:15 2009 +0100 +++ b/src/help.cc Sun Jan 25 19:55:42 2009 +0100 @@ -633,16 +633,13 @@ h = fcn->doc_string (); - if (! h.empty ()) - { - retval = true; + retval = true; - w = fcn->fcn_file_name (); + w = fcn->fcn_file_name (); - if (w.empty ()) - w = fcn->is_user_function () - ? "command-line function" : "built-in function"; - } + if (w.empty ()) + w = fcn->is_user_function () + ? "command-line function" : "built-in function"; } } @@ -699,7 +696,11 @@ if (symbol_found) { size_t idx = -1; - if (looks_like_texinfo (text, idx)) + if (text.empty ()) + { + format = "Not documented"; + } + else if (looks_like_texinfo (text, idx)) { format = "texinfo"; text.erase (0, idx);