all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72069: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode
@ 2024-07-12  7:58 Damien Cassou
  2024-07-24 14:05 ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Cassou @ 2024-07-12  7:58 UTC (permalink / raw)
  To: 72069

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

Tags: patch

Hi,

The current version of the code requires the `js-ts-mode' function to
have already been executed for `auto-mode-alist' to contain an entry for
".jsx" files. The patch makes sure that `auto-mode-alist' is updates
when js.el is loaded.

Best

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Move-configuration-of-auto-mode-alist-out-of-js-ts-m.patch --]
[-- Type: text/patch, Size: 1031 bytes --]

From 7fc9bb52a9f51a8caf4d5d016dc8a8812dd5c6a3 Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Fri, 12 Jul 2024 09:50:45 +0200
Subject: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode

* lisp/progmodes/js.el (js-ts-mode): Remove configuration of
auto-mode-alist.
---
 lisp/progmodes/js.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index f8140c14a49..c3e6077a352 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3957,10 +3957,10 @@ js-ts-mode
                                         "method_definition")
                                 eos)
                    nil nil)))
-    (treesit-major-mode-setup)
+    (treesit-major-mode-setup)))
 
-    (add-to-list 'auto-mode-alist
-                 '("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))))
+(add-to-list 'auto-mode-alist
+             '("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))
 
 (derived-mode-add-parents 'js-ts-mode '(js-mode))
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#72069: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode
  2024-07-12  7:58 bug#72069: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode Damien Cassou
@ 2024-07-24 14:05 ` Stefan Kangas
  2024-07-29 18:20   ` Damien Cassou
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2024-07-24 14:05 UTC (permalink / raw)
  To: Damien Cassou; +Cc: Yuan Fu, 72069

Damien Cassou <damien@cassou.me> writes:

> The current version of the code requires the `js-ts-mode' function to
> have already been executed for `auto-mode-alist' to contain an entry for
> ".jsx" files. The patch makes sure that `auto-mode-alist' is updates
> when js.el is loaded.

Thanks for the patch.

What about js-mode?  Shouldn't that be used out-of-the-box for these files?

>>From 7fc9bb52a9f51a8caf4d5d016dc8a8812dd5c6a3 Mon Sep 17 00:00:00 2001
> From: Damien Cassou <damien@cassou.me>
> Date: Fri, 12 Jul 2024 09:50:45 +0200
> Subject: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode
>
> * lisp/progmodes/js.el (js-ts-mode): Remove configuration of
> auto-mode-alist.
> ---
>  lisp/progmodes/js.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
> index f8140c14a49..c3e6077a352 100644
> --- a/lisp/progmodes/js.el
> +++ b/lisp/progmodes/js.el
> @@ -3957,10 +3957,10 @@ js-ts-mode
>                                          "method_definition")
>                                  eos)
>                     nil nil)))
> -    (treesit-major-mode-setup)
> +    (treesit-major-mode-setup)))
>
> -    (add-to-list 'auto-mode-alist
> -                 '("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))))
> +(add-to-list 'auto-mode-alist
> +             '("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))

Shouldn't this be wrapped in

    (if (treesit-ready-p js) ...)

?

>
>  (derived-mode-add-parents 'js-ts-mode '(js-mode))





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#72069: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode
  2024-07-24 14:05 ` Stefan Kangas
@ 2024-07-29 18:20   ` Damien Cassou
  0 siblings, 0 replies; 3+ messages in thread
From: Damien Cassou @ 2024-07-29 18:20 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Yuan Fu, 72069

Hi Stefan,

thank you very much for your review.

Stefan Kangas <stefankangas@gmail.com> writes:
> Damien Cassou <damien@cassou.me> writes:
> What about js-mode?  Shouldn't that be used out-of-the-box for these files?


Definitely, I don't know what I was thinking. I'm not sure there is
anything to save on this patch.

If you believe I should wrap the call to `add-to-list' within a `(if
(treesit-ready-p js) ...)' block I will do that but I don't think this
is how things are done for other kinds of files. Otherwise, feel free to
close this ticket and please forgive me.

Best


>>>From 7fc9bb52a9f51a8caf4d5d016dc8a8812dd5c6a3 Mon Sep 17 00:00:00 2001
>> From: Damien Cassou <damien@cassou.me>
>> Date: Fri, 12 Jul 2024 09:50:45 +0200
>> Subject: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode
>>
>> * lisp/progmodes/js.el (js-ts-mode): Remove configuration of
>> auto-mode-alist.
>> ---
>>  lisp/progmodes/js.el | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
>> index f8140c14a49..c3e6077a352 100644
>> --- a/lisp/progmodes/js.el
>> +++ b/lisp/progmodes/js.el
>> @@ -3957,10 +3957,10 @@ js-ts-mode
>>                                          "method_definition")
>>                                  eos)
>>                     nil nil)))
>> -    (treesit-major-mode-setup)
>> +    (treesit-major-mode-setup)))
>>
>> -    (add-to-list 'auto-mode-alist
>> -                 '("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))))
>> +(add-to-list 'auto-mode-alist
>> +             '("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))
>
> Shouldn't this be wrapped in
>
>     (if (treesit-ready-p js) ...)
>
> ?
>
>>
>>  (derived-mode-add-parents 'js-ts-mode '(js-mode))

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-29 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12  7:58 bug#72069: [PATCH] Move configuration of auto-mode-alist out of js-ts-mode Damien Cassou
2024-07-24 14:05 ` Stefan Kangas
2024-07-29 18:20   ` Damien Cassou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.