Update: This bug goes away if I change my m file encoding from utf-8-unix to us-ascii-unix. Matlab's fileread() routine only seems to works correctly if the m-file is encoded as ASCII (and maybe a few other non-UTF8 systems, I'm not sure.) This exception should probably be handled by the code in the function emacsrunregion.
Karthik Karthik Chikmagalur <karthikchikmaga...@gmail.com> writes: > - What is the best way to report bugs pertaining to the modernize > branch? > > - Bug in emacsrunregion.m: > > There seems to be a difference in the way Emacs and Matlab count > characters in my m files. The region I send from Emacs and the region > being used in the line > > ,---- > | ETXT = TXT(startchar:endchar); > `---- > > in `emacsrunregion.m' are often (but not always) off by a characters, > leading to inconsistent behavior and errors. > > For example, with this code I wrote in `test.m': > ,---- > | %% Load mat file with white noise input > | > | load 'white_noise_input.mat' > | % > | % % Use same input for discretized only and discretized+lifted > | % timesteps_lifted = 16384 > | %% Initialize the lifted system > | > | N = 100; > | > | % Damping coefficient > | % ------------------- > | damping_coeff = 0.000; % no damping > | % k = 0.005; %damping coefficient, was 0.005 -> damping ratio = k/(1*omega) > = 0.025 > `---- > > I select the following region and run `matlab-shell-run-region': > > ,---- > | %% Initialize the lifted system > | > | N = 100; > | > | % Damping coefficient > | % ------------------- > | damping_coeff = 0.000; % no damping > `---- > > which prints > ,---- > | >> emacsrunregion('./test.m',164,287) > `---- > > This throws a bunch of errors. Here is the region that's actually being > evaluated (note the same character range): > > ,---- > | >> TXT = fileread('./test.m'); > | >> TXT(164:287) > | > | ans = > | > | '6384 > | %% Initialize the lifted system > | > | N = 100; > | > | % Damping coefficient > | % ------------------- > | damping_coeff = 0.000; % ' > `---- > > Which is off by a few characters. All my m files are encoded as > utf-8-unix, if that helps. > > - Also, I had a question regarding how `eval' works in Matlab. It > appears that it does not maintain state, i.e., eval sets up an > environment for execution that it discards once it's done executing > the region/line that was sent. This makes interactive Matlab coding > (switching back and forth between the m file and `matlab-shell') > almost impossible, where in earlier versions the state in > `matlab-shell' was persistent. Is this intended behavior? > > Karthik Chikmagalur > > Uwe Brauer <o...@mat.ucm.es> writes: > >> Hello everybody >> >> * New Branch: modernize >> >> Currently Eric is submitting a lot of changes to the emacs matlab >> packages. Thanks a lot Eric! >> >> Some of the changes/feature which are currently under work have been >> announced by Eric in a mail to the list, sent at 11 of October. >> >> His contributions are committed not to master but to a new branch, >> called called modernize, so it is not merged into master, yet. >> >> I am trying to test his commits, but I would prefer if more users would >> join me to get a better feedback. >> >> Here is what you have to do. >> >> * Git users >> >> git clone https://git.code.sf.net/p/matlab-emacs/src matlab-emacs-src >> >> git checkout modernize >> >> * Mercurial users >> >> install and activate the hg-git plugin >> >> hg clone https://bitbucket.org/durin42/hg-git/ >> >> then in your .hgrc file something like this >> >> hggit = /home/user/src/hg-git/hggit >> >> [git] >> export-additional-refs.named-branch-heads:revset = head() and not closed() >> export-additional-refs.named-branch-heads:template = >> refs/heads/hg_named_branch/{branch} >> >> hg clone https://git.code.sf.net/p/matlab-emacs/src emacs-hg >> >> >> hg up modernize >> >> >> * Compilation >> Run >> >> make >> >> * Set the path >> >> Now set the path in your init file, for example >> >> (setq load-path (cons (expand-file-name >> "~/emacs/site-lisp/packages/src/Matlab/matlab-emacs-src") load-path)) >> >> Add >> >> (load-library "matlab-load") >> (matlab-cedet-setup) >> >> Optionality >> (semantic-mode 1) >> (global-semantic-stickyfunc-mode 1) >> (global-semantic-decoration-mode 1) >> >> >> * News >> >> 1. The debugger works better now, at least this is my impression. >> >> 2. matlab-shell-run-cell has been completely rewritten. Now it >> possible to have a cell which execute a function, which is >> defined at the end of this very same file. >> >> 3. Faster load time by moving rarely used content into other files. >> >> 4. Support for some older Emacs' has been deleted. >> >> 5. Clicking on errors or using next-error in matlab-shell should work >> better. >> >> 6. tab completion in the shell was revamped (but should act mostly >> the same) >> >> 7. Other bug fixes to editing ML code. >> >> >> Regards >> >> Uwe >> _______________________________________________ >> 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