|
| 1 | +# File: doc/matlab-mode-on-windows.org |
| 2 | + |
| 3 | +# Copyright 2016-2025 Free Software Foundation, Inc. |
| 4 | + |
| 5 | +#+startup: showall |
| 6 | +#+options: toc:nil |
| 7 | + |
| 8 | +#+title: MATLAB Mode on Windows |
| 9 | + |
| 10 | +To use Emacs on Windows with the matlab-mode package, |
| 11 | + |
| 12 | +1. Install Emacs 30.1 from https://www.gnu.org/software/emacs/ |
| 13 | + |
| 14 | +2. Install MSYS2 from https://www.msys2.org/. MSYS2 provides utilities which are needed for Emacs |
| 15 | + operations. Next install packages that Emacs will need. To search for packages, use =pacman -Ss NAME=. |
| 16 | + These are needed by common Emacs operations: |
| 17 | + |
| 18 | + : C:> bash |
| 19 | + : $ pacman -S zip |
| 20 | + : $ pacman -S unzip |
| 21 | + : $ pacman -S man |
| 22 | + |
| 23 | + [Optional] Install GCC which is needed for [[file:matlab-tree-sitter.org]] and perhaps other |
| 24 | + items. Assuming you have an Intel 64-bit processor, |
| 25 | + |
| 26 | + : C:> bash |
| 27 | + : $ pacman -S gcc |
| 28 | + : $ cc --version # This should be gcc and 'cc' needed by tree-sitter |
| 29 | + |
| 30 | +3. Install gpg from https://www.gpg4win.org/. Note there is a version gpg.exe in MSYS2 that does not |
| 31 | + work with the Emacs 30.1 package manager. Therefore, install gpg4win and place that gpg on the |
| 32 | + PATH before the gpg from MSYS2. |
| 33 | + |
| 34 | +4. Create ~/.emacs containing: |
| 35 | + |
| 36 | + #+begin_src emacs-lisp |
| 37 | + (require 'package) |
| 38 | + (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) |
| 39 | + |
| 40 | + ;; Required by M-x grep-find |
| 41 | + (setq find-program "C:/msys64/usr/bin/find.exe") |
| 42 | + #+end_src |
| 43 | + |
| 44 | +5. Install https://github.com/mathworks/Emacs-MATLAB-Mode |
| 45 | + |
| 46 | + + In Emacs, =M-x list-packages= and click on the https://melpa.org, melpa version matlab-mode to |
| 47 | + install the latest. the gnu version is the last major release found on |
| 48 | + https://elpa.gnu.org/. Generally, the melpa version is better. See the NEWS.org on |
| 49 | + https://github.com/mathworks/Emacs-MATLAB-Mode for the latest info. |
| 50 | + |
| 51 | + : matlab-mode VERSION available gnu |
| 52 | + : matlab-mode VERSION available melpa |
| 53 | + |
| 54 | +6. Install =company= for completions via =M-x list-packages= and clicking on =company= to |
| 55 | + install. You may want to use the latest from MELPA, though either the GNU elpa version or MELPA |
| 56 | + version should be fine. |
| 57 | + |
| 58 | +7. [Optional] Install flycheck, lsp-mode, and lsp-ui. Run =M-x list-packages=, search for them and |
| 59 | + install them. Then install the MATLAB Lanugage Server, see |
| 60 | + [[file:matlab-language-server-lsp-mode.org]]. |
| 61 | + |
| 62 | +8. [Optional]. Use bash for =M-x shell= |
| 63 | + |
| 64 | + + =M-x customize-variable RET shell-file-name RET= and set to ="C:/msys64/usr/bin/bash.exe"= |
| 65 | + |
| 66 | + + Add to =~/.emacs= |
| 67 | + |
| 68 | + #+begin_src emacs-lisp |
| 69 | + ;; Prompt, PS1 setup for M-x shell |
| 70 | + (setenv "PS1" "\\[\\e[32m\\]\\u@\\h \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\$ ") |
| 71 | + #+end_src |
| 72 | + |
| 73 | +9. [Optional] Install =magit= for Git by =M-x list-packages=, then clicking on =magit= from melpa |
| 74 | + to install. |
0 commit comments