Apply patch provided by Julien Claisse (trump support)

* toolbox/emacsrunregion.m (emacsrunregion):
          Apply a patch provided by Julien Claisse: trump support
This commit is contained in:
Uwe Brauer 2021-05-04 16:39:41 +02:00
parent 587ad07306
commit c5824936cc
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2021-05-04 Uwe Brauer <oub@mat.ucm.es>
* toolbox/emacsrunregion.m (emacsrunregion):
Apply a patch provided by Julien Claisse: trump support
2021-02-25 John Ciolfi ciolfi@mathworks.com
* tlc.el (new version 1.3): revamped implementation
1. Make tlc indent by 4 spaces. Previously we were indenting by 2 spaces

View File

@ -2,6 +2,12 @@ function emacsrunregion(file, startchar, endchar)
% Run code from FILE between STARTCHAR and ENDCHAR.
% Command sent by Emacs for run-cell & run-region functionality.
% Filter out emacs tramp file path prefix
trampMatch = regexp(file, {'/*:',':/'});
if (~isempty(trampMatch{1}))
file = file((trampMatch{2}+1):end);
end
if ~exist(file,'file')
error('You must save your region into a file accessible by MATLAB process.');
end
@ -21,4 +27,4 @@ function emacsrunregion(file, startchar, endchar)
txt = fileread(file);
evalTxt = txt(startchar:min(endchar,length(txt)));
evalin('base',evalTxt);
end
end