Skip to content

Instantly share code, notes, and snippets.

@xcv58
Created November 18, 2013 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xcv58/7534683 to your computer and use it in GitHub Desktop.
Save xcv58/7534683 to your computer and use it in GitHub Desktop.
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