How to pass commandline arguments to external text editor?
Mostrar comentarios más antiguos
I want to use emacsclient to edit .m files opened through matlab. The Preferences > Editor/Debugger section has an option to configure an external text editor. Using
C:\Program Files\Emacs\x86_64\bin\runemacs.exe
works as expected. However, starting emacsclient requires commandline arguments:
C:\Program Files\Emacs\x86_64\bin\emacsclientw.exe -n -c -a ""
Adding this (or even just the required bare minimum -c flag) as the external editor and opening a .m file opens a cmd window showing the error:
'"C:\Program Files\Emacs\x86_64\bin\emacsclientw.exe -c"' is not recognized as an internal or external command,
operable program or batch file.
Is there an option to include commandline arguments?
1 comentario
Nishant Elkunchwar
el 11 de Feb. de 2022
Respuesta aceptada
Más respuestas (2)
Fangjun Jiang
el 11 de Feb. de 2022
0 votos
You need to run system("C:\Program Files\Emacs\x86_64\bin\emacsclientw.exe -n -c -a")
or add this line to your own edit.m file
2 comentarios
Nishant Elkunchwar
el 11 de Feb. de 2022
Fangjun Jiang
el 11 de Feb. de 2022
I meant if exeternal .exe file requries arguments, then you can run the system() in Command Window, or make your own edit.m file to include the system() line. Then you can run "edit" in Comand Window to bring up your own Editor.
Image Analyst
el 11 de Feb. de 2022
Here is an example of how I pass two filenames to my calibration chart editor program:
% Now run the Calibration Chart editor program.
% First construct the command line for the system() function.
% Enclose all filenames in double quotes because we may have spaces in the filenames.
editorFullFileName = 'C:\Program Files (x86)\CalibrationChartEditor\CalibrationChartEditor.exe';
arguments = sprintf('-chartfile "%s" -chartimage "%s"', fullRefChartDataFileName, fullRefChartImageFileName);
commandLine = sprintf('"%s" %s', editorFullFileName, arguments);
fprintf('\n%s\n', commandLine);
%----------------------------------------------------------
% Now launch the Calibration Chart editor program using the "system()" function.
% msgboxw(commandLine);
system(commandLine);
Note, if you're passing in strings that have spaces in them, they must be enclosed in double quotes, like I did.
Categorías
Más información sobre File Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!