0

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)
(add-to-list
'auto-mode-alist
'("\\.m$" . matlab-mode))
(setq matlab-indent-function t)
(setq matlab-shell-command "matlab")

1 Answer 1

0

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."
        (interactive)
        (setq matlab-indent-function "")
        (setq matlab-shell-command ""))

      (add-hook 'matlab-mode-hook 'init-matlab)
      )
2
  • Thank you for the quick and clear answer. but still I could not run it (searching for program: No such file or directory, matlab Commented Aug 4, 2017 at 19:06
  • This layer has been renamed to major-modes (without mentioning this in the documentation) six years ago. Commented Nov 27, 2023 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.