Sure, here it is.
Regards
Julien
Le mar. 4 mai 2021 à 15:12, Uwe Brauer <[email protected]> a écrit :
> >>> "JCvM" == Julien Claisse via Matlab-emacs-discuss <
> [email protected]> writes:
>
> > Hi,
> > First, thanks to the developer team for maintaining this emacs package.
> I'm
> > using it almost every day.
>
> > I'm sending this mail because I want to suggest one improvement in the
> > emacsrunregion.m matlab function for being able to use it into a tramp
> > opened file (I'm also doing a lot of remote development on several
> targets).
>
> > This improvement is relatively straightforward, it adds the following
> lines
> > at the beginning of the function :
>
> > modified toolbox/emacsrunregion.m
> > @@ -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
>
> The patch is damaged by the MTA, could you please send it again, as an
> attachment?
>
--
Cordialement, Kind regards
*Julien Claisse*
Software Engineer
*Moduleus S.A.S,*
34 rue Pierre et Marie Curie
37100 Tours, France
+33 (0)2 47 49 08 16 <+33%202%2047%2049%2008%2016>
www.moduleus.com
diff --git a/toolbox/emacsrunregion.m b/toolbox/emacsrunregion.m
index b93c54a..3e7baa2 100644
--- a/toolbox/emacsrunregion.m
+++ b/toolbox/emacsrunregion.m
@@ -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
\ No newline at end of file
+end
_______________________________________________
Matlab-emacs-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss