# HG changeset patch # User Jaroslav Hajek # Date 1250510366 -7200 # Node ID f3df413338c57072fc569698a1c755bfcee7cff5 # Parent 8e50093346616d2c220db44639d4c86d0eac6fd4 print_usage: support calling from methods diff -r 8e5009334661 -r f3df413338c5 scripts/ChangeLog --- a/scripts/ChangeLog Mon Aug 17 13:09:12 2009 +0200 +++ b/scripts/ChangeLog Mon Aug 17 13:59:26 2009 +0200 @@ -1,3 +1,7 @@ +2009-08-17 Jaroslav Hajek + + * help/print_usage: Allow calling from methods. + 2009-08-11 Jaroslav Hajek * general/diff.m: Remove. diff -r 8e5009334661 -r f3df413338c5 scripts/help/print_usage.m --- a/scripts/help/print_usage.m Mon Aug 17 13:09:12 2009 +0200 +++ b/scripts/help/print_usage.m Mon Aug 17 13:59:26 2009 +0200 @@ -33,12 +33,18 @@ else error ("print_usage: invalid function\n"); endif + path = evalin ("caller", "mfilename (""fullpath"")"); + if (strcmp (path(end-length(name)+1:end), name)) + path = [path, ".m"]; + else + path = name; + endif elseif (!ischar (name)) error ("print_usage: input argument must be a string"); endif ## Do the actual work - [text, format] = get_help_text (name); + [text, format] = get_help_text (path); max_len = 80; switch (lower (format)) case "plain text"