branch: elpa/haskell-ts-mode
commit b3b1f38b18a9d7a10b3a60c540cd403891f9cf54
Author: Acid Bong <acidb...@tilde.club>
Commit: Acid Bong <acidb...@tilde.club>

    lisp: derive from haskell-mode on Emacs v30 and above
    
    Following emacs30 tendency to derive all treesit-powered modes from
    non-ts ones. Does not require depending on the non-ts mode.
    
    Also a wee edit in README.
---
 README.org         | 6 ++++--
 haskell-ts-mode.el | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 5b46f0aaf5..dac0777d11 100644
--- a/README.org
+++ b/README.org
@@ -108,9 +108,11 @@ you suffer from contagious dehydration, you can lower it.
 
 ** Language server
 
-=haskell-ts-mode= works with =lsp-mode=.
+=haskell-ts-mode= works with =lsp-mode= and, since Emacs 30, with
+=eglot=.
 
-To add =eglot= support, add the following code to your =init.el=:
+To add =eglot= support on Emacs 29 and earlier, add the following code
+to your =init.el=:
 
 #+begin_src emacs-lisp
   (with-eval-after-load 'eglot
diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el
index a2f656e8a6..7d583550a5 100644
--- a/haskell-ts-mode.el
+++ b/haskell-ts-mode.el
@@ -465,7 +465,10 @@ when `haskell-ts-prettify-words' is non-nil.")
   (setq-local treesit-font-lock-settings haskell-ts-font-lock)
   (setq-local treesit-font-lock-feature-list
               haskell-ts-font-lock-feature-list)
-  (treesit-major-mode-setup))
+  (treesit-major-mode-setup)
+  ;; derive from `haskell-mode' on emacs v30+
+  (when (functionp 'derived-mode-add-parents)
+    (derived-mode-add-parents 'haskell-ts-mode '(haskell-mode))))
 
 (defun haskell-ts--fontify-func (node face)
   (if (string= "variable" (treesit-node-type node))

Reply via email to