# HG changeset patch # User John W. Eaton # Date 1289332348 18000 # Node ID 8b2a47a9970113999ed011cf1b90108bb42f7989 # Parent 7f19b2b6e09386fdcd46ae84bf68104e4c28d5f9 help: print message if function not found diff -r 7f19b2b6e093 -r 8b2a47a99701 scripts/ChangeLog --- a/scripts/ChangeLog Tue Nov 09 11:32:30 2010 -0800 +++ b/scripts/ChangeLog Tue Nov 09 14:52:28 2010 -0500 @@ -1,3 +1,10 @@ +2010-11-09 John W. Eaton + + * help/help.m: Call missing_function_hook with output argument + and print message here. + * miscellaneous/unimplemented.m: Return message if nargout > 0. + Fixes bug #31597. + 2010-11-08 Ben Abbott * plot/__go_draw_axes__.m: Check for z/y/zdata before converting diff -r 7f19b2b6e093 -r 8b2a47a99701 scripts/help/help.m --- a/scripts/help/help.m Tue Nov 09 11:32:30 2010 -0800 +++ b/scripts/help/help.m Tue Nov 09 14:52:28 2010 -0500 @@ -129,7 +129,13 @@ if (found) puts (__additional_help_message__ ()); else - feval (missing_function_hook, name); + msg = feval (missing_function_hook, name); + + if (isempty (msg)) + msg = sprintf ("`%s' not found", name); + endif + + error ("help: %s\n", msg); endif endfunction diff -r 7f19b2b6e093 -r 8b2a47a99701 scripts/miscellaneous/unimplemented.m --- a/scripts/miscellaneous/unimplemented.m Tue Nov 09 11:32:30 2010 -0800 +++ b/scripts/miscellaneous/unimplemented.m Tue Nov 09 14:52:28 2010 -0500 @@ -22,12 +22,14 @@ ## Undocumented internal function. ## @end deftypefn -function unimplemented (fcn) +function txt = unimplemented (fcn) + + is_matlab_function = true; ## Some smarter cases, add more as needed. switch (fcn) - case "quad2d" + case "quad2d" txt = ["quad2d is not implemented. Consider using dblquad."]; case "gsvd" @@ -47,21 +49,23 @@ otherwise if (ismember (fcn, missing_functions ())) - - ## The default case. - - txt = sprintf ("The %s function is not yet implemented in Octave.", fcn); - + txt = sprintf ("the `%s' function is not yet implemented in Octave", fcn); else - return; + is_matlab_function = false; + txt = ""; endif endswitch - txt = [txt, "\n\n@noindent\nPlease read ",... - "@url{http://www.octave.org/missing.html} ",... - "to find out how you can help with contributing missing functionality."]; + if (is_matlab_function) + txt = [txt, "\n\n@noindent\nPlease read ",... + "@url{http://www.octave.org/missing.html} to learn how ",... + "you can contribute missing functionality."]; + txt = __makeinfo__ (txt); + endif - warning ("Octave:missing-function",["\n", __makeinfo__(txt)]); + if (nargout == 0) + warning ("Octave:missing-function", "%s", txt); + endif endfunction