Mercurial > octave-nkf
changeset 18730:95a1ee1cbdf1
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.
author | Stefan Miereis <stefan.miereis@gmx.de> |
---|---|
date | Thu, 20 Mar 2014 13:57:56 +0100 |
parents | 7c78430535db |
children | 26c87537ab42 |
files | doc/interpreter/contributors.in scripts/miscellaneous/edit.m |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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);