GNU bug report logs -
#76353
[PATCH] Add python2-mode and python2-ts-mode
Previous Next
To reply to this bug, email your comments to 76353 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Sun, 16 Feb 2025 22:32:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
kobarity <kobarity <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 16 Feb 2025 22:32:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
There was a request to prevent the Python 2-only builtin "file" from
being highlighted, and we discussed this in emacs-devel:
https://lists.gnu.org/archive/html/emacs-devel/2025-01/msg00839.html
https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00041.html
One idea was to introduce the customizable variable `python-2-support'
and it was implemented in commit
999d054dc1e265f1a39c10035a3a3f7f75de8445. However, there was a
suggestion to create a mode for Python 2.
Attached is a patch to add `python2-mode' and `python2-ts-mode'.
Please give your opinion on introducing them. I think the pros and
cons of this patch are as follows:
Pros:
- While `python-2-support' is a global setting, `python2-mode' and
`python2-ts-mode' can be used simultaneously with `python-mode' and
`python-ts-mode'.
- You can take advantage of the various means of mode selection
offered by Emacs.
- While Python 3-only keywords/builtins are highlighted even if
`python-2-support' is enabled, they are not highlighted in
`python2-mode' and `python2-ts-mode'.
- Keywords/Builtins are organized so they can be easily customized in
init.el.
Cons:
- There is a risk of bugs being introduced because of a certain amount
of change.
- The separation of features is incomplete. For example, Python
3-only features such as f-strings and type annotations are
supported even in `python2-mode' or `python2-ts-mode'.
In the process of making this patch, I noticed that the FFAP support
does not work in `python-ts-mode'. This patch includes that fix. If
we decide not to adopt this patch, I will propose only the FFAP
support fix in another patch.
[0001-Add-python2-mode-and-python2-ts-mode.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Mon, 17 Feb 2025 04:54:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 76353 <at> debbugs.gnu.org (full text, mbox):
On Mon, 2025-02-17 at 07:31 +0900, kobarity wrote:
> There was a request to prevent the Python 2-only builtin "file" from
> being highlighted, and we discussed this in emacs-devel:
>
> https://lists.gnu.org/archive/html/emacs-devel/2025-01/msg00839.html
> https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00041.html
>
> One idea was to introduce the customizable variable `python-2-
> support'
> and it was implemented in commit
> 999d054dc1e265f1a39c10035a3a3f7f75de8445. However, there was a
> suggestion to create a mode for Python 2.
>
> Attached is a patch to add `python2-mode' and `python2-ts-mode'.
> Please give your opinion on introducing them. I think the pros and
> cons of this patch are as follows:
>
> Pros:
> - While `python-2-support' is a global setting, `python2-mode' and
> `python2-ts-mode' can be used simultaneously with `python-mode' and
> `python-ts-mode'.
> - You can take advantage of the various means of mode selection
> offered by Emacs.
> - While Python 3-only keywords/builtins are highlighted even if
> `python-2-support' is enabled, they are not highlighted in
> `python2-mode' and `python2-ts-mode'.
> - Keywords/Builtins are organized so they can be easily customized in
> init.el.
>
> Cons:
> - There is a risk of bugs being introduced because of a certain
> amount
> of change.
> - The separation of features is incomplete. For example, Python
> 3-only features such as f-strings and type annotations are
> supported even in `python2-mode' or `python2-ts-mode'.
>
> In the process of making this patch, I noticed that the FFAP support
> does not work in `python-ts-mode'. This patch includes that fix. If
> we decide not to adopt this patch, I will propose only the FFAP
> support fix in another patch.
LGTM!
I'd have separated FFAP support to a distinct commit anyway because
that simplifies review and logs reading, but AFAIK in Emacs this
mandatory, so other than that looks good to me 👍
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Mon, 17 Feb 2025 04:59:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 76353 <at> debbugs.gnu.org (full text, mbox):
On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> but AFAIK in Emacs this
> mandatory, so other than that looks good to me 👍
s/mandatory/isn't mandatory
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Mon, 17 Feb 2025 12:28:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 76353 <at> debbugs.gnu.org (full text, mbox):
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Date: Mon, 17 Feb 2025 07:57:57 +0300
>
> On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > but AFAIK in Emacs this
> > mandatory, so other than that looks good to me 👍
>
> s/mandatory/isn't mandatory
What is...not "mandatory", but "very much desirable", is to avoid
separate commits that must be applied together or not at all. Even if
they change different and separate parts of Emacs.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Mon, 17 Feb 2025 12:48:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 76353 <at> debbugs.gnu.org (full text, mbox):
On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > Date: Mon, 17 Feb 2025 07:57:57 +0300
> >
> > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > > but AFAIK in Emacs this
> > > mandatory, so other than that looks good to me 👍
> >
> > s/mandatory/isn't mandatory
>
> What is...not "mandatory", but "very much desirable", is to avoid
> separate commits that must be applied together or not at all. Even
> if
> they change different and separate parts of Emacs.
Sure. A commit should be self-contained functional change, unrelated
to other commits (unless the opposite is desired by maintainers for
specific reasons, which happens rarely). It is kobarity's case though,
because kobarity mentioned the change may be sent separately 😊
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Mon, 17 Feb 2025 14:38:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 76353 <at> debbugs.gnu.org (full text, mbox):
Konstantin Kharlamov wrote:
>
> On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > Date: Mon, 17 Feb 2025 07:57:57 +0300
> > >
> > > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > > > but AFAIK in Emacs this
> > > > mandatory, so other than that looks good to me 👍
> > >
> > > s/mandatory/isn't mandatory
> >
> > What is...not "mandatory", but "very much desirable", is to avoid
> > separate commits that must be applied together or not at all. Even
> > if
> > they change different and separate parts of Emacs.
>
> Sure. A commit should be self-contained functional change, unrelated
> to other commits (unless the opposite is desired by maintainers for
> specific reasons, which happens rarely). It is kobarity's case though,
> because kobarity mentioned the change may be sent separately 😊
I agree that it is better to fix the separate issues in their own
patches, and since I think the discussion of adding a `python2-mode'
will take a bit of time, I have sent the FFAP fix to
76364 <at> debbugs.gnu.org. The FFAP fix is small and I expect it to be
accepted relatively quickly. Once the fix is committed, I will rebase
the `python2-mode' patch.
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 19 Feb 2025 02:09:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Wed, 19 Feb 2025 14:59:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 76353 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
kobarity wrote:
>
> Konstantin Kharlamov wrote:
> >
> > On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > > Date: Mon, 17 Feb 2025 07:57:57 +0300
> > > >
> > > > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > > > > but AFAIK in Emacs this
> > > > > mandatory, so other than that looks good to me 👍
> > > >
> > > > s/mandatory/isn't mandatory
> > >
> > > What is...not "mandatory", but "very much desirable", is to avoid
> > > separate commits that must be applied together or not at all. Even
> > > if
> > > they change different and separate parts of Emacs.
> >
> > Sure. A commit should be self-contained functional change, unrelated
> > to other commits (unless the opposite is desired by maintainers for
> > specific reasons, which happens rarely). It is kobarity's case though,
> > because kobarity mentioned the change may be sent separately 😊
>
> I agree that it is better to fix the separate issues in their own
> patches, and since I think the discussion of adding a `python2-mode'
> will take a bit of time, I have sent the FFAP fix to
> 76364 <at> debbugs.gnu.org. The FFAP fix is small and I expect it to be
> accepted relatively quickly. Once the fix is committed, I will rebase
> the `python2-mode' patch.
As 76364 is committed, I rebased the `python2-mode' patch.
[0001-Add-python2-mode-and-python2-ts-mode.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Fri, 28 Feb 2025 10:16:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 76353 <at> debbugs.gnu.org (full text, mbox):
kobarity wrote:
> kobarity wrote:
> >
> > Konstantin Kharlamov wrote:
> > >
> > > On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > > > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > > > Date: Mon, 17 Feb 2025 07:57:57 +0300
> > > > >
> > > > > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > > > > > but AFAIK in Emacs this
> > > > > > mandatory, so other than that looks good to me 👍
> > > > >
> > > > > s/mandatory/isn't mandatory
> > > >
> > > > What is...not "mandatory", but "very much desirable", is to avoid
> > > > separate commits that must be applied together or not at all. Even
> > > > if
> > > > they change different and separate parts of Emacs.
> > >
> > > Sure. A commit should be self-contained functional change, unrelated
> > > to other commits (unless the opposite is desired by maintainers for
> > > specific reasons, which happens rarely). It is kobarity's case though,
> > > because kobarity mentioned the change may be sent separately 😊
> >
> > I agree that it is better to fix the separate issues in their own
> > patches, and since I think the discussion of adding a `python2-mode'
> > will take a bit of time, I have sent the FFAP fix to
> > 76364 <at> debbugs.gnu.org. The FFAP fix is small and I expect it to be
> > accepted relatively quickly. Once the fix is committed, I will rebase
> > the `python2-mode' patch.
>
> As 76364 is committed, I rebased the `python2-mode' patch.
Any other comments or suggestions? People who only use Python 3 are
also welcome to try this patch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Sun, 09 Mar 2025 09:42:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 76353 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 28 Feb 2025 19:15:26 +0900
> From: kobarity <kobarity <at> gmail.com>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,
> stefankangas <at> gmail.com,
> tomas <at> tuxteam.de,
> shipmints <at> gmail.com,
> kevin.legouguec <at> gmail.com,
> 76353 <at> debbugs.gnu.org
>
> kobarity wrote:
> > kobarity wrote:
> > >
> > > Konstantin Kharlamov wrote:
> > > >
> > > > On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > > > > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > > > > Date: Mon, 17 Feb 2025 07:57:57 +0300
> > > > > >
> > > > > > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > > > > > > but AFAIK in Emacs this
> > > > > > > mandatory, so other than that looks good to me 👍
> > > > > >
> > > > > > s/mandatory/isn't mandatory
> > > > >
> > > > > What is...not "mandatory", but "very much desirable", is to avoid
> > > > > separate commits that must be applied together or not at all. Even
> > > > > if
> > > > > they change different and separate parts of Emacs.
> > > >
> > > > Sure. A commit should be self-contained functional change, unrelated
> > > > to other commits (unless the opposite is desired by maintainers for
> > > > specific reasons, which happens rarely). It is kobarity's case though,
> > > > because kobarity mentioned the change may be sent separately 😊
> > >
> > > I agree that it is better to fix the separate issues in their own
> > > patches, and since I think the discussion of adding a `python2-mode'
> > > will take a bit of time, I have sent the FFAP fix to
> > > 76364 <at> debbugs.gnu.org. The FFAP fix is small and I expect it to be
> > > accepted relatively quickly. Once the fix is committed, I will rebase
> > > the `python2-mode' patch.
> >
> > As 76364 is committed, I rebased the `python2-mode' patch.
>
> Any other comments or suggestions? People who only use Python 3 are
> also welcome to try this patch.
Should we now install the patch?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Sun, 09 Mar 2025 11:52:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 76353 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
>
> > Date: Fri, 28 Feb 2025 19:15:26 +0900
> > From: kobarity <kobarity <at> gmail.com>
> > Cc: Eli Zaretskii <eliz <at> gnu.org>,
> > stefankangas <at> gmail.com,
> > tomas <at> tuxteam.de,
> > shipmints <at> gmail.com,
> > kevin.legouguec <at> gmail.com,
> > 76353 <at> debbugs.gnu.org
> >
> > kobarity wrote:
> > > kobarity wrote:
> > > >
> > > > Konstantin Kharlamov wrote:
> > > > >
> > > > > On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > > > > > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > > > > > Date: Mon, 17 Feb 2025 07:57:57 +0300
> > > > > > >
> > > > > > > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov wrote:
> > > > > > > > but AFAIK in Emacs this
> > > > > > > > mandatory, so other than that looks good to me 👍
> > > > > > >
> > > > > > > s/mandatory/isn't mandatory
> > > > > >
> > > > > > What is...not "mandatory", but "very much desirable", is to avoid
> > > > > > separate commits that must be applied together or not at all. Even
> > > > > > if
> > > > > > they change different and separate parts of Emacs.
> > > > >
> > > > > Sure. A commit should be self-contained functional change, unrelated
> > > > > to other commits (unless the opposite is desired by maintainers for
> > > > > specific reasons, which happens rarely). It is kobarity's case though,
> > > > > because kobarity mentioned the change may be sent separately 😊
> > > >
> > > > I agree that it is better to fix the separate issues in their own
> > > > patches, and since I think the discussion of adding a `python2-mode'
> > > > will take a bit of time, I have sent the FFAP fix to
> > > > 76364 <at> debbugs.gnu.org. The FFAP fix is small and I expect it to be
> > > > accepted relatively quickly. Once the fix is committed, I will rebase
> > > > the `python2-mode' patch.
> > >
> > > As 76364 is committed, I rebased the `python2-mode' patch.
> >
> > Any other comments or suggestions? People who only use Python 3 are
> > also welcome to try this patch.
>
> Should we now install the patch?
Well, so far there is no opposition to this patch. However, there is
also only one person in favor. Personally, I think this patch is
better than the current `python-2-support', but I'm not sure if we
agreed or not.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Sun, 09 Mar 2025 11:59:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 76353 <at> debbugs.gnu.org (full text, mbox):
On Sun, 2025-03-09 at 20:51 +0900, kobarity wrote:
> Eli Zaretskii wrote:
> >
> > > Date: Fri, 28 Feb 2025 19:15:26 +0900
> > > From: kobarity <kobarity <at> gmail.com>
> > > Cc: Eli Zaretskii <eliz <at> gnu.org>,
> > > stefankangas <at> gmail.com,
> > > tomas <at> tuxteam.de,
> > > shipmints <at> gmail.com,
> > > kevin.legouguec <at> gmail.com,
> > > 76353 <at> debbugs.gnu.org
> > >
> > > kobarity wrote:
> > > > kobarity wrote:
> > > > >
> > > > > Konstantin Kharlamov wrote:
> > > > > >
> > > > > > On Mon, 2025-02-17 at 14:26 +0200, Eli Zaretskii wrote:
> > > > > > > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > > > > > > Date: Mon, 17 Feb 2025 07:57:57 +0300
> > > > > > > >
> > > > > > > > On Mon, 2025-02-17 at 07:53 +0300, Konstantin Kharlamov
> > > > > > > > wrote:
> > > > > > > > > but AFAIK in Emacs this
> > > > > > > > > mandatory, so other than that looks good to me 👍
> > > > > > > >
> > > > > > > > s/mandatory/isn't mandatory
> > > > > > >
> > > > > > > What is...not "mandatory", but "very much desirable", is
> > > > > > > to avoid
> > > > > > > separate commits that must be applied together or not at
> > > > > > > all. Even
> > > > > > > if
> > > > > > > they change different and separate parts of Emacs.
> > > > > >
> > > > > > Sure. A commit should be self-contained functional change,
> > > > > > unrelated
> > > > > > to other commits (unless the opposite is desired by
> > > > > > maintainers for
> > > > > > specific reasons, which happens rarely). It is kobarity's
> > > > > > case though,
> > > > > > because kobarity mentioned the change may be sent
> > > > > > separately 😊
> > > > >
> > > > > I agree that it is better to fix the separate issues in their
> > > > > own
> > > > > patches, and since I think the discussion of adding a
> > > > > `python2-mode'
> > > > > will take a bit of time, I have sent the FFAP fix to
> > > > > 76364 <at> debbugs.gnu.org. The FFAP fix is small and I expect it
> > > > > to be
> > > > > accepted relatively quickly. Once the fix is committed, I
> > > > > will rebase
> > > > > the `python2-mode' patch.
> > > >
> > > > As 76364 is committed, I rebased the `python2-mode' patch.
> > >
> > > Any other comments or suggestions? People who only use Python 3
> > > are
> > > also welcome to try this patch.
> >
> > Should we now install the patch?
>
> Well, so far there is no opposition to this patch. However, there is
> also only one person in favor. Personally, I think this patch is
> better than the current `python-2-support', but I'm not sure if we
> agreed or not.
The patch/idea seems good! 👍 Last few weeks I didn't have to work with
Python though, so couldn't test the patch, sorry. But I did look the
patch back when you posted it and it looks fine to me.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76353
; Package
emacs
.
(Sun, 09 Mar 2025 17:27:02 GMT)
Full text and
rfc822 format available.
Message #40 received at 76353 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Should we now install the patch?
I'll try to review this soon. If there's nothing that stands out, I'll
install it then.
This bug report was last modified 100 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.