From: Eric L. <el...@ma...> - 2005-12-02 16:43:35
|
Hi, Thanks. I know this feature is something I have had some requests for. I like the idea of using paragraph-start, though I do not know the origins of the current values. Another option might be to use page-delimiter instead. What is a paragraph of M code anyway? ;) Eric >>> mail-vif.mathworks.com ([144.212.95.18]) by MESSAGE-AH.ad.mathworks.com with Microsoft SMTPSVC(6.0.3790.211); seems to think that: >Hi all, > >In light of the new mailing list I thought I'd share this. I kludged >up the following snippet to mimic the Matlab editor's ability to run >a block of code between two "%%" markers. It also allows you to use >"paragraph-forward" and "-backwards" on chunks of code. > >Cheers, Jody > > >(defun jmk-matlab-parastart () > "Set the paragraph start for matlab mode." > (interactive) > (make-local-variable 'paragraph-start) > (setq paragraph-start "^\%\%" ) > (make-local-variable 'paragraph-separate) > (setq paragraph-separate "^\%\%" )) > >(add-hook 'matlab-mode-hook 'jmk-matlab-parastart) > >;; Matlab function for evaluating the current "paragraph" >(defun jmk-matlab-run-para () > "Run the current paragraph." > (interactive) > (save-excursion > (if mark-active (matlab-eei-eval-region (region-beginning) >(region-end)) > (backward-paragraph) > (setq beg (point)) > (forward-paragraph) > (setq end (point)) > (matlab-eei-eval-region beg end)))) -- Eric Ludlam The MathWorks x 7556 el...@ma... http://www.siege-engine.com http://www.mathworks.com |