diff src/help.cc @ 8631:52956d669506

Display sensible error message when the help text of an undocumented function is requested
author Soren Hauberg <hauberg@gmail.com>
date Sun, 25 Jan 2009 19:55:42 +0100
parents 540165304f00
children 2a49c32d4322
line wrap: on
line diff
--- a/src/help.cc
+++ b/src/help.cc
@@ -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);