summaryrefslogtreecommitdiffstats
path: root/Misc/python-mode-old.el
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-04-13 19:01:12 (GMT)
committerGuido van Rossum <guido@python.org>1994-04-13 19:01:12 (GMT)
commitd3976e20d8181128ea59564b315e29bf13e57b96 (patch)
treea065a235c00bc96cf80dc6629c334716759ea13a /Misc/python-mode-old.el
parent5333c5d734e0a723bbb75fbd8371aba60765937f (diff)
downloadcpython-d3976e20d8181128ea59564b315e29bf13e57b96.zip
cpython-d3976e20d8181128ea59564b315e29bf13e57b96.tar.gz
cpython-d3976e20d8181128ea59564b315e29bf13e57b96.tar.bz2
Added Donald Beaudry's change for neater indentation within
parentheses
Diffstat (limited to 'Misc/python-mode-old.el')
-rw-r--r--Misc/python-mode-old.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/Misc/python-mode-old.el b/Misc/python-mode-old.el
index e748ca3..ae06251 100644
--- a/Misc/python-mode-old.el
+++ b/Misc/python-mode-old.el
@@ -1,4 +1,4 @@
-;;; Major mode for editing Python programs, version 1.08a
+;;; Major mode for editing Python programs, version 1.08a+
;; by: Tim Peters <tim@ksr.com>
;; after an original idea by: Michael A. Guravage
;;
@@ -204,6 +204,9 @@ Emacs bell is also rung as a warning.")
( ?\# . "<") ; hash starts comment
( ?\n . ">")))) ; newline ends comment
+(defvar py-nested-indent t
+ "*If non-nil, indent nested continuation lines to inside the opening paren")
+
(defconst py-stringlit-re "'\\([^'\n\\]\\|\\\\.\\)*'"
"regexp matching a Python string literal")
@@ -515,12 +518,18 @@ the new line indented."
(cond
;; are we on a continuation line?
( (py-continuation-line-p)
- (forward-line -1)
- (if (py-continuation-line-p) ; on at least 3rd line in block
- (current-indentation) ; so just continue the pattern
+ (let ((nest (and py-nested-indent (py-nesting-level))))
+ (if nest
+ (save-excursion
+ (goto-char nest)
+ (beginning-of-line)
+ (1+ (- nest (point))))
+ (forward-line -1)
+ (if (py-continuation-line-p) ; on at least 3rd line in block
+ (current-indentation) ; so just continue the pattern
;; else on 2nd line in block, so indent more
- (+ (current-indentation) py-indent-offset
- py-continuation-offset)))
+ (+ (current-indentation) py-indent-offset
+ py-continuation-offset)))))
;; not on a continuation line
;; if at start of restriction, or on a non-indenting comment line,