edit.m bug fix

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

edit.m bug fix

Carlo de Falco-2
I see the following errors when calling "edit":

>> edit edit.cc
error: cstrcat: expecting arguments to character strings
error: called from:
error:   /opt/octave/3.7/share/octave/3.7.0+/m/strings/cstrcat.m at line 50, column 5
error:   /opt/octave/3.7/share/octave/3.7.0+/m/miscellaneous/edit.m at line 422, column 14
>> function fntest ()
      a = 1;
   endfunction
>> edit fntest.m
error: type: `fntest' undefined
>> edit fntest.cc
error: type: `fntest' undefined
>>


the attached cset fixes the errors for me, any ojections if I push?
c.


open_1hzlzn8S.txt (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: edit.m bug fix

bpabbott
Administrator

On Mar 20, 2012, at 2:44 PM, Carlo de Falco wrote:

> I see the following errors when calling "edit":
>
>>> edit edit.cc
> error: cstrcat: expecting arguments to character strings
> error: called from:
> error:   /opt/octave/3.7/share/octave/3.7.0+/m/strings/cstrcat.m at line 50, column 5
> error:   /opt/octave/3.7/share/octave/3.7.0+/m/miscellaneous/edit.m at line 422, column 14
>>> function fntest ()
>      a = 1;
>   endfunction
>>> edit fntest.m
> error: type: `fntest' undefined
>>> edit fntest.cc
> error: type: `fntest' undefined
>>>
>
>
> the attached cset fixes the errors for me, any ojections if I push?
> c.
>
> <open_1hzlzn8S.txt>
Your patch doesn't work for me. My FUNCTION structure contains ....

  scalar structure containing the fields:

    AUTHOR = Ben Abbott
    EDITINPLACE =  1
    EDITOR = mvim %s
    EMAIL = <[hidden email]>
    HOME = .
    LICENSE = GPL
    MODE = async

When I type "edit edit.cc", Octave's window has the appearance of emacs editing a file names "edit.cc", but I'm actually still at Octave's command prompt.

Meanwhile the file edit.cc has been created. This file has the copyright at the top and includes the contents of edit.m (commented out).

Is the content of edit.cc intended ?

Ben


edit.cc (21K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: edit.m bug fix

bpabbott
Administrator
On Mar 20, 2012, at 4:15 PM, Ben Abbott wrote:

> On Mar 20, 2012, at 2:44 PM, Carlo de Falco wrote:
>
>> I see the following errors when calling "edit":
>>
>>>> edit edit.cc
>> error: cstrcat: expecting arguments to character strings
>> error: called from:
>> error:   /opt/octave/3.7/share/octave/3.7.0+/m/strings/cstrcat.m at line 50, column 5
>> error:   /opt/octave/3.7/share/octave/3.7.0+/m/miscellaneous/edit.m at line 422, column 14
>>>> function fntest ()
>>     a = 1;
>>  endfunction
>>>> edit fntest.m
>> error: type: `fntest' undefined
>>>> edit fntest.cc
>> error: type: `fntest' undefined
>>>>
>>
>>
>> the attached cset fixes the errors for me, any ojections if I push?
>> c.
>>
>> <open_1hzlzn8S.txt>
>
> Your patch doesn't work for me. My FUNCTION structure contains ....
>
>  scalar structure containing the fields:
>
>    AUTHOR = Ben Abbott
>    EDITINPLACE =  1
>    EDITOR = mvim %s
>    EMAIL = <[hidden email]>
>    HOME = .
>    LICENSE = GPL
>    MODE = async
>
> When I type "edit edit.cc", Octave's window has the appearance of emacs editing a file names "edit.cc", but I'm actually still at Octave's command prompt.
>
> Meanwhile the file edit.cc has been created. This file has the copyright at the top and includes the contents of edit.m (commented out).
>
> Is the content of edit.cc intended ?
>
> Ben
>
> <edit.cc>

I took a second look. I was editing edit.m while trying to run your example. This messed things up for me.

If edit.m is *not* being edited then running your example "edit edit.cc" does work as intended with your patch.

This isn't a regression, so I  suggest this be pushed to the default branch.

Ben



Reply | Threaded
Open this post in threaded view
|

Re: edit.m bug fix

Carlo de Falco-2
In reply to this post by bpabbott

On 20 Mar 2012, at 21:15, Ben Abbott wrote:

> Your patch doesn't work for me. My FUNCTION structure contains ....
>
>  scalar structure containing the fields:
>
>    AUTHOR = Ben Abbott
>    EDITINPLACE =  1
>    EDITOR = mvim %s
>    EMAIL = <[hidden email]>
>    HOME = .
>    LICENSE = GPL
>    MODE = async
>
> When I type "edit edit.cc", Octave's window has the appearance of emacs editing a file names "edit.cc", but I'm actually still at Octave's command prompt.
that is what happens if you invoke the terminal version of emacs in async mode, but I wonder why edit is running emacs as your EDITOR is set to mvim ...

> Meanwhile the file edit.cc has been created. This file has the copyright at the top and includes the contents of edit.m (commented out).
>
> Is the content of edit.cc intended ?
the content of edit.cc is intended, it was not introduced by my patch
I only corrected the wrong assumption that

type (function_name)

returns a string, it actually returns a cell-array, which must be indexed in order to get a string

> Ben
c.
Reply | Threaded
Open this post in threaded view
|

Re: edit.m bug fix

Carlo de Falco-2
In reply to this post by bpabbott

On 20 Mar 2012, at 21:34, Ben Abbott wrote:

> I took a second look. I was editing edit.m while trying to run your example. This messed things up for me.
>
> If edit.m is *not* being edited then running your example "edit edit.cc" does work as intended with your patch.
>
> This isn't a regression, so I  suggest this be pushed to the default branch.
done.

> Ben
c.