aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Trapuzzano2013-12-12 00:47:41 -0300
committerFabián Ezequiel Gallina2013-12-12 00:47:41 -0300
commitf54de22e65df1f0f0345efce4d6fd3487d0f7bb5 (patch)
tree6d409273d9641c2882505033c3ab0e9a50751e35
parent6cc4c89b6c45496cc63b3e0cee0971dc1a914015 (diff)
downloademacs-f54de22e65df1f0f0345efce4d6fd3487d0f7bb5.tar.gz
emacs-f54de22e65df1f0f0345efce4d6fd3487d0f7bb5.zip
* lisp/progmodes/python.el (python-indent-calculate-indentation): When
determining indentation, don't treat "return", "pass", etc., as operators when they are just string constituents. * automated/python-test.el (python-indent-block-enders-1): Rename from python-indent-block-enders. (python-indent-block-enders-2): New test. Fixes: debbugs:15812
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/python.el2
-rw-r--r--test/ChangeLog6
-rw-r--r--test/automated/python-tests.el23
4 files changed, 35 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7ec6750720b..c18e0a6a133 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-12-12 Nathan Trapuzzano <nbtrap@nbtrap.com>
2
3 * progmodes/python.el (python-indent-calculate-indentation): When
4 determining indentation, don't treat "return", "pass", etc., as
5 operators when they are just string constituents. (Bug#15812)
6
12013-12-12 Juri Linkov <juri@jurta.org> 72013-12-12 Juri Linkov <juri@jurta.org>
2 8
3 * uniquify.el (uniquify-buffer-name-style): Change default to 9 * uniquify.el (uniquify-buffer-name-style): Change default to
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 3e0708cd3c2..669da135644 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -774,7 +774,7 @@ START is the buffer position where the sexp starts."
774 (save-excursion 774 (save-excursion
775 (python-util-forward-comment -1) 775 (python-util-forward-comment -1)
776 (python-nav-beginning-of-statement) 776 (python-nav-beginning-of-statement)
777 (member (current-word) python-indent-block-enders))) 777 (looking-at (regexp-opt python-indent-block-enders))))
778 python-indent-offset 778 python-indent-offset
779 0))) 779 0)))
780 ;; When inside of a string, do nothing. just use the current 780 ;; When inside of a string, do nothing. just use the current
diff --git a/test/ChangeLog b/test/ChangeLog
index 8fc6bc5158a..ce7208db229 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
12013-12-12 Nathan Trapuzzano <nbtrap@nbtrap.com>
2
3 * automated/python-test.el (python-indent-block-enders-1): Rename
4 from python-indent-block-enders.
5 (python-indent-block-enders-2): New test.
6
12013-12-08 Dmitry Gutov <dgutov@yandex.ru> 72013-12-08 Dmitry Gutov <dgutov@yandex.ru>
2 8
3 * indent/js.js: New file. 9 * indent/js.js: New file.
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 76a3add6bda..58a839a5500 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -447,7 +447,7 @@ objects = Thing.objects.all() \\\\
447 (should (eq (car (python-indent-context)) 'after-line)) 447 (should (eq (car (python-indent-context)) 'after-line))
448 (should (= (python-indent-calculate-indentation) 0)))) 448 (should (= (python-indent-calculate-indentation) 0))))
449 449
450(ert-deftest python-indent-block-enders () 450(ert-deftest python-indent-block-enders-1 ()
451 "Test `python-indent-block-enders' value honoring." 451 "Test `python-indent-block-enders' value honoring."
452 (python-tests-with-temp-buffer 452 (python-tests-with-temp-buffer
453 " 453 "
@@ -469,6 +469,27 @@ Class foo(object):
469 (forward-line 1) 469 (forward-line 1)
470 (should (= (python-indent-calculate-indentation) 8)))) 470 (should (= (python-indent-calculate-indentation) 8))))
471 471
472(ert-deftest python-indent-block-enders-2 ()
473 "Test `python-indent-block-enders' value honoring."
474 (python-tests-with-temp-buffer
475 "
476Class foo(object):
477 '''raise lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
478
479 eiusmod tempor incididunt ut labore et dolore magna aliqua.
480 '''
481 def bar(self):
482 \"return (1, 2, 3).\"
483 if self.baz:
484 return (1,
485 2,
486 3)
487"
488 (python-tests-look-at "def")
489 (should (= (python-indent-calculate-indentation) 4))
490 (python-tests-look-at "if")
491 (should (= (python-indent-calculate-indentation) 8))))
492
472 493
473;;; Navigation 494;;; Navigation
474 495