|
From: Jody K. <jk...@uc...> - 2005-12-01 22:04:24
|
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))))
|