* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword @ 2024-12-31 16:01 Jacob Faibussowitsch 2025-01-02 3:28 ` Yuan Fu 0 siblings, 1 reply; 14+ messages in thread From: Jacob Faibussowitsch @ 2024-12-31 16:01 UTC (permalink / raw) To: 75226 [-- Attachment #1: Type: text/plain, Size: 149 bytes --] C++ ts-mode is missing “alignof” as a builtin keyword like sizeof. Best Regards, Jacob Faibussowitsch (Jacob Fai - booss - oh - vitch) [-- Attachment #2: Type: text/html, Size: 734 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2024-12-31 16:01 bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword Jacob Faibussowitsch @ 2025-01-02 3:28 ` Yuan Fu 2025-01-02 5:06 ` Stefan Kangas 2025-01-02 6:41 ` Eli Zaretskii 0 siblings, 2 replies; 14+ messages in thread From: Yuan Fu @ 2025-01-02 3:28 UTC (permalink / raw) To: Jacob Faibussowitsch; +Cc: 75226 > On Dec 31, 2024, at 8:01 AM, Jacob Faibussowitsch <jacob.fai@gmail.com> wrote: > > C++ ts-mode is missing “alignof” as a builtin keyword like sizeof. > > Best Regards, > > Jacob Faibussowitsch > (Jacob Fai - booss - oh - vitch) > Thanks for reporting this. It seems tree-sitter-c/cpp supports '__alignof__', '__alignof', '_alignof', 'alignof', ‘_Alignof’, I can add all of them as keywords. The feature is added in tree-sitter-c in Aug 9, 2023 [1], and appears in v0.20.5. Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? [1] https://github.com/tree-sitter/tree-sitter-c/commit/8e919ab298b6e4d05ee29b10482de4fcfb075074 Yuan ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-02 3:28 ` Yuan Fu @ 2025-01-02 5:06 ` Stefan Kangas 2025-01-02 6:41 ` Eli Zaretskii 1 sibling, 0 replies; 14+ messages in thread From: Stefan Kangas @ 2025-01-02 5:06 UTC (permalink / raw) To: Yuan Fu, Jacob Faibussowitsch; +Cc: 75226 Yuan Fu <casouri@gmail.com> writes: > Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 > and have this change queued for Emacs 30.2? Or should I wait a bit? I'm not Eli, but to have this in Emacs 30.2, you need to wait until Emacs 30.1 is released first. ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-02 3:28 ` Yuan Fu 2025-01-02 5:06 ` Stefan Kangas @ 2025-01-02 6:41 ` Eli Zaretskii 2025-01-02 14:03 ` Jacob Faibussowitsch 2025-01-03 8:50 ` Yuan Fu 1 sibling, 2 replies; 14+ messages in thread From: Eli Zaretskii @ 2025-01-02 6:41 UTC (permalink / raw) To: Yuan Fu; +Cc: 75226, jacob.fai > Cc: 75226@debbugs.gnu.org > From: Yuan Fu <casouri@gmail.com> > Date: Wed, 1 Jan 2025 19:28:35 -0800 > > > > > On Dec 31, 2024, at 8:01 AM, Jacob Faibussowitsch <jacob.fai@gmail.com> wrote: > > > > C++ ts-mode is missing “alignof” as a builtin keyword like sizeof. > > > > Best Regards, > > > > Jacob Faibussowitsch > > (Jacob Fai - booss - oh - vitch) > > > > Thanks for reporting this. It seems tree-sitter-c/cpp supports '__alignof__', '__alignof', '_alignof', 'alignof', ‘_Alignof’, I can add all of them as keywords. The feature is added in tree-sitter-c in Aug 9, 2023 [1], and appears in v0.20.5. > > Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? If this just adds a bunch of strings to c-ts-mode--keywords, it's okay to add them on emacs-30. Thanks. ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-02 6:41 ` Eli Zaretskii @ 2025-01-02 14:03 ` Jacob Faibussowitsch 2025-01-02 15:47 ` Eli Zaretskii 2025-01-03 8:50 ` Yuan Fu 1 sibling, 1 reply; 14+ messages in thread From: Jacob Faibussowitsch @ 2025-01-02 14:03 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Yuan Fu, 75226 [-- Attachment #1: Type: text/plain, Size: 1190 bytes --] Should also do `alignas` and friends while you’re at it. I noticed it is missing from `c-ts-mode--keywords` as well. Best Regards, Jacob Faibussowitsch (Jacob Fai - booss - oh - vitch) > On Jan 2, 2025, at 1:41 AM, Eli Zaretskii <eliz@gnu.org> wrote: > >> Cc: 75226@debbugs.gnu.org >> From: Yuan Fu <casouri@gmail.com> >> Date: Wed, 1 Jan 2025 19:28:35 -0800 >> >> >> >>> On Dec 31, 2024, at 8:01 AM, Jacob Faibussowitsch <jacob.fai@gmail.com> wrote: >>> >>> C++ ts-mode is missing “alignof” as a builtin keyword like sizeof. >>> >>> Best Regards, >>> >>> Jacob Faibussowitsch >>> (Jacob Fai - booss - oh - vitch) >>> >> >> Thanks for reporting this. It seems tree-sitter-c/cpp supports '__alignof__', '__alignof', '_alignof', 'alignof', ‘_Alignof’, I can add all of them as keywords. The feature is added in tree-sitter-c in Aug 9, 2023 [1], and appears in v0.20.5. >> >> Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? > > If this just adds a bunch of strings to c-ts-mode--keywords, it's okay > to add them on emacs-30. > > Thanks. [-- Attachment #2: Type: text/html, Size: 4742 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-02 14:03 ` Jacob Faibussowitsch @ 2025-01-02 15:47 ` Eli Zaretskii 0 siblings, 0 replies; 14+ messages in thread From: Eli Zaretskii @ 2025-01-02 15:47 UTC (permalink / raw) To: Jacob Faibussowitsch; +Cc: casouri, 75226 > From: Jacob Faibussowitsch <jacob.fai@gmail.com> > Date: Thu, 2 Jan 2025 09:03:26 -0500 > Cc: Yuan Fu <casouri@gmail.com>, > 75226@debbugs.gnu.org > > Should also do `alignas` and friends while you’re at it. I noticed it is missing from `c-ts-mode--keywords` as > well. The keywords are all explicit in the grammar's JS source, so how about check them all, while we are at it? ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-02 6:41 ` Eli Zaretskii 2025-01-02 14:03 ` Jacob Faibussowitsch @ 2025-01-03 8:50 ` Yuan Fu 2025-01-03 11:38 ` Eli Zaretskii 1 sibling, 1 reply; 14+ messages in thread From: Yuan Fu @ 2025-01-03 8:50 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 75226, Jacob Faibussowitsch > On Jan 1, 2025, at 10:41 PM, Eli Zaretskii <eliz@gnu.org> wrote: > >> Cc: 75226@debbugs.gnu.org >> From: Yuan Fu <casouri@gmail.com> >> Date: Wed, 1 Jan 2025 19:28:35 -0800 >> >> >> >>> On Dec 31, 2024, at 8:01 AM, Jacob Faibussowitsch <jacob.fai@gmail.com> wrote: >>> >>> C++ ts-mode is missing “alignof” as a builtin keyword like sizeof. >>> >>> Best Regards, >>> >>> Jacob Faibussowitsch >>> (Jacob Fai - booss - oh - vitch) >>> >> >> Thanks for reporting this. It seems tree-sitter-c/cpp supports '__alignof__', '__alignof', '_alignof', 'alignof', ‘_Alignof’, I can add all of them as keywords. The feature is added in tree-sitter-c in Aug 9, 2023 [1], and appears in v0.20.5. >> >> Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? > > If this just adds a bunch of strings to c-ts-mode--keywords, it's okay > to add them on emacs-30. Not quite, right now emacs-30’s c-ts-mode works with grammar as far back as v0.19.0 [1]. If we just add the keywords, c-ts-mode wouldn’t work with grammar v0.20.4 and earlier. So I’m going to add the new keywords with a check, which disables the new keywords if grammar doesn’t recognize them. Also there’re many missing keywords, none of which I have seen before :-), I need time to go over them and see how are they supposed by be fontified (keyword face or something else). So let’s wait for 30.2. [1] It might work with even earlier versions but I didn’t test, v0.19.0 (4 years ago) is the earliest version that still has compatible LANGUAGE_VERSION (13) with the latest tree-sitter lib. Yuan ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-03 8:50 ` Yuan Fu @ 2025-01-03 11:38 ` Eli Zaretskii 2025-01-04 7:34 ` Yuan Fu 0 siblings, 1 reply; 14+ messages in thread From: Eli Zaretskii @ 2025-01-03 11:38 UTC (permalink / raw) To: Yuan Fu; +Cc: 75226, jacob.fai > From: Yuan Fu <casouri@gmail.com> > Date: Fri, 3 Jan 2025 00:50:46 -0800 > Cc: Jacob Faibussowitsch <jacob.fai@gmail.com>, > 75226@debbugs.gnu.org > > > On Jan 1, 2025, at 10:41 PM, Eli Zaretskii <eliz@gnu.org> wrote: > > > >> Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? > > > > If this just adds a bunch of strings to c-ts-mode--keywords, it's okay > > to add them on emacs-30. > > Not quite, right now emacs-30’s c-ts-mode works with grammar as far back as v0.19.0 [1]. If we just add the keywords, c-ts-mode wouldn’t work with grammar v0.20.4 and earlier. So I’m going to add the new keywords with a check, which disables the new keywords if grammar doesn’t recognize them. Also there’re many missing keywords, none of which I have seen before :-), I need time to go over them and see how are they supposed by be fontified (keyword face or something else). > > So let’s wait for 30.2. If so, please install on master, and let's consider backporting it to the emacs-30 branch after 30.1 is released. Thanks. ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-03 11:38 ` Eli Zaretskii @ 2025-01-04 7:34 ` Yuan Fu 2025-01-08 3:09 ` Yuan Fu 0 siblings, 1 reply; 14+ messages in thread From: Yuan Fu @ 2025-01-04 7:34 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 75226, Jacob Faibussowitsch > On Jan 3, 2025, at 3:38 AM, Eli Zaretskii <eliz@gnu.org> wrote: > >> From: Yuan Fu <casouri@gmail.com> >> Date: Fri, 3 Jan 2025 00:50:46 -0800 >> Cc: Jacob Faibussowitsch <jacob.fai@gmail.com>, >> 75226@debbugs.gnu.org >> >>> On Jan 1, 2025, at 10:41 PM, Eli Zaretskii <eliz@gnu.org> wrote: >>> >>>> Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? >>> >>> If this just adds a bunch of strings to c-ts-mode--keywords, it's okay >>> to add them on emacs-30. >> >> Not quite, right now emacs-30’s c-ts-mode works with grammar as far back as v0.19.0 [1]. If we just add the keywords, c-ts-mode wouldn’t work with grammar v0.20.4 and earlier. So I’m going to add the new keywords with a check, which disables the new keywords if grammar doesn’t recognize them. Also there’re many missing keywords, none of which I have seen before :-), I need time to go over them and see how are they supposed by be fontified (keyword face or something else). >> >> So let’s wait for 30.2. > > If so, please install on master, and let's consider backporting it to > the emacs-30 branch after 30.1 is released. > > Thanks. Sounds good. Yuan ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-04 7:34 ` Yuan Fu @ 2025-01-08 3:09 ` Yuan Fu 2025-01-08 12:49 ` Eli Zaretskii 0 siblings, 1 reply; 14+ messages in thread From: Yuan Fu @ 2025-01-08 3:09 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 75226, Jacob Faibussowitsch > On Jan 3, 2025, at 11:34 PM, Yuan Fu <casouri@gmail.com> wrote: > > > >> On Jan 3, 2025, at 3:38 AM, Eli Zaretskii <eliz@gnu.org> wrote: >> >>> From: Yuan Fu <casouri@gmail.com> >>> Date: Fri, 3 Jan 2025 00:50:46 -0800 >>> Cc: Jacob Faibussowitsch <jacob.fai@gmail.com>, >>> 75226@debbugs.gnu.org >>> >>>> On Jan 1, 2025, at 10:41 PM, Eli Zaretskii <eliz@gnu.org> wrote: >>>> >>>>> Eli, what’s the status of Emacs 30 right now? Can I push to emacs-30 and have this change queued for Emacs 30.2? Or should I wait a bit? >>>> >>>> If this just adds a bunch of strings to c-ts-mode--keywords, it's okay >>>> to add them on emacs-30. >>> >>> Not quite, right now emacs-30’s c-ts-mode works with grammar as far back as v0.19.0 [1]. If we just add the keywords, c-ts-mode wouldn’t work with grammar v0.20.4 and earlier. So I’m going to add the new keywords with a check, which disables the new keywords if grammar doesn’t recognize them. Also there’re many missing keywords, none of which I have seen before :-), I need time to go over them and see how are they supposed by be fontified (keyword face or something else). >>> >>> So let’s wait for 30.2. >> >> If so, please install on master, and let's consider backporting it to >> the emacs-30 branch after 30.1 is released. >> >> Thanks. > > Sounds good. > > Yuan I found that both c++-mode and c++-ts-mode fontifies C++ alternative operators like and_eq, xor, etc as keywords. Maybe we should fontify them in operator face (added in Emacs 29) instead? Yuan ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-08 3:09 ` Yuan Fu @ 2025-01-08 12:49 ` Eli Zaretskii 2025-01-08 13:58 ` Jacob Faibussowitsch 2025-01-08 14:49 ` Alan Mackenzie 0 siblings, 2 replies; 14+ messages in thread From: Eli Zaretskii @ 2025-01-08 12:49 UTC (permalink / raw) To: Yuan Fu, Alan Mackenzie; +Cc: 75226, jacob.fai > From: Yuan Fu <casouri@gmail.com> > Date: Tue, 7 Jan 2025 19:09:40 -0800 > Cc: Jacob Faibussowitsch <jacob.fai@gmail.com>, > 75226@debbugs.gnu.org > > I found that both c++-mode and c++-ts-mode fontifies C++ alternative operators like and_eq, xor, etc as keywords. Maybe we should fontify them in operator face (added in Emacs 29) instead? What do other editors do? Alan, WDYT about this? ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-08 12:49 ` Eli Zaretskii @ 2025-01-08 13:58 ` Jacob Faibussowitsch 2025-01-08 14:49 ` Alan Mackenzie 1 sibling, 0 replies; 14+ messages in thread From: Jacob Faibussowitsch @ 2025-01-08 13:58 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Alan Mackenzie, Yuan Fu, 75226 [-- Attachment #1: Type: text/plain, Size: 1066 bytes --] A good rule of thumb for this could be: if you can define an “operator” overload for something, then it is an operator and should be fontified as such. Some examples: 1. `&&` or `and`, can define `operator &&()` or `operator and()` -> operator face. 2. `and_eq` or `&=`, can operator &=()` or `operator and_eq()` -> operator face. 3. `for`, cannot define `operator for()` -> keyword face. 4. `while`, cannot define `operator while()` -> keyword face. Just my pair of pennies... Best Regards, Jacob Faibussowitsch (Jacob Fai - booss - oh - vitch) > On Jan 8, 2025, at 7:49 AM, Eli Zaretskii <eliz@gnu.org> wrote: > >> From: Yuan Fu <casouri@gmail.com> >> Date: Tue, 7 Jan 2025 19:09:40 -0800 >> Cc: Jacob Faibussowitsch <jacob.fai@gmail.com>, >> 75226@debbugs.gnu.org >> >> I found that both c++-mode and c++-ts-mode fontifies C++ alternative operators like and_eq, xor, etc as keywords. Maybe we should fontify them in operator face (added in Emacs 29) instead? > > What do other editors do? > > Alan, WDYT about this? [-- Attachment #2: Type: text/html, Size: 1983 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-08 12:49 ` Eli Zaretskii 2025-01-08 13:58 ` Jacob Faibussowitsch @ 2025-01-08 14:49 ` Alan Mackenzie 2025-01-08 17:12 ` Dmitry Gutov 1 sibling, 1 reply; 14+ messages in thread From: Alan Mackenzie @ 2025-01-08 14:49 UTC (permalink / raw) To: Eli Zaretskii; +Cc: acm, Yuan Fu, 75226, jacob.fai Hello, Eli and Jacob. On Wed, Jan 08, 2025 at 14:49:50 +0200, Eli Zaretskii wrote: > > From: Yuan Fu <casouri@gmail.com> > > Date: Tue, 7 Jan 2025 19:09:40 -0800 > > Cc: Jacob Faibussowitsch <jacob.fai@gmail.com>, > > 75226@debbugs.gnu.org > > I found that both c++-mode and c++-ts-mode fontifies C++ alternative > > operators like and_eq, xor, etc as keywords. Maybe we should fontify > > them in operator face (added in Emacs 29) instead? > What do other editors do? > Alan, WDYT about this? For me personally, another face for "alphabetic operators" would come dangerously close to angry fruit salad. and_eq, xor, etc. _are_ keywords, so I think it makes sense to fontify them as such. The keywords in C++ could be divided into several categories, including alphabetic operators, and to give each category its own face would, I think, overload the typical user, who wouldn't instantly grasp what all the faces meant. This would be counterproductive. I don't think it makes too much sense to single out just one category of keywords for special treatment. Currently, C++ Mode has just two faces for these things: font-lock-keyword-face for alphabetic ones, and the default-face for those consisting of symbol characters like =, +, ;, ..... This is adequate, probably, for someone whose native language uses a Latin script. Maybe users of other languages see things differently. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword 2025-01-08 14:49 ` Alan Mackenzie @ 2025-01-08 17:12 ` Dmitry Gutov 0 siblings, 0 replies; 14+ messages in thread From: Dmitry Gutov @ 2025-01-08 17:12 UTC (permalink / raw) To: Alan Mackenzie, Eli Zaretskii; +Cc: Yuan Fu, 75226, jacob.fai On 08/01/2025 16:49, Alan Mackenzie wrote: >>> I found that both c++-mode and c++-ts-mode fontifies C++ alternative >>> operators like and_eq, xor, etc as keywords. Maybe we should fontify >>> them in operator face (added in Emacs 29) instead? >> What do other editors do? >> Alan, WDYT about this? > For me personally, another face for "alphabetic operators" would > come dangerously close to angry fruit salad. One of the benefits of the current setup is that font-lock-operator-face by default just inherits the attributes from the 'default' face. But custom themes (and individual users) can add distinction by customizing this face. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-01-08 17:12 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-12-31 16:01 bug#75226: [31.0.50] C++ ts-mode missing "alignof" as keyword Jacob Faibussowitsch 2025-01-02 3:28 ` Yuan Fu 2025-01-02 5:06 ` Stefan Kangas 2025-01-02 6:41 ` Eli Zaretskii 2025-01-02 14:03 ` Jacob Faibussowitsch 2025-01-02 15:47 ` Eli Zaretskii 2025-01-03 8:50 ` Yuan Fu 2025-01-03 11:38 ` Eli Zaretskii 2025-01-04 7:34 ` Yuan Fu 2025-01-08 3:09 ` Yuan Fu 2025-01-08 12:49 ` Eli Zaretskii 2025-01-08 13:58 ` Jacob Faibussowitsch 2025-01-08 14:49 ` Alan Mackenzie 2025-01-08 17:12 ` Dmitry Gutov
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).