bugGNU Octave - Bugs: bug #46008, Help function fails to return help...

 
 

bug #46008: Help function fails to return help header for nested functions

Submitted by:  Tasos Papastylianou <tpapastylianou>
Submitted on:  Sun 20 Sep 2015 03:49:14 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Tasos Papastylianou <tpapastylianou> Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 23 Nov 2017 07:07:10 PM UTC, comment #3: 

I refreshed the patch to apply against the current development branch and pushed it here (http://hg.savannah.gnu.org/hgweb/octave/rev/9a1b193ddd01).

The problem with nested functions is trickier.  Attached is a small diff that I used just for testing.  It shows that, for a nested function, the depth is correct (goes to 2 rather than 1), but that the help_text is that of the enclosing function.  It looks like a joint fix with the lexer and parser will be required to support help for nested functions.

(file #42463)

Rik <rik5>
Project Administrator
Wed 22 Jun 2016 11:21:53 AM UTC, comment #2: 

Can this patch be applied yet?  It is one of those beautiful fixes that only removes code.

Here is a changeset that implements Mike's change, and gives a comment explaining the problem for nested functions.

(file #37547)

Lachlan Andrew <lachlan>
Tue 22 Sep 2015 08:14:12 PM UTC, comment #1: 

Attached patch supports help strings on subfunctions, but not nested.

When I do the next obvious change to this conditional, the docstring of the Foo function is assigned to be the help text for the Fizz nested function, and Foo gets no help text.

Needs a little more work if help on nested functions is desired.

(file #34955)

Mike Miller <mtmiller>
Project Administrator
Sun 20 Sep 2015 03:49:14 PM UTC, original submission:  

To replicate:

  • in file Foo.m:

function Foo
% Function Foo help header
  disp('hello from Foo');
  Bar;
  Fizz;

  function Fizz
  % Nested Function Fizz help header
    disp('hello from Fizz');
  end
end

function Bar
% Subfunction Bar help header
  disp('hello from Bar');
end

  • at the terminal:

>> help Foo>Bar
error: help: 'Foo>Bar' is not documented

>> help Foo>Fizz
error: help: 'Foo>Fizz' is not documented
>>

  • (matlab output for reference):

>> help Foo>Bar
  Subfunction Bar help header

>> help Foo>Fizz
  Nested Function Fizz help header

The error seems to stem from get_help_text which is a built-in (libinterp/corefcn/help.cc), called by help.m
This seems to return format = "not documented" back to help.m instead of a more appropriate value.

Tasos Papastylianou <tpapastylianou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #42463:  oct-parse.diff added by rik5 (696B - text/x-patch)
file #34955:  bug46008.diff added by mtmiller (479B - text/x-diff)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by tpapastylianou (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-23 rik5 Attached File- => Added oct-parse.diff, #42463
        StatusPatch Submitted => Confirmed
        SummaryHelp function fails to return help header for subfunctions and nested functions => Help function fails to return help header for nested functions
        Carbon-Copy- => Added jwe
    2017-11-23 rik5 Dependencies- => bugs #52461 is dependent
    2016-06-22 lachlan Attached File- => Added bug_46008_help_on_subfunctions.cset, #37547
    2015-09-22 mtmiller Attached File- => Added bug46008.diff, #34955
        Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Patch Submitted

    Back to the top


    Powered by Savane 3.5