Hi,

I'm posting this patch for improving the matlab-shell-save-and-go command.
I'm not sure to understand all the different parts/customization of this
function but, in my case (by default) I end up at the end of it : where it
tries to run the full path file using the matlab "run" command.
This works only if the matlab shell is in the current file directory.
Moreover, it works only with scripts (no matlab function).
Here is my proposition:
@@ -2166,2 +2166,4 @@ Similar to  `comint-send-input'."
-     ;; If not changing dir, maybe we need to use 'run' command instead?
-     (let ((cmd (concat "run('" dir fn-name "')")))
+     ;; If not changing dir, maybe we need to use addpath command before
+     (let ((cmd (concat "addpath('" dir "')")))
+       (matlab-shell-send-command cmd))
+     (let ((cmd (concat fn-name param)))

Instead of using the run matlab function, first, we addpath the file
directory and then, we run the file with parameters if any. This way, we
can run a script or a function from within any location.
I check that addpath at each time do not increase the path uselessly:
matlab does nothing if it is already into the path.

Regards,

*Julien Claisse*
diff --git a/matlab-shell.el b/matlab-shell.el
index b2943d8..d7b063c 100644
--- a/matlab-shell.el
+++ b/matlab-shell.el
@@ -2163,8 +2163,10 @@ Similar to  `comint-send-input'."
 		(matlab-shell-send-string (concat cmd "\n"))
 		))
       
-	  ;; If not changing dir, maybe we need to use 'run' command instead?
-	  (let ((cmd (concat "run('" dir fn-name "')")))
+	  ;; If not changing dir, maybe we need to use addpath command before
+	  (let ((cmd (concat "addpath('" dir "')")))
+	    (matlab-shell-send-command cmd))
+	  (let ((cmd (concat fn-name param)))
 	    (matlab-shell-send-command cmd)))
 	))))
 
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to