diff Misc/python-mode.el @ 3093:b3a8013cb4fa legacy-trunk

(py-compute-indentation): when inside a comment, indent to under the most previous non-blank line.
author Barry Warsaw <barry@python.org>
date Thu, 14 Sep 1995 18:49:11 +0000
parents 4a998b1a331f
children 5a1fbd21fc2a
line wrap: on
line diff
--- a/Misc/python-mode.el	Wed Sep 13 18:59:59 1995 +0000
+++ b/Misc/python-mode.el	Thu Sep 14 18:49:11 1995 +0000
@@ -784,6 +784,20 @@
   (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))