diff options
| author | kobarity | 2022-05-28 18:51:01 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-05-28 18:51:01 +0200 |
| commit | 1e66c8af402176e9f1b5f3fbdbf5f796fec79079 (patch) | |
| tree | 9395a9e2a1e75c48be809b8f084f8f0f0716d47c /lisp/progmodes/python.el | |
| parent | 5d8b6ba89efdcddfd0189da77dd4099283466a05 (diff) | |
| download | emacs-1e66c8af402176e9f1b5f3fbdbf5f796fec79079.tar.gz emacs-1e66c8af402176e9f1b5f3fbdbf5f796fec79079.zip | |
Fix Python Hideshow problem with backslash escaped newlines
* lisp/progmodes/python.el (python-rx)
(python-nav-beginning-of-defun-regexp): Allow
python-nav-*-defun to handle backslash escaped newlines
(bug#55690).
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9adbb82abf4..c2483436fe9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -359,7 +359,8 @@ | |||
| 359 | (defmacro python-rx (&rest regexps) | 359 | (defmacro python-rx (&rest regexps) |
| 360 | "Python mode specialized rx macro. | 360 | "Python mode specialized rx macro. |
| 361 | This variant of `rx' supports common Python named REGEXPS." | 361 | This variant of `rx' supports common Python named REGEXPS." |
| 362 | `(rx-let ((block-start (seq symbol-start | 362 | `(rx-let ((sp-bsnl (or space (and ?\\ ?\n))) |
| 363 | (block-start (seq symbol-start | ||
| 363 | (or "def" "class" "if" "elif" "else" "try" | 364 | (or "def" "class" "if" "elif" "else" "try" |
| 364 | "except" "finally" "for" "while" "with" | 365 | "except" "finally" "for" "while" "with" |
| 365 | ;; Python 3.10+ PEP634 | 366 | ;; Python 3.10+ PEP634 |
| @@ -1439,7 +1440,7 @@ marks the next defun after the ones already marked." | |||
| 1439 | function)) | 1440 | function)) |
| 1440 | 1441 | ||
| 1441 | (defvar python-nav-beginning-of-defun-regexp | 1442 | (defvar python-nav-beginning-of-defun-regexp |
| 1442 | (python-rx line-start (* space) defun (+ space) (group symbol-name)) | 1443 | (python-rx line-start (* space) defun (+ sp-bsnl) (group symbol-name)) |
| 1443 | "Regexp matching class or function definition. | 1444 | "Regexp matching class or function definition. |
| 1444 | The name of the defun should be grouped so it can be retrieved | 1445 | The name of the defun should be grouped so it can be retrieved |
| 1445 | via `match-string'.") | 1446 | via `match-string'.") |