diff options
| author | kobarity | 2025-03-02 17:37:36 +0900 |
|---|---|---|
| committer | Eli Zaretskii | 2025-03-07 16:52:09 +0200 |
| commit | cf03c2b6093d3b555f758f033610a6015378de57 (patch) | |
| tree | 7e3bc2b0e872e2a1f7928436245cac87ea3a9df9 /lisp/progmodes/python.el | |
| parent | 01bcc6961a6b0db36c371c9016d6eb00a1ae8ea2 (diff) | |
| download | emacs-cf03c2b6093d3b555f758f033610a6015378de57.tar.gz emacs-cf03c2b6093d3b555f758f033610a6015378de57.zip | |
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)
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 7f329f91e4f..f966190ea6d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -6911,6 +6911,12 @@ argument, restrict the suggestions to imports defining the symbol | |||
| 6911 | at point. If there is only one such suggestion, act without | 6911 | at point. If there is only one such suggestion, act without |
| 6912 | asking. | 6912 | asking. |
| 6913 | 6913 | ||
| 6914 | If the buffer does not belong to a project, the import statement is | ||
| 6915 | searched under the buffer's default directory. For example, if the file | ||
| 6916 | is located directly under the home directory, all files under the home | ||
| 6917 | directory will be searched. Please note that this can take a long time | ||
| 6918 | and may appear to hang. | ||
| 6919 | |||
| 6914 | When calling from Lisp, use a non-nil NAME to restrict the | 6920 | When calling from Lisp, use a non-nil NAME to restrict the |
| 6915 | suggestions to imports defining NAME." | 6921 | suggestions to imports defining NAME." |
| 6916 | (interactive (list (when current-prefix-arg (thing-at-point 'symbol)))) | 6922 | (interactive (list (when current-prefix-arg (thing-at-point 'symbol)))) |
| @@ -6955,7 +6961,17 @@ asking." | |||
| 6955 | 6961 | ||
| 6956 | ;;;###autoload | 6962 | ;;;###autoload |
| 6957 | (defun python-fix-imports () | 6963 | (defun python-fix-imports () |
| 6958 | "Add missing imports and remove unused ones from the current buffer." | 6964 | "Add missing imports and remove unused ones from the current buffer. |
| 6965 | |||
| 6966 | If there are missing imports, ask for an import statement using all | ||
| 6967 | imports found in the current project as suggestions. If there is only | ||
| 6968 | one such suggestion, act without asking. | ||
| 6969 | |||
| 6970 | If the buffer does not belong to a project, the import statement is | ||
| 6971 | searched under the buffer's default directory. For example, if the file | ||
| 6972 | is located directly under the home directory, all files under the home | ||
| 6973 | directory will be searched. Please note that this can take a long time | ||
| 6974 | and may appear to hang." | ||
| 6959 | (interactive) | 6975 | (interactive) |
| 6960 | (let ((buffer (current-buffer)) | 6976 | (let ((buffer (current-buffer)) |
| 6961 | undefined unused add remove) | 6977 | undefined unused add remove) |