]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(py-parse-state): When running under Emacs -- which doesn't have
authorBarry Warsaw <barry@python.org>
Mon, 24 May 1999 19:57:32 +0000 (19:57 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 24 May 1999 19:57:32 +0000 (19:57 +0000)
buffer-syntactic-context -- just short circuit the TQS test by jumping
to point-min and doing the test from there.  For long files, this will
be faster than looping with a re-search-backwards.

Misc/python-mode.el

index 3e24ba371ceb8c09b6c892a4bcd4da7673328245..a62e17378b6093efd05bddd142599e2a6df0bd73 100644 (file)
@@ -2786,7 +2786,13 @@ local bindings to py-newline-and-indent."))
              (save-excursion (setq pps (parse-partial-sexp (point) here)))
              ;; make sure we don't land inside a triple-quoted string
              (setq done (or (not (nth 3 pps))
-                            (bobp))))
+                            (bobp)))
+             ;; Just go ahead and short circuit the test back to the
+             ;; beginning of the buffer.  This will be slow, but not
+             ;; nearly as slow as looping through many
+             ;; re-search-backwards.
+             (if (not done)
+                 (goto-char (point-min))))
          ;; XEmacs
          (setq done (or (not (buffer-syntactic-context))
                         (bobp)))