branch: externals/matlab-mode
commit a4c5bc4fa3cdb90b9c381e8869b021288decd011
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: add instructions for use with org mode
---
README.org | 11 +++++++++++
matlab-ts-mode.el | 20 +++++++++++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/README.org b/README.org
index 0730b17ac6..19af90e05c 100644
--- a/README.org
+++ b/README.org
@@ -149,6 +149,17 @@
(add-to-list 'major-mode-remap-alist '(matlab-mode . matlab-ts-mode))
#+end_src
+ * Tell =org-mode= that =#+begin_src matlab ... #end_src= blocks should use
+ *matlab-ts-mode*:
+
+ : M-x customize-variable RET org-src-lang-modes RET
+
+ and map matlab to matlab-ts:
+
+ : Language name: matlab
+ : Major mode: matlab-ts
+
+
3. [Optional]. Install the
[[file:doc/matlab-language-server-lsp-mode.org][MATLAB Language Server]].
4. Check your installation setup.
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index f37ebe43f3..9660f28d5a 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -3342,10 +3342,22 @@ See `comment-dwim' for more capabilities."]
If you have the MATLAB tree-sitter grammar installed,
(treesit-ready-p \\='matlab)
-is t, add the following to an Init File (e.g. `user-init-file' or
-`site-run-file') to enter the MATLAB tree-sitter mode by default:
+is t
- (add-to-list \\='major-mode-remap-alist \\='(matlab-mode . matlab-ts-mode))
+1. Tell Emacs to use matlab-ts-mode for MATLAB files by adding the following
to your
+ `user-init-file' which is typically ~/.emacs, or add it to your
`site-run-file'
+
+ (add-to-list \\='major-mode-remap-alist \\='(matlab-mode . matlab-ts-mode))
+
+2. Tell `org-mode' that #+begin_src matlab ... #end_src blocks should use
+ matlab-ts-mode:
+
+ \\[customize-variable] RET org-src-lang-modes RET
+
+ and map matlab to matlab-ts:
+
+ Language name: matlab
+ Major mode: matlab-ts
This mode is independent from the classic matlab-mode.el, `matlab-mode',
so configuration variables of that mode, do not affect this mode.
@@ -3449,8 +3461,6 @@ so configuration variables of that mode, do not affect
this mode.
;;
;; TODO check abbrev mode - think this is setup by prog-mode, also see
matlab-mode
;;
- ;; TODO org mode matlab-ts-mode blocks testing
- ;;
;; TODO matlab-shell-mode: update help to have matlab-ts-mode or
matlab-mode
;;
;; TODO double check t-utils.el help, extract the help and put in treesit
how to