# HG changeset patch # User Stefan Miereis # Date 1395320276 -3600 # Node ID 95a1ee1cbdf188a41a8fa347828a201ab6646d98 # Parent 7c78430535db32d82badc127a55ae6ddf0d50d48 edit.m: add file extension .m to newly created files (bug #41522). * edit.m: add file extension .m to newly created files. If the gui is running then also open a file dialog where users can change the new name. diff -r 7c78430535db -r 95a1ee1cbdf1 doc/interpreter/contributors.in --- a/doc/interpreter/contributors.in Mon Apr 28 11:17:05 2014 -0700 +++ b/doc/interpreter/contributors.in Thu Mar 20 13:57:56 2014 +0100 @@ -193,6 +193,7 @@ JĂșlio Hoffimann Mendes Ed Meyer Thorsten Meyer +Stefan Miereis Petr Mikulik Mike Miller Stefan Monnier diff -r 7c78430535db -r 95a1ee1cbdf1 scripts/miscellaneous/edit.m --- a/scripts/miscellaneous/edit.m Mon Apr 28 11:17:05 2014 -0700 +++ b/scripts/miscellaneous/edit.m Thu Mar 20 13:57:56 2014 +0100 @@ -330,7 +330,7 @@ ## If editing a new file, prompt for creation if gui is running if (isguirunning ()) - if (! __octave_link_edit_file__ (file,"prompt")); + if (! __octave_link_edit_file__ (file, "prompt")); return; endif endif @@ -344,8 +344,12 @@ ext = file(idx+1:end); if (! any (strcmp (ext, {"cc", "m"}))) ## Some unknown file. Create and open it or just open it. + ## Add .m file extension per default + fileandpath = [fileandpath ".m"]; if (isguirunning ()) ## Write the initial file (if there is anything to write) + ## Give user the opportunity to change the file extension + fileandpath = uiputfile (fileandpath); fid = fopen (fileandpath, "wt"); if (fid < 0) error ("edit: could not create %s", fileandpath);