Improve docstrings of python.el import management

Added notes that when adding import statements for a file that
does not belong to a project, it may take some time to find
candidate import statements in the default directory.

* lisp/progmodes/python.el (python-add-import)
(python-fix-imports): Improve docstring.  (Bug#74894)
This commit is contained in:
kobarity 2025-03-02 17:37:36 +09:00 committed by Eli Zaretskii
parent 01bcc6961a
commit cf03c2b609

View file

@ -6911,6 +6911,12 @@ argument, restrict the suggestions to imports defining the symbol
at point. If there is only one such suggestion, act without
asking.
If the buffer does not belong to a project, the import statement is
searched under the buffer's default directory. For example, if the file
is located directly under the home directory, all files under the home
directory will be searched. Please note that this can take a long time
and may appear to hang.
When calling from Lisp, use a non-nil NAME to restrict the
suggestions to imports defining NAME."
(interactive (list (when current-prefix-arg (thing-at-point 'symbol))))
@ -6955,7 +6961,17 @@ asking."
;;;###autoload
(defun python-fix-imports ()
"Add missing imports and remove unused ones from the current buffer."
"Add missing imports and remove unused ones from the current buffer.
If there are missing imports, ask for an import statement using all
imports found in the current project as suggestions. If there is only
one such suggestion, act without asking.
If the buffer does not belong to a project, the import statement is
searched under the buffer's default directory. For example, if the file
is located directly under the home directory, all files under the home
directory will be searched. Please note that this can take a long time
and may appear to hang."
(interactive)
(let ((buffer (current-buffer))
undefined unused add remove)