* Possibly changing heex-ts-mode to derived from html-mode to prog-mode
@ 2024-12-30 9:35 Wilhelm Kirschbaum
0 siblings, 0 replies; only message in thread
From: Wilhelm Kirschbaum @ 2024-12-30 9:35 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2562 bytes --]
Advice on this will be appreciated.
Someone pointed out to me on the legacy heex-ts-mode package on github that
heex-ts-mode makes more sense to derive from prog-mode than html-mode.
Here is the comment: https://github.com/wkirschbaum/heex-ts-mode/issues/4
which reads:
"
The derivation chain goes heex-ts-mode <- html-mode <- sgml-mode <-
text-mode <- nil. Which means users may trigger (and conversely not
trigger) behavior they have setup in text-mode (and conversely prog-mode).
For a concrete example, the default completion-at-point keybinding is taken
over by ispell in text-mode. This was unexpected since heex-ts-mode, is
primarily a programming buffer, even if you're just mostly writing
templates.
What are your thoughts on making it derive from prog-mode or web-mode
rather than html-mode?
"
I think I agree, as HEEx is just Elixir looking like some html syntax.
Language servers and other tools should treat this as Elixir, not text.
Testing this change on my side with a very light setup shows that it has no
negative impact. The wider impact of such a change is unknown to me.
The original decision for deriving from html-mode was because I followed
how erb-mode ( ruby markup ) works, which might have been a mistake.
This is the proposed change:
---
lisp/progmodes/heex-ts-mode.el | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el
index b527d96b579..ab40d4819e8 100644
--- a/lisp/progmodes/heex-ts-mode.el
+++ b/lisp/progmodes/heex-ts-mode.el
@@ -143,7 +143,7 @@ heex-ts--forward-sexp
(abs arg)))
;;;###autoload
-(define-derived-mode heex-ts-mode html-mode "HEEx"
+(define-derived-mode heex-ts-mode prog-mode "HEEx"
"Major mode for editing HEEx, powered by tree-sitter."
:group 'heex-ts
@@ -168,16 +168,6 @@ heex-ts-mode
("Slot" "\\`slot\\'" nil nil)
("Tag" "\\`tag\\'" nil nil)))
- ;; Outline minor mode
- ;; `heex-ts-mode' inherits from `html-mode' that sets
- ;; regexp-based outline variables. So need to restore
- ;; the default values of outline variables to be able
- ;; to use `treesit-outline-predicate' derived
- ;; from `treesit-simple-imenu-settings' above.
- (kill-local-variable 'outline-heading-end-regexp)
- (kill-local-variable 'outline-regexp)
- (kill-local-variable 'outline-level)
-
(setq-local treesit-font-lock-settings heex-ts--font-lock-settings)
(setq-local treesit-simple-indent-rules heex-ts--indent-rules)
--
Wilhelm
[-- Attachment #2: Type: text/html, Size: 3653 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-30 9:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 9:35 Possibly changing heex-ts-mode to derived from html-mode to prog-mode Wilhelm Kirschbaum
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).