GNU bug report logs - #65470
29.1.50; js-ts-mode: regex pattern can cause incorrect parenthesis matching

Previous Next

Package: emacs;

Reported by: Augustin Chéneau (BTuin) <btuin <at> mailo.com>

Date: Wed, 23 Aug 2023 11:16:01 UTC

Severity: normal

Tags: patch

Found in version 29.1.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, 65470 <at> debbugs.gnu.org, theo <at> thornhill.no,
 jostein <at> secure.kjonigsen.net, btuin <at> mailo.com, jostein <at> kjonigsen.net
Subject: Re: bug#65470: 29.1.50; js-ts-mode: regex pattern can cause incorrect
 parenthesis matching
Date: Sat, 16 Sep 2023 23:05:35 +0300
On 16/09/2023 16:59, Stefan Monnier wrote:
>>> No problem, pushed that to emacs-29, thanks.
>> This seems to cause:
>>
>>      INFO     Scraping files for loaddefs...85%
>>    typescript-ts-mode:0: Warning: Not registering prefix "ts".  Affects: ("tsx-ts-mode--indent-compatibility-b893426" "tsx-ts-mode--font-lock-compatibility-bb1f97b" "tsx-ts--s-p-query" "tsx-ts--syntax-propertize" "ts-ts--s-p-query" "ts-ts--syntax-propertize" "ts-ts--syntax-propertize-captures")
>>
>> Stefan, what do we usually do with such warnings?
> We usually ignored them?
> [ They only affect the features controlled by
>    `help-enable-(completion-)autoload`.  ]
> 
> A better option, is to try and use fewer namespace prefixes.
> e.g. make sure all the definitions start with `ts-`, `ts-ts-`,
> `tsts-`, or somesuch (except for the autoloaded ones which can break
> that rule).
> 
> Maybe rename `typescript-ts-mode-*` to `ts-ts-mode-*` (and
> make `typescript-ts-mode` an alias of `ts-ts-mode`).

Thanks. I haven't seen the warnings myself, but I sorted the new 
addition into two existing prefixes in that file: typescript-ts and tsx-ts.

> diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
> index 7c85a7b6fe9..8c50b55535b 100644
> --- a/lisp/progmodes/typescript-ts-mode.el
> +++ b/lisp/progmodes/typescript-ts-mode.el
> @@ -87,7 +87,7 @@ tsx-ts-mode--indent-compatibility-b893426
>         (progn (treesit-query-capture 'tsx '((jsx_fragment) @capture))
>                `(((match "<" "jsx_fragment") parent 0)
>                  ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset)))
> -    (error
> +    (error ;; FIXME: Use more precise error name.
>        `(((match "<" "jsx_text") parent 0)
>          ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset)))))
>   
> @@ -414,8 +414,11 @@ typescript-ts-mode--sexp-nodes
>     "Nodes that designate sexps in TypeScript.
>   See `treesit-thing-settings' for more information.")
>   
> +;; FIXME: Do we really need to autoload this?
>   ;;;###autoload

Don't think so. Though I'm not sure if we should change that in emacs-29.

>   (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript"
> +  ;; FIXME: This is the same docstring as `typescript-ts-mode',
> +  ;; we should document the difference here!
>     "Major mode for editing TypeScript."
>     :group 'typescript
>     :syntax-table typescript-ts-mode--syntax-table
> 

Fixed two other things on the release branch, seemed safe enough.




This bug report was last modified 1 year and 249 days ago.

Previous Next


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