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?

Stefan
  • 26,154
  • 3
  • 46
  • 84
vvel
  • 11
  • 1
  • Aware that this is an old post, is this still giving out an error? My call for matlab-mode is similar to yours and it works just fine, i.e., calling matlab-mode instead of matlab. – Ajned Jul 24 '21 at 06:27

1 Answers1

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"))
jue
  • 4,476
  • 8
  • 20