GNU bug report logs - #76353
[PATCH] Add python2-mode and python2-ts-mode

Previous Next

Package: emacs;

Reported by: kobarity <kobarity <at> gmail.com>

Date: Sun, 16 Feb 2025 22:32:01 UTC

Severity: wishlist

Tags: patch

Full log


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

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: kobarity <kobarity <at> gmail.com>, Stefan Kangas <stefankangas <at> gmail.com>, 
 tomas <at> tuxteam.de, Ship Mints <shipmints <at> gmail.com>,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>,
 76353 <at> debbugs.gnu.org
Subject: Re: [PATCH] Add python2-mode and python2-ts-mode
Date: Mon, 17 Feb 2025 07:53:04 +0300
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 👍 




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.