Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Matlab-Emacs. Fixed matlab-shell-run-cell ()
(defun matlab-shell-run-cell ()
"Run the cell the cursor is in."
(interactive)
(let ((start (save-excursion (end-of-line);(forward-page -1)
(re-search-backward "\\(%%\\)\\|\\`")
(if (looking-at "function")
(error "You are not in a cell. Try `matlab-shell-save-and-go' instead"))
(point)))
(end (save-excursion (end-of-line)
(re-search-forward "\\(%%\\)\\|\\'")
(point))))
(matlab-shell-run-region start end t)))
(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 t)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.