Improve heuristic for Python walrus operator
* lisp/progmodes/python.el (python-base-mode): Improve heuristic for Python walrus operator in 'electric-layout-mode'.
This commit is contained in:
parent
5c1889c964
commit
02a1e3052b
1 changed files with 2 additions and 3 deletions
|
@ -7073,11 +7073,10 @@ implementations: `python-mode' and `python-ts-mode'."
|
|||
`((?: . ,(lambda ()
|
||||
(and (zerop (car (syntax-ppss)))
|
||||
(python-info-statement-starts-block-p)
|
||||
;; Heuristic: assume walrus operator :=
|
||||
;; when colon is preceded by space.
|
||||
;; Heuristic for walrus operator :=
|
||||
(save-excursion
|
||||
(goto-char (- (point) 2))
|
||||
(looking-at (rx (not space) ":")))
|
||||
(looking-at (rx (not space) ":" eol)))
|
||||
'after)))))
|
||||
|
||||
;; Add """ ... """ pairing to electric-pair-mode.
|
||||
|
|
Loading…
Add table
Reference in a new issue