# HG changeset patch # User address@hidden # Date 1232900715 -3600 # Node ID a687e52c398f7a1d2a1f703421901d447b549558 # Parent 555ad338713fdb2e5741c7fff7e9124f4d7ab05e Allow displaying 'Contents.m' files. diff -r 555ad338713f -r a687e52c398f scripts/ChangeLog --- a/scripts/ChangeLog Fri Jan 23 18:50:21 2009 +0100 +++ b/scripts/ChangeLog Sun Jan 25 17:25:15 2009 +0100 @@ -1,3 +1,7 @@ +2009-01-25 Soren Hauberg + + * help/help.m: Allow displaying 'Contents.m' files. + 2009-01-23 Soren Hauberg * help/type.m: Make 'type X' work, when X is the name of a variable. diff -r 555ad338713f -r a687e52c398f scripts/help/help.m --- a/scripts/help/help.m Fri Jan 23 18:50:21 2009 +0100 +++ b/scripts/help/help.m Sun Jan 25 17:25:15 2009 +0100 @@ -61,7 +61,10 @@ case "html" [text, status] = strip_html_tags (text); case "not found" - error ("help: `%s' not found\n", name); + [text, status] = do_contents (name); + if (status != 0) + error ("help: `%s' not found\n", name); + endif otherwise error ("help: internal error: unsupported help text format: '%s'\n", format); endswitch @@ -80,3 +83,31 @@ endif endfunction +function [text, status] = do_contents (name) + text = ""; + status = 1; + + d = find_dir_in_path (name); + if (!isempty (d)) + p = path (); + unwind_protect + ## Only include 'd' in the path, and then get the help text of 'Contents' + path (d); + [text, format] = get_help_text ("Contents"); + + ## Take action depending on help text format + switch (lower (format)) + case "plain text" + status = 0; + case "texinfo" + [text, status] = makeinfo (text, "plain text"); + case "html" + [text, status] = strip_html_tags (text); + endswitch + unwind_protect_cleanup + ## Restore path + path (p); + end_unwind_protect + endif +endfunction + diff -r 555ad338713f -r a687e52c398f src/ChangeLog --- a/src/ChangeLog Fri Jan 23 18:50:21 2009 +0100 +++ b/src/ChangeLog Sun Jan 25 17:25:15 2009 +0100 @@ -1,3 +1,9 @@ +2009-01-25 Soren Hauberg + + * help.cc (raw_help_from_file): No longer search for files called + 'Contents.m', as this is moved to 'script/help.m'. + + 2009-01-23 John W. Eaton * toplev.cc (octave_call_stack::do_goto_caller_frame): diff -r 555ad338713f -r a687e52c398f src/help.cc --- a/src/help.cc Fri Jan 23 18:50:21 2009 +0100 +++ b/src/help.cc Sun Jan 25 17:25:15 2009 +0100 @@ -659,18 +659,6 @@ if (h.length () > 0) retval = true; - else if (! symbol_found) - { - file = contents_file_in_path (nm); - - if (! file.empty ()) - { - h = get_help_from_file (file, symbol_found); - - if (h.length () > 0) - retval = true; - } - } return retval; }