Hiya, Matlab-shell uses dirtrack, or shell-directory-tracker. It just watches the input stream and changes default-directory when it sees:
cd /some/path/to/directory I'll guess MATLAB syntax around (['/path']) is confusing it. You could probably replace all the parens etc with just: cd '/path' which should work fine. I tried this with a DOS shell in Emacs and Emacs followed the path even though the actual shell threw and error. Eric -----Original Message----- From: Uwe Brauer [mailto:o...@mat.ucm.es] Sent: Friday, February 24, 2017 11:57 AM To: matlab-emacs-discuss <matlab-emacs-discuss@lists.sourceforge.net> Subject: [Matlab-emacs-discuss] annoying path behavior of the *MATLAB* shell buffer who is the culprit Hi all I find the following quite annoying and look desperately for a solution. I am using the following structure Dir-Matlab/dir1/test.m Dir-Matlab/dir2/test2.m Now I open test.m and run matlab-shell-save-and-go I see >> cd(['/home/oub/ALLES/Dir-Matlab/dir1/']) >> test y = 64 Which is ok, so I open test2.m in dir2 and do the same, again the shall does it nicely >> cd(['/home/oub/ALLES/Dir-Matlab/dir2/']) >> test2 y = 49 And indeed >> pwd tells me /home/oub/ALLES/Dir-Matlab/dir2 Which is ok. However when I use find-file, in the *MATLAB* shell, then the buffer of the matlab shell thinks that I am still in dir1. Find file: ~/ALLES/Dir-Matlab/dir1/ How can I tell the buffer that I am running that I am in the dir2? Or in other words >> cd(['/home/oub/ALLES/Dir-Matlab/dir2/']) should be reflected in the *MATLAB* buffer Anybody has an idea how to achieve that? The only idea which occurred to me is this function (defun my-matlab-switch-and-save-default-directory () (interactive) (let ((saved-default-directory default-directory)) (switch-to-buffer "*MATLAB*") (setq default-directory saved-default-directory))) Which should somehow be included in matlab-shell-save-and-go, any suggestions? Regards Uwe Brauer ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss