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).
This commit is contained in:
parent
5d8b6ba89e
commit
1e66c8af40
2 changed files with 57 additions and 2 deletions
|
@ -359,7 +359,8 @@
|
|||
(defmacro python-rx (&rest regexps)
|
||||
"Python mode specialized rx macro.
|
||||
This variant of `rx' supports common Python named REGEXPS."
|
||||
`(rx-let ((block-start (seq symbol-start
|
||||
`(rx-let ((sp-bsnl (or space (and ?\\ ?\n)))
|
||||
(block-start (seq symbol-start
|
||||
(or "def" "class" "if" "elif" "else" "try"
|
||||
"except" "finally" "for" "while" "with"
|
||||
;; Python 3.10+ PEP634
|
||||
|
@ -1439,7 +1440,7 @@ marks the next defun after the ones already marked."
|
|||
function))
|
||||
|
||||
(defvar python-nav-beginning-of-defun-regexp
|
||||
(python-rx line-start (* space) defun (+ space) (group symbol-name))
|
||||
(python-rx line-start (* space) defun (+ sp-bsnl) (group symbol-name))
|
||||
"Regexp matching class or function definition.
|
||||
The name of the defun should be grouped so it can be retrieved
|
||||
via `match-string'.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue