# HG changeset patch # User Soren Hauberg # Date 1232909742 -3600 # Node ID 52956d66950611af3b8b03562b181e4a64d8b1f8 # Parent 540165304f00d10959e61255f3a2bd25ba86421d Display sensible error message when the help text of an undocumented function is requested diff -r 540165304f00 -r 52956d669506 scripts/ChangeLog --- a/scripts/ChangeLog Sun Jan 25 17:25:15 2009 +0100 +++ b/scripts/ChangeLog Sun Jan 25 19:55:42 2009 +0100 @@ -92,6 +92,11 @@ 2009-01-25 Søren 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 Søren Hauberg + * help/help.m: Allow displaying 'Contents.m' files. 2009-01-23 Søren Hauberg diff -r 540165304f00 -r 52956d669506 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 540165304f00 -r 52956d669506 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 540165304f00 -r 52956d669506 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 540165304f00 -r 52956d669506 src/ChangeLog --- a/src/ChangeLog Sun Jan 25 17:25:15 2009 +0100 +++ b/src/ChangeLog Sun Jan 25 19:55:42 2009 +0100 @@ -82,6 +82,11 @@ 2009-01-25 Søren 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 Søren Hauberg + * help.cc (raw_help_from_file): No longer search for files called 'Contents.m', as this is moved to 'script/help.m'. diff -r 540165304f00 -r 52956d669506 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);