From: Uwe B. <ou...@ma...> - 2012-02-18 15:16:32
|
Hello Below you find a test file which works fine in built in editor: --8<------------------------schnipp------------------------->8--- %% hallo %% disp('again') y=8 %% z=8--8 <------------------------schnapp------------------------->8--- when running on the first cell matlab complains about hallo not being known, when running about the second cell everything works fine. As I mentioned in an earlier mail, matlab-shell-run-region works in the current version contra intuitive. I don't know whether the patch I sent was accepted. In any case when I use matlab-shell-run-cell then matlab-run-shell-region runs over the *whole* file (GNU emacs 23.1 or Xemacs 21.5.31 Mule) I debugged matlab-shell-run-cell: The reason is the bizarre (forward-page -1) which jumps to the beginning of the buffer Before I start to experiment with the code: - What is the purpose of the forward-page code? - What is your opinion about the behaviour of matlab-shell-run-region? (defun matlab-shell-run-cell () "Run the cell the cursor is in." (interactive) (let ((start (save-excursion (forward-page -1) (if (looking-at "function") (error "You are not in a cell. Try `matlab-shell-save-and-go' instead")) (when (matlab-ltype-comm) ;; Skip over starting comment from the current cell. (matlab-end-of-command 1) (end-of-line) (forward-char 1)) (point))) (end (save-excursion (forward-page 1) (when (matlab-ltype-comm) (beginning-of-line) (forward-char -1)) (point)))) (matlab-shell-run-region start end))) |