From 17d13b85268a6b864e92af05cb8f0ed4461e3cc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Thu, 17 May 2012 00:03:03 -0300 Subject: [PATCH] Fixed indentation of multi-line function call's closing parenthesis --- lisp/progmodes/python.el | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1fd4f326d3c..564638c1b58 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -599,24 +599,32 @@ START is the buffer position where the sexp starts." (current-indentation))))) indentation)) ('inside-paren - (- - (save-excursion - (goto-char context-start) - (forward-char) - (save-restriction - (narrow-to-region - (line-beginning-position) - (line-end-position)) - (forward-comment 1)) - (if (looking-at "$") - (+ (current-indentation) python-indent-offset) - (forward-comment 1) - (current-column))) - (if (progn - (back-to-indentation) - (looking-at (regexp-opt '(")" "]" "}")))) - python-indent-offset - 0)))))))) + (or (save-excursion + (forward-comment 1) + (looking-at (regexp-opt '(")" "]" "}"))) + (forward-char 1) + (when (not (nth 1 (syntax-ppss))) + (goto-char context-start) + (back-to-indentation) + (current-column))) + (- + (save-excursion + (goto-char context-start) + (forward-char) + (save-restriction + (narrow-to-region + (line-beginning-position) + (line-end-position)) + (forward-comment 1)) + (if (looking-at "$") + (+ (current-indentation) python-indent-offset) + (forward-comment 1) + (current-column))) + (if (progn + (back-to-indentation) + (looking-at (regexp-opt '(")" "]" "}")))) + python-indent-offset + 0))))))))) (defun python-indent-calculate-levels () "Calculate `python-indent-levels' and reset `python-indent-current-level'." -- 2.39.5