python-mode: add 'exit' and 'quit' to the list of block-enders
'exit()' and 'quit()' end the current codeflow, there can't be any code past it, similarly to 'return', 'continue', etc. So when calculating indentation for the line next to 'exit()', 'os.exit()', 'os._exit()', 'sys.exit()' and 'quit()', decrease the indentation level. * /lisp/progmodes/python.el (python-rx): Add 'exit()', 'os.exit()', 'os._exit()', 'sys.exit()', 'quit' to the list of block-enders. (Bug#75729)
This commit is contained in:
parent
192355e54a
commit
0514619b2c
1 changed files with 11 additions and 4 deletions
|
@ -440,10 +440,17 @@ This variant of `rx' supports common Python named REGEXPS."
|
|||
(dedenter (seq symbol-start
|
||||
(or "elif" "else" "except" "finally" "case")
|
||||
symbol-end))
|
||||
(block-ender (seq symbol-start
|
||||
(or
|
||||
"break" "continue" "pass" "raise" "return")
|
||||
symbol-end))
|
||||
(block-ender (seq
|
||||
symbol-start
|
||||
(or
|
||||
(seq (or
|
||||
"break" "continue" "pass" "raise" "return")
|
||||
symbol-end)
|
||||
(seq
|
||||
(or
|
||||
(seq (? (or (seq "os." (? ?_)) "sys.")) "exit")
|
||||
"quit")
|
||||
(* space) "("))))
|
||||
(decorator (seq line-start (* space) ?@ (any letter ?_)
|
||||
(* (any word ?_))))
|
||||
(defun (seq symbol-start
|
||||
|
|
Loading…
Add table
Reference in a new issue