I'm using Octave 6.2.0 with Notepad++ as the custom file editor. When I type edit myfunction
from the CLI, the file opens normally, but when I type the same thing from the GUI, the last file that I had open in Notepad++ displays, as if I had opened Notepad++ by itself from Windows Explorer (I'm using Windows 10). In the GUI, it's the same behavior as typing edit
without an argument, whereas it works as expected in the CLI. It seems that my GUI is ignoring the edit
function input argument, and passing the argument as a string in parentheses, i.e. edit('myfunction')
or edit('myfunction.m')
didn't help. Is there a way to change this?
Asked
Active
Viewed 419 times
0

smcmi
- 106
- 8
-
See this similar question: [Changing the Default Editor on Octave comes with an Error Message](https://stackoverflow.com/questions/62361356/changing-the-default-editor-on-octave-comes-with-an-error-message) – mspilsbury Oct 10 '21 at 08:01
2 Answers
0
When you're in the GUI octave ignores the EDITOR env variable, and uses the built-in editor.
However, in the preferences / editor dialogue of the octave gui, there is an option to specify a custom editor. This will probably do what you want.

Tasos Papastylianou
- 21,371
- 2
- 28
- 57
-
I have the custom editor set to Notepad++, which indeed does switch to using that program over the native Octave editor, but still only the CLI version will open a specific .m file with the `edit` function, whereas the GUI opens it like Windows Explorer does, bringing up the most recently viewed file. – smcmi Jul 29 '21 at 12:45
-
1If you read that section properly, it mentions that `%f` will be substituted with the filename, and `%l` will be substituted with the line number. This means you need to use these to tell notepad++ which file to open (and at which line, if necessary), in the same way you would do this if you were invoking notepad++ from the commandline. If the only thing you have in that box is `notepad++`, then basically whenever you invoke the edit command, octave runs the `notepad++` command, without arguments, which simply opens notepad++ (and it so happens that notepad++ opens in 'most recent file' mode). – Tasos Papastylianou Jul 29 '21 at 13:40
-
-
I have the full path and .exe filename, i.e. `C:\Program Files (x86)\Notepad++\notepad++.exe` in the custom file editor line, as well as `EDITOR` set to that same path/file. Using `EDITOR()` in that line causes an error window to say that Octave cannot start that custom file editor, and adding `%f` to either the full path/file or to `EDITOR()` causes a similar error message box. – smcmi Jul 29 '21 at 16:51
-
EDITOR is not relevant here. This is a GUI preference. All the above is for the relevant edit field in the GUI preferences. Try using double quotes around the whole thing or just "%f" (or on both the notepad++ and the %f bits separately). – Tasos Papastylianou Jul 29 '21 at 20:12
0
Use the full path to Notepad++ and %f
in double quotes in the custom file editor specification in the preferences menu, i.e.
C:\Program Files (x86)\Notepad++\notepad++.exe "%f"

smcmi
- 106
- 8
-
-
1@TasosPapastylianou, that didn't work for me, but double quotes around the `%f` does. Thanks for your help with this. – smcmi Jul 30 '21 at 14:04