]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/python.el (python-indent-calculate-indentation): When
authorNathan Trapuzzano <nbtrap@nbtrap.com>
Thu, 12 Dec 2013 03:47:41 +0000 (00:47 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 12 Dec 2013 03:47:41 +0000 (00:47 -0300)
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
lisp/ChangeLog
lisp/progmodes/python.el
test/ChangeLog
test/automated/python-tests.el

index 7ec6750720b14682caa951bd8c25ceb813b6032c..c18e0a6a13352bbad90eadf5e2a7c1152fa4e397 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-12  Nathan Trapuzzano  <nbtrap@nbtrap.com>
+
+       * progmodes/python.el (python-indent-calculate-indentation): When
+       determining indentation, don't treat "return", "pass", etc., as
+       operators when they are just string constituents.  (Bug#15812)
+
 2013-12-12  Juri Linkov  <juri@jurta.org>
 
        * uniquify.el (uniquify-buffer-name-style): Change default to
index 3e0708cd3c2ecdde531ce7dc1f67895a340043d1..669da13564482d44d40846e9fc609612a08b7e43 100644 (file)
@@ -774,7 +774,7 @@ START is the buffer position where the sexp starts."
                     (save-excursion
                       (python-util-forward-comment -1)
                       (python-nav-beginning-of-statement)
-                      (member (current-word) python-indent-block-enders)))
+                      (looking-at (regexp-opt python-indent-block-enders))))
                 python-indent-offset
               0)))
           ;; When inside of a string, do nothing. just use the current
index 8fc6bc5158a03bbf39ec553fefdd3c08aa58150d..ce7208db229e31c3d4ebcf276e2e994d497d08b5 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-12  Nathan Trapuzzano  <nbtrap@nbtrap.com>
+
+       * automated/python-test.el (python-indent-block-enders-1): Rename
+       from python-indent-block-enders.
+       (python-indent-block-enders-2): New test.
+
 2013-12-08  Dmitry Gutov  <dgutov@yandex.ru>
 
        * indent/js.js: New file.
index 76a3add6bda1685c6a6a89f2d9f8b441c0f459a6..58a839a55004a986dbe9bcad552eaaccb95c92d4 100644 (file)
@@ -447,7 +447,7 @@ objects = Thing.objects.all() \\\\
    (should (eq (car (python-indent-context)) 'after-line))
    (should (= (python-indent-calculate-indentation) 0))))
 
-(ert-deftest python-indent-block-enders ()
+(ert-deftest python-indent-block-enders-1 ()
   "Test `python-indent-block-enders' value honoring."
   (python-tests-with-temp-buffer
    "
@@ -469,6 +469,27 @@ Class foo(object):
    (forward-line 1)
    (should (= (python-indent-calculate-indentation) 8))))
 
+(ert-deftest python-indent-block-enders-2 ()
+  "Test `python-indent-block-enders' value honoring."
+  (python-tests-with-temp-buffer
+   "
+Class foo(object):
+    '''raise lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+
+    eiusmod tempor incididunt ut labore et dolore magna aliqua.
+    '''
+    def bar(self):
+        \"return (1, 2, 3).\"
+        if self.baz:
+            return (1,
+                    2,
+                    3)
+"
+   (python-tests-look-at "def")
+   (should (= (python-indent-calculate-indentation) 4))
+   (python-tests-look-at "if")
+   (should (= (python-indent-calculate-indentation) 8))))
+
 \f
 ;;; Navigation