bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57574: [PATCH] Add Python import management commands


From: Augusto Stoffel
Subject: bug#57574: [PATCH] Add Python import management commands
Date: Sun, 04 Sep 2022 12:30:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Tags: patch

This patch adds a few commands to help managing import statements in
Python projects.  (I submitted equivalent code some time ago as a
potential ELPA package, and it was noted that this fits better in
python.el itself.)

This patch should be applied after the patch of bug#56997, since it
requires, in a rather substantial way, the project dependency.

I also had to introduce a new `python-interpreter' defcustom.  Here are
two observations:

1) Its default value should perhaps coincide with that of
   `python-shell-interpreter'.  But I disagree of the logic used there to
   pick python3 if present.  There are only two reasons why `python'
   should point to the python2 interpreter:
     a. The user is working on a legacy project and carefully set the
        python executable to point to a python2 interpreter.
     b. The user's OS is woefully misconfigured.
   We should have a default that works with case a. instead of one that
   tries to fix case b.
   
2) For extra consistency, it might be better to have
   python-shell-interpreter be nil by default, and use
       (or python-shell-interpreter python-interpreter)
   when starting a shell.  But this would be a minor improvement that
   might break third-party code.

Attachment: 0001-Add-Python-import-management-commands.patch
Description: Text Data

PS: Wouldn't it be handy also in other places to have a macro that
creates a temp buffer but doesn't switch to it?  Maybe with signature
(with-temp-buffers (NAMES &rest BODY)).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]