summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-05-24 19:57:32 (GMT)
committerBarry Warsaw <barry@python.org>1999-05-24 19:57:32 (GMT)
commit53db859408bc40defe77b162a52d851785fac97e (patch)
treefd88a891b8e4285ceeff1a5512e730a59d57c23e /Misc
parenta8f99ba2d217f94d8129bede137296b08c16c750 (diff)
downloadcpython-53db859408bc40defe77b162a52d851785fac97e.zip
cpython-53db859408bc40defe77b162a52d851785fac97e.tar.gz
cpython-53db859408bc40defe77b162a52d851785fac97e.tar.bz2
(py-parse-state): When running under Emacs -- which doesn't have
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.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index 3e24ba3..a62e173 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -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)))