unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60888: 29.0.60; Lost c-or-c++-ts-mode
@ 2023-01-17 17:20 Juri Linkov
  2023-01-17 18:22 ` Dmitry Gutov
  2023-01-19 21:57 ` Yuan Fu
  0 siblings, 2 replies; 6+ messages in thread
From: Juri Linkov @ 2023-01-17 17:20 UTC (permalink / raw)
  To: 60888

I started to rely on c-or-c++-ts-mode because there is no other replacement
to use for such mappings in init files:

  (when (and (treesit-ready-p 'c t) (treesit-ready-p 'cpp t))
    (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)))

c-or-c++-mode is activated for all .h files, so there should be the corresponding
c-or-c++-ts-mode, but it's lost somewhere in emacs-29.





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

* bug#60888: 29.0.60; Lost c-or-c++-ts-mode
  2023-01-17 17:20 bug#60888: 29.0.60; Lost c-or-c++-ts-mode Juri Linkov
@ 2023-01-17 18:22 ` Dmitry Gutov
  2023-01-19 21:57 ` Yuan Fu
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2023-01-17 18:22 UTC (permalink / raw)
  To: Juri Linkov, 60888

On 17/01/2023 19:20, Juri Linkov wrote:
> I started to rely on c-or-c++-ts-mode because there is no other replacement
> to use for such mappings in init files:
> 
>    (when (and (treesit-ready-p 'c t) (treesit-ready-p 'cpp t))
>      (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)))
> 
> c-or-c++-mode is activated for all .h files, so there should be the corresponding
> c-or-c++-ts-mode, but it's lost somewhere in emacs-29.

Apparently it was decided that it's a new feature, and thus too late for 
emacs-29.





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

* bug#60888: 29.0.60; Lost c-or-c++-ts-mode
  2023-01-17 17:20 bug#60888: 29.0.60; Lost c-or-c++-ts-mode Juri Linkov
  2023-01-17 18:22 ` Dmitry Gutov
@ 2023-01-19 21:57 ` Yuan Fu
  2023-01-20  7:57   ` Juri Linkov
  2023-01-20  8:38   ` Eli Zaretskii
  1 sibling, 2 replies; 6+ messages in thread
From: Yuan Fu @ 2023-01-19 21:57 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 60888, Juri Linkov


Dmitry Gutov <dgutov@yandex.ru> writes:

> On 17/01/2023 19:20, Juri Linkov wrote:
>> I started to rely on c-or-c++-ts-mode because there is no other replacement
>> to use for such mappings in init files:
>>    (when (and (treesit-ready-p 'c t) (treesit-ready-p 'cpp t))
>>      (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)))
>> c-or-c++-mode is activated for all .h files, so there should be the
>> corresponding
>> c-or-c++-ts-mode, but it's lost somewhere in emacs-29.
>
> Apparently it was decided that it's a new feature, and thus too late
> for emacs-29.

I added it back. It really is a bug preventing one to use c(++)-ts-mode
on header files. So this should be fine to add. Plus I mostly just
copy-pasted from cc-mode. Sorry for the back-and-forth.

Yuan





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

* bug#60888: 29.0.60; Lost c-or-c++-ts-mode
  2023-01-19 21:57 ` Yuan Fu
@ 2023-01-20  7:57   ` Juri Linkov
  2023-01-20  8:38   ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2023-01-20  7:57 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 60888, Dmitry Gutov

close 60882 29.0.60
close 60888 29.0.60
thanks

>>> I started to rely on c-or-c++-ts-mode because there is no other replacement
>>> to use for such mappings in init files:
>>>    (when (and (treesit-ready-p 'c t) (treesit-ready-p 'cpp t))
>>>      (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)))
>>> c-or-c++-mode is activated for all .h files, so there should be the
>>> corresponding
>>> c-or-c++-ts-mode, but it's lost somewhere in emacs-29.
>>
>> Apparently it was decided that it's a new feature, and thus too late
>> for emacs-29.
>
> I added it back. It really is a bug preventing one to use c(++)-ts-mode
> on header files. So this should be fine to add. Plus I mostly just
> copy-pasted from cc-mode. Sorry for the back-and-forth.

Thanks, so now closing.

PS: It's nice that you added such instructions to the commentary and docstrings:

  ;; (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode))

Maybe it should be sufficient for emacs-29 and better than updating
user's auto-mode-alist automatically.





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

* bug#60888: 29.0.60; Lost c-or-c++-ts-mode
  2023-01-19 21:57 ` Yuan Fu
  2023-01-20  7:57   ` Juri Linkov
@ 2023-01-20  8:38   ` Eli Zaretskii
  2023-01-20 22:19     ` Yuan Fu
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-01-20  8:38 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 60888, juri, dgutov

> Cc: 60888@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
> From: Yuan Fu <casouri@gmail.com>
> Date: Thu, 19 Jan 2023 13:57:17 -0800
> 
> 
> Dmitry Gutov <dgutov@yandex.ru> writes:
> 
> > On 17/01/2023 19:20, Juri Linkov wrote:
> >> I started to rely on c-or-c++-ts-mode because there is no other replacement
> >> to use for such mappings in init files:
> >>    (when (and (treesit-ready-p 'c t) (treesit-ready-p 'cpp t))
> >>      (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)))
> >> c-or-c++-mode is activated for all .h files, so there should be the
> >> corresponding
> >> c-or-c++-ts-mode, but it's lost somewhere in emacs-29.
> >
> > Apparently it was decided that it's a new feature, and thus too late
> > for emacs-29.
> 
> I added it back. It really is a bug preventing one to use c(++)-ts-mode
> on header files. So this should be fine to add. Plus I mostly just
> copy-pasted from cc-mode. Sorry for the back-and-forth.

Yuan, something is still amiss here: there's a difference in the
decision whether C or C++ mode should be used between c-or-c++-mode
and c-or-c++-ts-mode.  For example, visit the file
dwarf2/line-header.h file from the recent GDB tree: c-or-c++-mode
decides (correctly) that it's C++, but c-or-c++-ts-mode decides that
it's C.

In general, try header files from GDB: GDB is written in C++, but many
*.h files kept their original *.h names, so you have a lot of testing
cases there.  I see quite a few of them where c-or-c++-ts-mode decides
incorrectly for some reason.

Thanks.





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

* bug#60888: 29.0.60; Lost c-or-c++-ts-mode
  2023-01-20  8:38   ` Eli Zaretskii
@ 2023-01-20 22:19     ` Yuan Fu
  0 siblings, 0 replies; 6+ messages in thread
From: Yuan Fu @ 2023-01-20 22:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 60888, juri, Dmitry Gutov



> On Jan 20, 2023, at 12:38 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Cc: 60888@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Thu, 19 Jan 2023 13:57:17 -0800
>> 
>> 
>> Dmitry Gutov <dgutov@yandex.ru> writes:
>> 
>>> On 17/01/2023 19:20, Juri Linkov wrote:
>>>> I started to rely on c-or-c++-ts-mode because there is no other replacement
>>>> to use for such mappings in init files:
>>>>   (when (and (treesit-ready-p 'c t) (treesit-ready-p 'cpp t))
>>>>     (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode)))
>>>> c-or-c++-mode is activated for all .h files, so there should be the
>>>> corresponding
>>>> c-or-c++-ts-mode, but it's lost somewhere in emacs-29.
>>> 
>>> Apparently it was decided that it's a new feature, and thus too late
>>> for emacs-29.
>> 
>> I added it back. It really is a bug preventing one to use c(++)-ts-mode
>> on header files. So this should be fine to add. Plus I mostly just
>> copy-pasted from cc-mode. Sorry for the back-and-forth.
> 
> Yuan, something is still amiss here: there's a difference in the
> decision whether C or C++ mode should be used between c-or-c++-mode
> and c-or-c++-ts-mode.  For example, visit the file
> dwarf2/line-header.h file from the recent GDB tree: c-or-c++-mode
> decides (correctly) that it's C++, but c-or-c++-ts-mode decides that
> it's C.
> 
> In general, try header files from GDB: GDB is written in C++, but many
> *.h files kept their original *.h names, so you have a lot of testing
> cases there.  I see quite a few of them where c-or-c++-ts-mode decides
> incorrectly for some reason.
> 
> Thanks.

Weird, I literally copied c-or-c++-mode. Let me see what’s going on.

Yuan




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

end of thread, other threads:[~2023-01-20 22:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-17 17:20 bug#60888: 29.0.60; Lost c-or-c++-ts-mode Juri Linkov
2023-01-17 18:22 ` Dmitry Gutov
2023-01-19 21:57 ` Yuan Fu
2023-01-20  7:57   ` Juri Linkov
2023-01-20  8:38   ` Eli Zaretskii
2023-01-20 22:19     ` Yuan Fu

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).