I already installed matlab-mode from the package list. However, not sure
where to add the path in ~/.spacemacs. Its a huge file, and the code structure look different from the path file:

(autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
'("\\.m$" . matlab-mode))
(setq matlab-indent-function t)
(setq matlab-shell-command "matlab")

1 Answer 1


I think you may want to install matlab mode fromt he extra-langs layer. In your dotspacemacs/configuration-layers you can add the line: (extra-langs :variables matlab-mode).

Maybe this is what you said you did already though.

I don't think you have to add a path to the .spacemacs file. matlab-mode should just start up when you open a matlab file in emacs. And if for some reason it doesnt you can enable it with SPC SPC matlab-mode.

As to those variables you have though (matlab-indent-function and matlab-shell-command), they should go in dotspacemacs/user-config in the .spacemacs file.

Maybe you can put them in a hook with a function that initializes your matlab variables. The whole thing might look like this:

    (defun dotspacemacs/user-config ()
      (defun init-matlab ()
        "Initializes my configuration for matlab mode."
        (setq matlab-indent-function "")
        (setq matlab-shell-command ""))

      (add-hook 'matlab-mode-hook 'init-matlab)
  • Thank you for the quick and clear answer. but still I could not run it (searching for program: No such file or directory, matlab Aug 4, 2017 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.