]> code.delx.au - gnu-emacs/commitdiff
Indentation enhancements on after-backslash
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:18 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:18 +0000 (00:03 -0300)
Multiline sentences beginning with "import", "from" or "return" are
indented correctly now.

lisp/progmodes/python.el

index 4589a828ebed6da955a56137c884eed2b615d889..20176944ebcd32ddd6f8dded2a431bf1af068876 100644 (file)
@@ -681,14 +681,15 @@ START is the buffer position where the sexp starts."
                                  (current-column))
                                 (t
                                  (goto-char context-start)
-                                 (if (not (member
-                                           (save-excursion
-                                             (back-to-indentation)
-                                             (message (current-word)))
-                                           '("return" "import" "from")))
+                                 (if (not
+                                      (save-excursion
+                                        (back-to-indentation)
+                                        (looking-at
+                                         "\\(?:return\\|from\\|import\\)\s+")))
                                      (current-indentation)
                                    (+ (current-indentation)
-                                      python-indent-offset))))))
+                                      (length
+                                       (match-string-no-properties 0))))))))
              indentation))
           ('inside-paren
            (or (save-excursion