octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

edit.m: patches to restore and fix old behavior for new files


From: Mike Miller
Subject: edit.m: patches to restore and fix old behavior for new files
Date: Wed, 18 Apr 2012 09:08:06 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, I have a series of patches for the edit function that restore some
behavior that hasn't worked since 3.0.x, and fix some quirks, all having
to do with editing new files.  Technically this is a regression against
3.0.x, but no one's reported it, maybe I'm the only one who has noticed.

Fixes:
 * New (not in Octave path) files are put in HOME (edit get HOME)
   as described in the docstring
 * A not found name with no extension is assumed to be a new m-file
 * New m-files and oct-files with a path have the right function name

In the following pipe-delimited tables, the first column is the command,
second is what template goes into the file created, and the third is
where the file is located.  HOME here means the HOME variable in the
edit command (edit get HOME).  The function "myfunc" does not exist
anywhere in the Octave path when each command is executed.

In Octave 3.0.x:

  octave:1> edit myfunc      | function "myfunc"      | HOME/myfunc.m
  octave:2> edit myfunc.m    | function "myfunc"      | HOME/myfunc.m
  octave:3> edit myfunc.cc   | C function "myfunc"    | HOME/myfunc.cc
  octave:4> edit notes.txt   | empty file             | HOME/notes.txt
  octave:5> edit ./myfunc.m  | function "./myfunc"    | ./myfunc.m
  octave:6> edit /tmp/myfunc | function "/tmp/myfunc" | /tmp/myfunc.m

Current dev:

  octave:1> edit myfunc      | empty file          | ./myfunc
  octave:2> edit myfunc.m    | function "myfunc"   | ./myfunc.m
  octave:3> edit myfunc.cc   | C function "myfunc" | ./myfunc.cc
  octave:4> edit notes.txt   | empty file          | ./notes.txt
  octave:5> edit ./myfunc.m  | function "./myfunc" | ./myfunc.m
  octave:6> edit /tmp/myfunc | empty file          | /tmp/myfunc

With my patches applied:

  octave:1> edit myfunc      | function "myfunc"   | HOME/myfunc.m
  octave:2> edit myfunc.m    | function "myfunc"   | HOME/myfunc.m
  octave:3> edit myfunc.cc   | C function "myfunc" | HOME/myfunc.cc
  octave:4> edit notes.txt   | empty file          | HOME/notes.txt
  octave:5> edit ./myfunc.m  | function "myfunc"   | ./myfunc.m
  octave:6> edit /tmp/myfunc | empty file          | /tmp/myfunc

I think these examples fully demonstrate what I am attempting to fix,
but if I missed anything let me know.  Note I kept the new behavior for
command #6, I think it's more preferable that way.

Changesets attached, split into 3 distinct fixes, on default but could
be rebased to stable if you want.

-- 
mike

Attachment: edit-1.patch
Description: Text Data

Attachment: edit-2.patch
Description: Text Data

Attachment: edit-3.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]