unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Wilhelm Kirschbaum <wkirschbaum@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Possibly changing heex-ts-mode to derived from html-mode to prog-mode
Date: Mon, 30 Dec 2024 11:35:53 +0200	[thread overview]
Message-ID: <CAOS0-36BmX+U9MiheUp_EBQybRKnsh89VjvbSX=Sf+YVXrttPA@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2024-12-30  9:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOS0-36BmX+U9MiheUp_EBQybRKnsh89VjvbSX=Sf+YVXrttPA@mail.gmail.com' \
    --to=wkirschbaum@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).