1

I am trying to use the matlab-mode package with use-package.

in my init.el:

(use-package matlab-mode
  :ensure t
  :config
  (add-to-list
   'auto-mode-alist
   '("\\.m\\'" . matlab-mode))
  (setq matlab-indent-function t)
  (setq matlab-shell-command "matlab"))

This seems to work - the package is downloaded and installed if necessary, the mode is automatically enabled in .m files, but everytime I launch Emacs I get the warning Error (use-package): Cannot load matlab-mode. Can anybody tell me why this happens?

1

The package name is matlab-mode but the provided feature is matlab. Have a look at the very end of that source code file.

According to use-package Manual you have to get that right.

So your use-package declaration should look like this:

(use-package matlab
  :ensure matlab-mode
  :config
  (add-to-list
   'auto-mode-alist
   '("\\.m\\'" . matlab-mode))
  (setq matlab-indent-function t)
  (setq matlab-shell-command "matlab"))
| improve this answer | |

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.