Sat 09 Nov 2013 08:07:11 AM UTC, comment #18:
Rik, thanks for pushing the cset. If I knew you are pushing the patch right away I would have prepared a complete patch with comment.
|
Fri 08 Nov 2013 04:14:14 PM UTC, comment #17:
Works for me as well.
|
Fri 08 Nov 2013 03:44:34 PM UTC, comment #16:
Works for me. I added a check-in note and then committed the change under your name here (http://hg.savannah.gnu.org/hgweb/octave/rev/766ad9be2966). Closing report.
|
Fri 08 Nov 2013 07:45:49 AM UTC, comment #15:
The attached patch uses octave-qt-link for the dialog prompting for file creation. The editor's preference "always create new files" is respected.
The behavior of "edit" in cli-mode has not changed.
(file #29568)
|
Thu 07 Nov 2013 08:50:21 PM UTC, comment #14:
Okay, if I need more time to get the octave-qt-link version I will push the edit.m patch (with the issues mentioned by John fixed).
I also thought about using "edit" for creating a new script in the gui. But AFAIK "edit" needs the new file name whereas the "new" menu creates an empty editor tab without an existing file on disk. A possible solution could be that "new" opens a file dialog in order to chose the file location and name (like "save as") and then "edit file_name" is called.
|
Thu 07 Nov 2013 08:30:19 PM UTC, comment #13:
Behavior generally seems right. It would be nice to use octave-qt-link, but as a first step you might commit this fix. That way if you don't get enough time to implement the octave-qt-link before the release the behavior will still be better.
On a second note, if edit is changed to behave like the GUI would fixing bug #40502 become trivial? It seems like there is the possibility to get the code right in edit.m and octave-qt-link and then when someone does File->New->Function the GUI would actually just call edit.m with a filename like "new_function.m"
|
Thu 07 Nov 2013 07:51:40 PM UTC, comment #12:
works for me - there is a typo in the question dialog text and it prints out 'create_file'
If it is changed to use the octave-qt-link, it should be able to use the preferences setting again to determinate whether to prompt ?(for those who don't like the prompt)
|
Thu 07 Nov 2013 07:37:09 PM UTC, comment #11:
Attached a patch that makes edit.m prompting before creating a new file regardless the extension but only if in gui-mode. The drawback is that questdlg is used and therefore the strings of the dialog are not translated by the qt-translator and the settings can not be accessed for the "always create new files"-option.
If the behavior is as desired I would try to use octave-qt-link to overcome this.
(file #29564)
|
Thu 07 Nov 2013 01:41:40 PM UTC, comment #10:
In the event that my last comment was misunderstood, it is Matlab that prompts for the creation of all non-existing files. There is no difference in behavior between files with different suffixes.
Personally, I find the prompt annoying, and would prefer the file just be created. But if the consensus is to prompt, then I'd favor consistent behavior across all file-types. And have the default behavior of the prompt be to create the file.
From the CLI, I'd prefer the edit command just go with the default behavior and skip the prompt/warning.
|
Thu 07 Nov 2013 01:08:52 PM UTC, comment #9:
.cc and .m files don't prompt for creation for me either, just the ones that aren't handled explicitly by edit.m.
I would prefer that the GUI (when available) prompts to create all files as I have the same issue that Philip has in comment 7. (Matlab prompts on all files, and is what I what I would expect a GUI application to do)
Perhaps another bug report here is that if I type 'edit' without a file name I get differing results:
GUI: edit doesn't appear to do anything
CLI: attempt to open EDITOR with the current directory as a file name.
Matlab: opens a new edit window.
|
Thu 07 Nov 2013 05:48:02 AM UTC, comment #8:
edit foo.m or foo.cc does not show the creation dialog for me. The file has already been created by edit.m when the editor is called, so no need for a dialog (from the editor's point of view). Only other file types are not automatically created by edit.
This behavior does not differ from the case where an external editor is used (.m and .cc are created and the editor is called, other file names are passed to the editor leaving it up to it how to handle new files).
|
Wed 06 Nov 2013 09:36:01 PM UTC, comment #7:
I often hit this issue when using the CLI, of creating unwanted .m files because I overlooked that I was in the wrong subdir.
So I'd be in favor of a warning, before actually creating the requested non-existing file, in the CLI as well.
(I usually have data in the working directory and m-files in another subdir (often called "m-files" :-) ). As you'd guess many m-files inadvertently end up in the data subdir.)
Just my 2 $c
|
Wed 06 Nov 2013 06:45:13 PM UTC, comment #6:
Is this an area where we would like to copy Matlab's behavior?
For non-existent files, "edit foo" results in a dialog asking if foo.m should be created. Using "foo.m", "foo.c", "foo.cc", "foo.txt", etc gives the same behavior (with the ".m" suffix replaced the the suffix used).
I think it reasonable for the CLI version to default to creating the file asked for, but am uncertain what "edit foo" should do for the CLI. Should the CLI treat "edit foo" as "edit foo.m" or just create the file "foo" with no suffix?
|
Wed 06 Nov 2013 06:40:13 PM UTC, comment #5:
Personally, I like the prompt option in the GUI.
In gui mode can we prompt for any editor file creation (based on setting), and in cli, display a warning or something so its obvious that a file has been created?
|
Wed 06 Nov 2013 06:30:46 PM UTC, comment #4:
Torsten put in an option and GUI code to deal with the case of calling edit on a non-existent file. If we want the same behavior between GUI and CLI we could remove the option and fall back on having edit always create a blank file if one does not exist. I don't know if consistency is that valuable, but it would be easy to do.
|
Sat 02 Nov 2013 10:14:31 AM UTC, comment #3:
I guessed that was the case, it just doesn't seem consistent (ie confusing).
|
Sat 02 Nov 2013 07:30:08 AM UTC, comment #2:
This is the behavior of edit.m. Files with extensions .m or .cc are created by edit.m with the usual comments at the beginning. The request to open other files (including .c) are directly passed to the editor.
The option in the settings just controls the behavior of the gui's editor not that of edit.m.
|
Sat 02 Nov 2013 02:14:17 AM UTC, comment #1:
This is related to bug # 40312
https://savannah.gnu.org/bugs/?40312
I'll cc Torsten
|
Sat 02 Nov 2013 12:17:00 AM UTC, original submission:
I dont think its been mentioned:
If I run the command edit x.c (x.m is does not exist) and I dont have set the create without prompting option, then I get a dialog box asking to create.
If I run edit x.m (x.m does not exist) it just silently makes the new file - no matter on the settings.
To be consistent it should prompt to create the m-file as well.
|