{"id":19129734,"url":"https://github.com/mathworks/emacs-matlab-mode","last_synced_at":"2026-02-22T17:29:23.655Z","repository":{"id":254580390,"uuid":"843446576","full_name":"mathworks/Emacs-MATLAB-Mode","owner":"mathworks","description":"Edit, lint, debug, and run MATLAB in Emacs","archived":false,"fork":false,"pushed_at":"2026-02-08T13:06:53.000Z","size":9197,"stargazers_count":23,"open_issues_count":18,"forks_count":4,"subscribers_count":6,"default_branch":"default","last_synced_at":"2026-02-08T20:05:53.487Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathworks.png","metadata":{"files":{"readme":"README.org","changelog":"NEWS.org","contributing":"contributing/.dir-locals.el","funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-16T14:32:12.000Z","updated_at":"2026-02-08T13:06:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cccd76b-b770-4169-9279-1e46ecb61877","html_url":"https://github.com/mathworks/Emacs-MATLAB-Mode","commit_stats":null,"previous_names":["mathworks/emacs-matlab-mode"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/mathworks/Emacs-MATLAB-Mode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FEmacs-MATLAB-Mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FEmacs-MATLAB-Mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FEmacs-MATLAB-Mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FEmacs-MATLAB-Mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathworks","download_url":"https://codeload.github.com/mathworks/Emacs-MATLAB-Mode/tar.gz/refs/heads/default","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2FEmacs-MATLAB-Mode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29720563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T15:10:41.462Z","status":"ssl_error","status_checked_at":"2026-02-22T15:10:04.636Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T06:08:21.612Z","updated_at":"2026-02-22T17:29:23.645Z","avatar_url":"https://github.com/mathworks.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+startup: showall\n#+options: toc:nil\n\n# Copyright (C) 2016-2025 Free Software Foundation, Inc.\n\n* Emacs MATLAB-mode\n\n[[https://mathworks.com][MathWorks]] MATLAB® and [[https://www.gnu.org/software/emacs/][GNU Emacs]] integration:\n\n1. MATLAB mode, *matlab-ts-mode* or *matlab-mode*, for editing ~*.m~ files.\n\n   - Edit MATLAB code with syntax highlighting, indentation (code formatting), and semantic\n     movement.\n   - Lint MATLAB code with fix-it's using the MATLAB Code Analyzer.\n\n   The *matlab-ts-mode* is a more capable, performant, and accurate than *matlab-mode*.\n\n2. *Code navigation and more*\n\n   - The [[file:doc/matlab-language-server-lsp-mode.org][MATLAB Language Server with Emacs]], matlabls, provides code navigation, code completion, go\n     to definition, find references, and more.\n\n   - Imenu support for quickly jumping to function declarations in the current ~*.m~ or ~*.tlc~\n     file.  See [[file:doc/matlab-imenu.org][doc/matlab-imenu.org]].\n\n3. *M-x matlab-shell* for running and debugging MATLAB within Emacs (Unix only).\n\n   - MATLAB command window errors are hyper-linked and files open in Emacs\n   - Debugging support is available from the MATLAB menu.\n   - matlab-shell uses company-mode for completions.\n\n   See [[file:doc/matlab-shell-for-unix.org][doc/matlab-shell-for-unix.org]]\n\n4. *M-x matlab-shell* to run remote Unix MATLAB within your local Emacs session.\n\n   #+begin_example\n     +----------------+                 +-----------------+\n     | Local Computer |                 | Remote Computer |\n     |                |\u003c===============\u003e|                 |\n     |     Emacs      |      ssh        |      MATLAB     |\n     +----------------+                 +-----------------+\n   #+end_example\n\n   You use Emacs on your local computer to edit files on the remote computer, run and debug remote\n   MATLAB in a matlab-shell in your local Emacs.  See [[file:doc/remote-matlab-shell.org][doc/remote-matlab-shell.org]].\n\n5. *M-x matlab-netshell* for running MATLAB code on Microsoft Windows within Emacs using an attached\n   MATLAB.\n\n   #+begin_example\n    +--------------- Emacs ----------------+         +------------  MATLAB  ------------+\n    |                                      |         |                                  |\n    | (1) M-x matlab-netshell-server-start |         | (2) connect to Emacs             |\n    |                                      |\u003c=======\u003e| \u003e\u003e addpath \u003cmatlab-mode\u003e/toolbox |\n    | (3) Visit script *.m files and use   |         | \u003e\u003e emacsinit                     |\n    |     \"MATLAB -\u003e Code Sections\" menu   |         | \u003e\u003e                               |\n    |     or the key bindings              |         |                                  |\n    +--------------------------------------+         +----------------------------------+\n   #+end_example\n\n6. *Code sections* support for MATLAB script files. See [[file:doc/matlab-code-sections.org][doc/matlab-code-sections.org]].\n\n   - After visiting a MATLAB script, you have a *\"MATLAB -\u003e Code Sections\"* menu and key bindings\n     which lets you navigate, run, and move code sections.\n\n   - Try out code sections using: [[file:examples/matlab-sections/tryout_matlabsection.m][./examples/matlab-sections/tryout_matlabsection.m]].\n\n7. *Creation of scientific papers, theses, and documents* using MATLAB and [[http://orgmode.org]].\n\n   - Org enables [[https://en.wikipedia.org/wiki/Literate_programming][literate programming]] which directly supports reproducible research by allowing\n     scientists and engineers to write code along with detailed explanations in natural language.\n\n   - You author code plus natural language descriptive text in ~*.org~ files. When you evaluate\n     MATLAB or other language code blocks within the ~*.org~ files, org inserts the results back\n     into the ~*.org~ file.\n\n   - You can combine multiple ~*.org~ files into one final document, thus enabling larger scientific\n     documents.\n\n   - See [[file:examples/matlab-and-org-mode][./examples/matlab-and-org-mode/]] to get started. This directory contains a [[file:examples/matlab-and-org-mode/matlab-and-org-mode.pdf][PDF]] generated from\n     [[file:examples/matlab-and-org-mode/matlab-and-org-mode.org][./examples/matlab-and-org-mode/matlab-and-org-mode.org]].\n\n8. *tlc-mode* for editing ~*.tlc~ files. The Target Language Compiler (TLC) is part of Simulink®\n   Coder™.\n\n* MATLAB Indent (Code Formatting)\n\nWith the optional matlab-ts-mode, you have [[file:doc/matlab_code_indent.org][MATLAB code indentation]] that\n\n - Adjusts the indent-level (the whitespace to the left of the code), and\n - Standardizes language element spacing, aligns consecutive statements, aligns matrices and\n   structs, adds missing commas to matrices.\n\nExample:\n\n  #+begin_src matlab\n    function out= indent_example(   in1, ...\n    input2)\n      % INDENT_EXAMPLE - an indent example\n         % This illustrates some of the capabilities of the matlab-ts-mode indent engine.\n\n        arguments\n            in1          = 10\n        input2= 20;\n    end\n\n          mat = [100,2 300.2\n                     3 400,4];\n\n          s = struct(  'f1',1, ...\n    'otherField', in1+input2);\n\n          a = 10; % comment for a\n          bLongVariable = [1.3   2,3 1 - 1 -1]    ;% comment for b\n          cVar = a+bLongVariable  * 2;          \n\n     if abs(sum(in1)) \u003e 0\n              out=s.f1/input2+ in1 -cVar;\n    else\n        out = mat+in1 * 2 -cVar;\n        end\n        end\n  #+end_src\n\nIs indented to the following using ~C-x h~ and then ~C-M-\\~ (or ~Edit -\u003e Select All~, then ~M-x\nindent-region~). Notice that in addition to adjusting the indent-level (whitespace to the left),\nlanguage element spacing has been standardized, statements have been aligned, trailing comments have\nbeen aligned matrices have been aligned, missing comma's are added to arrays, struct fields are\naligned, etc.\n\n  #+begin_src matlab\n    function out = indent_example(in1, ...\n                                  input2)\n    % INDENT_EXAMPLE - an indent example\n    % This illustrates some of the capabilities of the matlab-ts-mode indent engine.\n\n        arguments\n            in1    = 10\n            input2 = 20;\n        end\n\n        mat = [100,   2, 300.2\n                 3, 400,     4];\n\n        s = struct('f1',         1, ...\n                   'otherField', in1 + input2);\n\n        a             = 10;                     % comment for a\n        bLongVariable = [1.3, 2, 3, 1 - 1, -1]; % comment for b\n        cVar          = a + bLongVariable * 2;\n\n        if abs(sum(in1)) \u003e 0\n            out = s.f1 / input2 + in1 - cVar;\n        else\n            out = mat + in1 * 2 - cVar;\n        end\n    end\n  #+end_src\n\n* Installation\n\n1. Install the MATLAB package via [[https://melpa.org][MELPA]] or [[https://elpa.gnu.org/][ELPA]]. MELPA contains the latest version.  To install from\n   MELPA, add to your =~/.emacs=\n\n   #+begin_src emacs-lisp\n     (require 'package)\n     (add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\") t)\n   #+end_src\n\n   Restart Emacs and then\n\n   : M-x package-install RET matlab-mode RET\n\n   Note: to see all available packages, =M-x RET list-packages RET=\n\n2. [Optional] Install the =company= package which is used for TAB completions.\n\n   : M-x package-install RET company RET\n\n3. [Optional] Install MATLAB tree-sitter for matlab-ts-mode, which provides improved editing\n   capabilities and improved performance.\n\n   After installing =matlab-mode=\n\n   : M-x matlab-ts-grammar-install\n\n   The MATLAB tree-sitter leverages [[https://tree-sitter.github.io/tree-sitter/][Tree-sitter]] to create a parse tree for MATLAB code.  The parse\n   tree is updated incrementally and is robust to syntax errors. It is highly performant and\n   achieves this by being implemented in C to create a shared object that is loaded into the Emacs\n   process.  *matlab-ts-mode* leverages the MATLAB tree-sitter to give an improved MATLAB editing\n   experience when compared with matlab-mode.\n\n   See [[file:doc/install-matlab-tree-sitter-grammar.org][doc/install-matlab-tree-sitter-grammar.org]]\n\n4. [Optional] Install lsp-mode and the [[file:doc/matlab-language-server-lsp-mode.org][MATLAB Language Server]] for an improved editing capabilities.\n   Code navigation: jump to definition and back, find references, and rename symbols. Also provides\n   improved MATLAB code analyzer (mlint) message interaction.\n\n5. [Optional] Check your installation setup.\n\n   If you are using *matlab-ts-mode*, visit a =*.m= MATLAB file and select the menu item:\n\n   : MATLAB -\u003e Check setup\n\n** Install from this repository\n\nIf you are contributing to the Emacs MATLAB Mode package, see\n[[file:contributing/install-emacs-matlab-from-git.org][contributing/install-emacs-matlab-from-git.org]]\n\n* MathWorks Products ([[https://www.mathworks.com][https://www.mathworks.com]])\n\nEmacs MATLAB-mode is designed to be compatible with the last six years of MathWorks products and may\nsupport even older versions of MathWorks products.\n\n* License\n\nGPL3, https://www.gnu.org/licenses/gpl-3.0.en.html (see [[file:License.txt][License.txt]])\n\n* Community Support\n\n[[https://www.mathworks.com/matlabcentral][MATLAB Central]]\n\n* FAQ\n\nSee [[file:doc/faq.org][doc/faq.org]]\n\n* Mailing list\n\n[[mailto:matlab-emacs-discuss@lists.sourceforge.net]]\n\nhttps://sourceforge.net/projects/matlab-emacs/\n\n* Releases\n\nSee [[file:NEWS.org][NEWS.org]]\n\n# LocalWords:  showall nodesktop melpa emacsclient matlabsection lsp matlabls Imenu imenu netshell\n# LocalWords:  emacsinit ELPA faq mailto sourceforge libtree dylib langs treesit abi MSys alist\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks%2Femacs-matlab-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathworks%2Femacs-matlab-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks%2Femacs-matlab-mode/lists"}