mirror of
https://github.com/python/cpython
synced 2024-09-20 06:31:44 +00:00
(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.
This commit is contained in:
parent
a8f99ba2d2
commit
53db859408
|
@ -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)))
|
||||
|
|
Loading…
Reference in a new issue