bug in edit.m

Ben Abbott bpabbott at mac.com
Tue Jan 15 17:53:04 CST 2008


On Jan 15, 2008, at 6:36 PM, John W. Eaton wrote:

> On 15-Jan-2008, Ben Abbott wrote:
>
> | On Jan 15, 2008, at 6:11 PM, John W. Eaton wrote:
> |
> | >  edit /foo.m      %% / exists, but no write access; opens ./foo.m
> | > instead
> | >
> | >  edit /bar/foo.m  %% /bar does not exist => error
> | >
> | > jwe
> |
> | Regarding the 1st, from Matlab 2007b, the command below opens the  
> file
> | in its original path, but as "Read Only".
> |
> |  >> edit /sw/share/octave/3.0.0+/m/polynomial/residue.m
>
> Maybe my example above wasn't clear.  I meant that the directory /
> exists but without the file foo.m.

ahh, ok.

 >> edit /sw/foo.m
??? Error using ==> edit>handleError at 462
File '/sw/foo.m' not found.

 >> edit foo.m

The latter asks if the file should be opened in the pwd.

> | However, if I try to open a non-existent file ...
> |
> |  >> edit /bar/foo.m
> | ??? Error using ==> edit>handleError at 462
> | File '/bar/foo.m' not found.
>
> So it seems that we might want to do
>
>  set edit directory to FUNCTION.HOME if it exists; otherwise, use "."
>
>  if file exists and is writable, open it
>
>
>  if file exists but is not writable, then
>    if file of the same name does not exist in edit directory, copy to
>    edit directory and open it; otherwise, open existing file in edit
>    directory

Matlab opens the file in its original location ... no error or  
warning. However, the title bar of Matlab's editor does note the file  
is "Read Only".

>  if file does not exist but directory does, then
>    if directory is writable, open file in existing directory;
>    otherwise, open file in edit directory

Matlab gives an error, provided a path is specified (even "./"). If  
*no* path is specified Matlab asks if the users wants to "Do you want  
to create <filename>". In each case, I think this is an editor centric  
question. Meaning I think Octave should just try to open the file and  
let the editor decide how to handled these situations.

Actually, I guess I'd prefer all cases be left to the editor to decide  
what to do.

Ben



-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080115/4d740d9f/attachment.html 


More information about the Bug-octave mailing list