diff options
| author | kobarity | 2022-10-16 11:26:29 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-10-16 11:26:29 +0200 |
| commit | cb975c6183ed1653cc8d7fe5283a9b294bf07bf4 (patch) | |
| tree | 94ff57522638d9aefafbb76eee7448f4fbef4390 /lisp/progmodes/python.el | |
| parent | f9726408f6cb56b3a97a9e76be166a5156faec0b (diff) | |
| download | emacs-cb975c6183ed1653cc8d7fe5283a9b294bf07bf4.tar.gz emacs-cb975c6183ed1653cc8d7fe5283a9b294bf07bf4.zip | |
Fix invalid search bound error in python-shell-completion-at-point
* lisp/progmodes/python.el (python-shell-completion-at-point): Add
check if point is before line-start.
* test/lisp/progmodes/python-tests.el (python-shell-completion-shell-buffer-1)
(python-shell-completion-shell-buffer-native-1): New tests
(bug#58548).
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 50f1e6752e4..11195894234 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -4080,15 +4080,18 @@ using that one instead of current buffer's process." | |||
| 4080 | (buffer-substring-no-properties line-start (point))) | 4080 | (buffer-substring-no-properties line-start (point))) |
| 4081 | (buffer-substring-no-properties line-start (point)))) | 4081 | (buffer-substring-no-properties line-start (point)))) |
| 4082 | (start | 4082 | (start |
| 4083 | (save-excursion | 4083 | (if (< (point) line-start) |
| 4084 | (if (not (re-search-backward | 4084 | (point) |
| 4085 | (python-rx | 4085 | (save-excursion |
| 4086 | (or whitespace open-paren close-paren string-delimiter simple-operator)) | 4086 | (if (not (re-search-backward |
| 4087 | line-start | 4087 | (python-rx |
| 4088 | t 1)) | 4088 | (or whitespace open-paren close-paren |
| 4089 | line-start | 4089 | string-delimiter simple-operator)) |
| 4090 | (forward-char (length (match-string-no-properties 0))) | 4090 | line-start |
| 4091 | (point)))) | 4091 | t 1)) |
| 4092 | line-start | ||
| 4093 | (forward-char (length (match-string-no-properties 0))) | ||
| 4094 | (point))))) | ||
| 4092 | (end (point)) | 4095 | (end (point)) |
| 4093 | (prompt-boundaries | 4096 | (prompt-boundaries |
| 4094 | (with-current-buffer (process-buffer process) | 4097 | (with-current-buffer (process-buffer process) |