GNU bug report logs - #60526
29.0.60; javascript-mode → js-mode

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 3 Jan 2023 18:15:02 UTC

Severity: normal

Found in version 29.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60526 in the body.
You can then email your comments to 60526 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60526; Package emacs. (Tue, 03 Jan 2023 18:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 Jan 2023 18:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; javascript-mode → js-mode
Date: Tue, 03 Jan 2023 20:12:38 +0200
[Message part 1 (text/plain, inline)]
It looks wrong to require from users to add mappings for both `js-mode'
and its alias `javascript-mode' to `major-mode-remap-alist':

  (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
  (add-to-list 'major-mode-remap-alist '(javascript-mode . js-ts-mode))

Either `major-mode-remap-alist' could support aliases, or simpler
would be just to replace the alias in `auto-mode-alist':

[javascript-ts-mode.patch (text/x-diff, inline)]
diff --git a/lisp/files.el b/lisp/files.el
index c45c3d40a5d..2acc1d1df4a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2952,9 +2952,9 @@ auto-mode-alist
      ("\\.dbk\\'" . xml-mode)
      ("\\.dtd\\'" . sgml-mode)
      ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
-     ("\\.js[mx]?\\'" . javascript-mode)
+     ("\\.js[mx]?\\'" . js-mode)
      ;; https://en.wikipedia.org/wiki/.har
-     ("\\.har\\'" . javascript-mode)
+     ("\\.har\\'" . js-mode)
      ("\\.json\\'" . js-json-mode)
      ("\\.[ds]?va?h?\\'" . verilog-mode)
      ("\\.by\\'" . bovine-grammar-mode)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60526; Package emacs. (Tue, 03 Jan 2023 20:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 60526 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60526 <at> debbugs.gnu.org
Subject: Re: bug#60526: 29.0.60; javascript-mode → js-mode
Date: Tue, 03 Jan 2023 22:21:05 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Date: Tue, 03 Jan 2023 20:12:38 +0200
> 
> 
> It looks wrong to require from users to add mappings for both `js-mode'
> and its alias `javascript-mode' to `major-mode-remap-alist':
> 
>   (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
>   (add-to-list 'major-mode-remap-alist '(javascript-mode . js-ts-mode))
> 
> Either `major-mode-remap-alist' could support aliases, or simpler
> would be just to replace the alias in `auto-mode-alist':
> 
> diff --git a/lisp/files.el b/lisp/files.el
> index c45c3d40a5d..2acc1d1df4a 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -2952,9 +2952,9 @@ auto-mode-alist
>       ("\\.dbk\\'" . xml-mode)
>       ("\\.dtd\\'" . sgml-mode)
>       ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
> -     ("\\.js[mx]?\\'" . javascript-mode)
> +     ("\\.js[mx]?\\'" . js-mode)
>       ;; https://en.wikipedia.org/wiki/.har
> -     ("\\.har\\'" . javascript-mode)
> +     ("\\.har\\'" . js-mode)
>       ("\\.json\\'" . js-json-mode)
>       ("\\.[ds]?va?h?\\'" . verilog-mode)
>       ("\\.by\\'" . bovine-grammar-mode)

This is basically a no-brainer, but we had javascript-mode there for
quite some time, and it's too late to change that for Emacs 29.
Please install on master.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60526; Package emacs. (Wed, 04 Jan 2023 06:41:01 GMT) Full text and rfc822 format available.

Message #11 received at 60526 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60526 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#60526: 29.0.60; javascript-mode → js-mode
Date: Tue, 3 Jan 2023 23:40:47 -0700

> On Jan 3, 2023, at 1:21 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Juri Linkov <juri <at> linkov.net>
>> Date: Tue, 03 Jan 2023 20:12:38 +0200
>> 
>> 
>> It looks wrong to require from users to add mappings for both `js-mode'
>> and its alias `javascript-mode' to `major-mode-remap-alist':
>> 
>>  (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
>>  (add-to-list 'major-mode-remap-alist '(javascript-mode . js-ts-mode))
>> 
>> Either `major-mode-remap-alist' could support aliases, or simpler
>> would be just to replace the alias in `auto-mode-alist':
>> 
>> diff --git a/lisp/files.el b/lisp/files.el
>> index c45c3d40a5d..2acc1d1df4a 100644
>> --- a/lisp/files.el
>> +++ b/lisp/files.el
>> @@ -2952,9 +2952,9 @@ auto-mode-alist
>>      ("\\.dbk\\'" . xml-mode)
>>      ("\\.dtd\\'" . sgml-mode)
>>      ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
>> -     ("\\.js[mx]?\\'" . javascript-mode)
>> +     ("\\.js[mx]?\\'" . js-mode)
>>      ;; https://en.wikipedia.org/wiki/.har
>> -     ("\\.har\\'" . javascript-mode)
>> +     ("\\.har\\'" . js-mode)
>>      ("\\.json\\'" . js-json-mode)
>>      ("\\.[ds]?va?h?\\'" . verilog-mode)
>>      ("\\.by\\'" . bovine-grammar-mode)
> 
> This is basically a no-brainer, but we had javascript-mode there for
> quite some time, and it's too late to change that for Emacs 29.
> Please install on master.

I thought auto-mode-alist should use the canonical name and major-mode-remap-alist maps the canonical name to the actual mode. Why do we need 

>> (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))

if auto-mode-alist uses javascript-mode?

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60526; Package emacs. (Wed, 04 Jan 2023 07:50:03 GMT) Full text and rfc822 format available.

Message #14 received at 60526 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 60526 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#60526: 29.0.60; javascript-mode → js-mode
Date: Wed, 04 Jan 2023 09:45:44 +0200
>>> -     ("\\.js[mx]?\\'" . javascript-mode)
>>> +     ("\\.js[mx]?\\'" . js-mode)
>>>      ;; https://en.wikipedia.org/wiki/.har
>>> -     ("\\.har\\'" . javascript-mode)
>>> +     ("\\.har\\'" . js-mode)
>>>      ("\\.json\\'" . js-json-mode)
>>>      ("\\.[ds]?va?h?\\'" . verilog-mode)
>>>      ("\\.by\\'" . bovine-grammar-mode)
>>
>> This is basically a no-brainer, but we had javascript-mode there for
>> quite some time, and it's too late to change that for Emacs 29.
>> Please install on master.
>
> I thought auto-mode-alist should use the canonical name and
> major-mode-remap-alist maps the canonical name to the actual mode.

But the canonical name is js-mode, because javascript-mode is
an alias to js-mode.

> Why do we need
>
>>> (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
>
> if auto-mode-alist uses javascript-mode?

This is needed for the case when users or packages customized
auto-mode-alist to use the name js-mode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60526; Package emacs. (Sun, 08 Jan 2023 01:40:02 GMT) Full text and rfc822 format available.

Message #17 received at 60526 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60526 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#60526: 29.0.60; javascript-mode →  js-mode
Date: Sat, 7 Jan 2023 17:39:34 -0800
Juri Linkov <juri <at> linkov.net> writes:

>>>> -     ("\\.js[mx]?\\'" . javascript-mode)
>>>> +     ("\\.js[mx]?\\'" . js-mode)
>>>>      ;; https://en.wikipedia.org/wiki/.har
>>>> -     ("\\.har\\'" . javascript-mode)
>>>> +     ("\\.har\\'" . js-mode)
>>>>      ("\\.json\\'" . js-json-mode)
>>>>      ("\\.[ds]?va?h?\\'" . verilog-mode)
>>>>      ("\\.by\\'" . bovine-grammar-mode)
>>>
>>> This is basically a no-brainer, but we had javascript-mode there for
>>> quite some time, and it's too late to change that for Emacs 29.
>>> Please install on master.
>>
>> I thought auto-mode-alist should use the canonical name and
>> major-mode-remap-alist maps the canonical name to the actual mode.
>
> But the canonical name is js-mode, because javascript-mode is
> an alias to js-mode.

js-mode feels more like "implementation name" to me. After all, the name
of the language is Javascript, not js. I think javascript-mode best
represents "major mode for javascript", not js-mode, if you get what I
mean.

>> Why do we need
>>
>>>> (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
>>
>> if auto-mode-alist uses javascript-mode?
>
> This is needed for the case when users or packages customized
> auto-mode-alist to use the name js-mode.

If they customize auto-mode-alist to js-mode, I expect them to expect
Emacs to use js-mode by default, not the tree-sitter mode.

Yuan




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Sun, 08 Jan 2023 08:50:03 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Sun, 08 Jan 2023 08:50:04 GMT) Full text and rfc822 format available.

Message #22 received at 60526-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 60526-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#60526: 29.0.60; javascript-mode → js-mode
Date: Sun, 08 Jan 2023 10:26:13 +0200
> js-mode feels more like "implementation name" to me. After all, the name
> of the language is Javascript, not js. I think javascript-mode best
> represents "major mode for javascript", not js-mode, if you get what I
> mean.

Indeed, and the treesit module is named tree-sitter-javascript, not js.
So closing this report now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60526; Package emacs. (Sun, 08 Jan 2023 11:08:01 GMT) Full text and rfc822 format available.

Message #25 received at 60526 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Yuan Fu <casouri <at> gmail.com>, Juri Linkov <juri <at> linkov.net>
Cc: 60526 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#60526: 29.0.60; javascript-mode → js-mode
Date: Sun, 8 Jan 2023 13:07:41 +0200
On 08/01/2023 03:39, Yuan Fu wrote:
> Juri Linkov<juri <at> linkov.net>  writes:
> 
>>>>> -     ("\\.js[mx]?\\'" . javascript-mode)
>>>>> +     ("\\.js[mx]?\\'" . js-mode)
>>>>>       ;;https://en.wikipedia.org/wiki/.har
>>>>> -     ("\\.har\\'" . javascript-mode)
>>>>> +     ("\\.har\\'" . js-mode)
>>>>>       ("\\.json\\'" . js-json-mode)
>>>>>       ("\\.[ds]?va?h?\\'" . verilog-mode)
>>>>>       ("\\.by\\'" . bovine-grammar-mode)
>>>> This is basically a no-brainer, but we had javascript-mode there for
>>>> quite some time, and it's too late to change that for Emacs 29.
>>>> Please install on master.
>>> I thought auto-mode-alist should use the canonical name and
>>> major-mode-remap-alist maps the canonical name to the actual mode.
>> But the canonical name is js-mode, because javascript-mode is
>> an alias to js-mode.
> js-mode feels more like "implementation name" to me. After all, the name
> of the language is Javascript, not js. I think javascript-mode best
> represents "major mode for javascript", not js-mode, if you get what I
> mean.
> 

javascript-mode was the name of a different mode. js-mode was a later 
rewrite of it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 Feb 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.