Hi Uwe,

Directory tracking in the shell is handled by comint mode with 
`shell-dirtrackp'.   I snooped around in comint but to be honest, I don't know 
why your code snippet doesn't trigger dirtracking where typing it in yourself 
would work.

It may be that matlab-shell-collect-command-output and other functions that 
call `comint-send-string' should instead call `comint-send-input' after editing 
the command line.   You could give it a try and see if it helps.

Eric

-----Original Message-----
From: Uwe Brauer [mailto:o...@mat.ucm.es] 
Sent: Wednesday, June 24, 2015 4:09 AM
To: matlab-emacs <matlab-emacs-discuss@lists.sourceforge.net>
Subject: [Matlab-emacs-discuss] change directory, matlab-shell

Hello

Here is the scenario (usually happens when I correct a bunch of matlab files in 
different directories).

 Dir1 contains 3 matlab files
 dir2 contains 3 matlab files

I open one file in dir1 and execute the code for example via 
matlab-shell-save-and-go I do the same with the other files but then I change 
to 

dir2 and open the first file: when I now execute the code it sometimes does not 
run, since the matlab-shell presumes it is still in dir 1. So I execute the 
following hack.

(defun matlab-cd-dir-actual ()
  (interactive)
  (matlab-shell-run-command
   (concat "cd " (file-name-directory (buffer-file-name))))
  (message (concat "*MATLAB* (& lisp) dir: " (default-directory)))
  (setq default-directory (file-name-directory (buffer-file-name))))

So far so good.

However when I switch to the matlab-shell and want to open a file via find-file

Then (X)emacs still seems to think that I am in dir1 and offers
~/matlabfiles/dir1

Instead of 

~/matlabfiles/dir2

When I execute
pwd in the matlab-shell  I receive 

 ans=
 /home/oub/matlabfiles/dir2

As it should be.

So maybe this is more a question of (X)emacs, but why does my function not work 
as expected.

Thanks 

Uwe Brauer 



------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors network 
devices and physical & virtual servers, alerts via email & sms for fault. 
Monitor 25 devices for free with no restriction. Download now 
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

------------------------------------------------------------------------------
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to