]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(py-compute-indentation): when inside a comment, indent to under the
authorBarry Warsaw <barry@python.org>
Thu, 14 Sep 1995 18:49:11 +0000 (18:49 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 14 Sep 1995 18:49:11 +0000 (18:49 +0000)
most previous non-blank line.

Misc/python-mode.el

index 2ec8f9549cad93d411f5d3318550eb242ee62e37..eb947593621a438d62fa1925410a501bc61d037c 100644 (file)
@@ -784,6 +784,20 @@ the new line indented."
   (save-excursion
     (beginning-of-line)
     (cond
+     ;; are we inside a string or comment?
+     ((save-excursion
+       (let ((pps (parse-partial-sexp (save-excursion
+                                        (beginning-of-python-def-or-class)
+                                        (point))
+                                      (point))))
+         (or (nth 3 pps) (nth 4 pps))))
+      (save-excursion
+       ;; skip back over blank & non-indenting comment lines note:
+       ;; will skip a blank or non-indenting comment line that
+       ;; happens to be a continuation line too
+       (re-search-backward "^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)" nil 'move)
+       (back-to-indentation)
+       (current-column)))
      ;; are we on a continuation line?
      ((py-continuation-line-p)
       (let ((startpos (point))