Skip to content

Instantly share code, notes, and snippets.

@failable
Created July 16, 2015 08:17
Show Gist options
  • Save failable/2f8c356e2e903ecf6a6c to your computer and use it in GitHub Desktop.
Save failable/2f8c356e2e903ecf6a6c to your computer and use it in GitHub Desktop.
(use-package matlab
:ensure matlab-mode
:mode ("\\.m\\'" . matlab-mode)
:init
(setq matlab-shell-command-switches '("-nodesktop" "-nosplash")
matlab-auto-fill nil
matlab-comment-region-s "% "
matlab-case-level '(4 . 4)
matlab-indent-function-body t
matlab-functions-have-end t
matlab-shell-input-ring-size 1000)
:config
(unbind-key "<return>" matlab-mode-map)
(unbind-key "M-;" matlab-mode-map)
(unbind-key "C-c ;" matlab-mode-map)
(defun matlab-shell-run-buffer ()
(interactive)
(matlab-shell-run-region (point-min) (point-max)))
(defun matlab-imenu-setup ()
(setq imenu-generic-expression
'(("Function"
"\\(function\\)[\n\t ]*\\[?[ ,_A-Za-z0-9]+\\]?[\n\t ]*=[\n\t ]*\\([_A-Za-z0-9]+\\)" 2)
("Anonymous Function"
"\\_<\\([_A-Za-z0-9]+\\)[\n\t ]*=[\n\t ]*@[\n\t ]*([, _A-Za-z0-9]+)" 1))))
(add-hook 'matlab-mode-hook 'matlab-imenu-setup)
(bind-keys :map matlab-mode-map
("C-<return>" . matlab-comment-return)
("C-c C-z" . matlab-shell)
("C-c C-e" . matlab-shell-run-region-or-line)
("C-c C-c" . matlab-shell-run-buffer)))
(provide 'init-matlab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment