diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:17 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:17 -0300 |
| commit | 65e4f7642eb551e6cfb8757cba84246a33b19590 (patch) | |
| tree | 1d846b9fd45a230af54ea97b5bdc5d3c1600a70a /lisp/progmodes/python.el | |
| parent | 589cefd7664e38a242d795ea8254bb51c6246f29 (diff) | |
| download | emacs-65e4f7642eb551e6cfb8757cba84246a33b19590.tar.gz emacs-65e4f7642eb551e6cfb8757cba84246a33b19590.zip | |
Fixed weird cornercase behavior in python-indent-calculate-indentation.
Doing (setq python-indent-levels '(0)) was causing the value of
python-indent-levels to not be initialized correctly on next calls to
python-indent-calculate-indentation. Using (setq python-indent-levels
(list 0)) instead does the trick but I'm not sure why.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 24fb37259b3..1cd1396f24f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -723,14 +723,11 @@ START is the buffer position where the sexp starts." | |||
| 723 | (let* ((indentation (python-indent-calculate-indentation)) | 723 | (let* ((indentation (python-indent-calculate-indentation)) |
| 724 | (remainder (% indentation python-indent-offset)) | 724 | (remainder (% indentation python-indent-offset)) |
| 725 | (steps (/ (- indentation remainder) python-indent-offset))) | 725 | (steps (/ (- indentation remainder) python-indent-offset))) |
| 726 | (setq python-indent-levels '(0)) | 726 | (setq python-indent-levels (list 0)) |
| 727 | (dotimes (step steps) | 727 | (dotimes (step steps) |
| 728 | (setq python-indent-levels | 728 | (push (* python-indent-offset (1+ step)) python-indent-levels)) |
| 729 | (cons (* python-indent-offset (1+ step)) python-indent-levels))) | ||
| 730 | (when (not (eq 0 remainder)) | 729 | (when (not (eq 0 remainder)) |
| 731 | (setq python-indent-levels | 730 | (push (+ (* python-indent-offset steps) remainder) python-indent-levels)) |
| 732 | (cons (+ (* python-indent-offset steps) remainder) | ||
| 733 | python-indent-levels))) | ||
| 734 | (setq python-indent-levels (nreverse python-indent-levels)) | 731 | (setq python-indent-levels (nreverse python-indent-levels)) |
| 735 | (setq python-indent-current-level (1- (length python-indent-levels))))) | 732 | (setq python-indent-current-level (1- (length python-indent-levels))))) |
| 736 | 733 | ||