diff options
| author | Stefan Monnier | 2015-10-28 22:18:47 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-10-28 22:18:47 -0400 |
| commit | d7a67c5a2fe63b6f087d6cae24c8f3b3c09eb57a (patch) | |
| tree | ba3918e411bf4eb09cc9868ff388d566a6f139be | |
| parent | ffa41ad2a02dbd1202d71a08bac34831f25662d0 (diff) | |
| download | emacs-d7a67c5a2fe63b6f087d6cae24c8f3b3c09eb57a.tar.gz emacs-d7a67c5a2fe63b6f087d6cae24c8f3b3c09eb57a.zip | |
(internal--syntax-propertize): Save match-data here (bug#21766)
* lisp/emacs-lisp/syntax.el (internal--syntax-propertize): Save match-data.
* lisp/simple.el (delete-trailing-whitespace): Undo last change.
| -rw-r--r-- | lisp/emacs-lisp/syntax.el | 11 | ||||
| -rw-r--r-- | lisp/simple.el | 3 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 95ed775f6b4..d446a2c0af7 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el | |||
| @@ -328,7 +328,7 @@ The return value is a function suitable for `syntax-propertize-function'." | |||
| 328 | ;;; Link syntax-propertize with syntax.c. | 328 | ;;; Link syntax-propertize with syntax.c. |
| 329 | 329 | ||
| 330 | (defvar syntax-propertize-chunks | 330 | (defvar syntax-propertize-chunks |
| 331 | ;; We're not sure how far we'll go. In my tests, using chunks of 20000 | 331 | ;; We're not sure how far we'll go. In my tests, using chunks of 2000 |
| 332 | ;; brings to overhead to something negligible. Passing ‘charpos’ directly | 332 | ;; brings to overhead to something negligible. Passing ‘charpos’ directly |
| 333 | ;; also works (basically works line-by-line) but results in an overhead which | 333 | ;; also works (basically works line-by-line) but results in an overhead which |
| 334 | ;; I thought was a bit too high (like around 50%). | 334 | ;; I thought was a bit too high (like around 50%). |
| @@ -336,7 +336,8 @@ The return value is a function suitable for `syntax-propertize-function'." | |||
| 336 | 336 | ||
| 337 | (defun internal--syntax-propertize (charpos) | 337 | (defun internal--syntax-propertize (charpos) |
| 338 | ;; FIXME: Called directly from C. | 338 | ;; FIXME: Called directly from C. |
| 339 | (syntax-propertize (min (+ syntax-propertize-chunks charpos) (point-max)))) | 339 | (save-match-data |
| 340 | (syntax-propertize (min (+ syntax-propertize-chunks charpos) (point-max))))) | ||
| 340 | 341 | ||
| 341 | ;;; Incrementally compute and memoize parser state. | 342 | ;;; Incrementally compute and memoize parser state. |
| 342 | 343 | ||
| @@ -376,12 +377,10 @@ This function should move the cursor back to some syntactically safe | |||
| 376 | point (where the PPSS is equivalent to nil).") | 377 | point (where the PPSS is equivalent to nil).") |
| 377 | (make-obsolete-variable 'syntax-begin-function nil "25.1") | 378 | (make-obsolete-variable 'syntax-begin-function nil "25.1") |
| 378 | 379 | ||
| 379 | (defvar syntax-ppss-cache nil | 380 | (defvar-local syntax-ppss-cache nil |
| 380 | "List of (POS . PPSS) pairs, in decreasing POS order.") | 381 | "List of (POS . PPSS) pairs, in decreasing POS order.") |
| 381 | (make-variable-buffer-local 'syntax-ppss-cache) | 382 | (defvar-local syntax-ppss-last nil |
| 382 | (defvar syntax-ppss-last nil | ||
| 383 | "Cache of (LAST-POS . LAST-PPSS).") | 383 | "Cache of (LAST-POS . LAST-PPSS).") |
| 384 | (make-variable-buffer-local 'syntax-ppss-last) | ||
| 385 | 384 | ||
| 386 | (defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache) | 385 | (defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache) |
| 387 | (defun syntax-ppss-flush-cache (beg &rest ignored) | 386 | (defun syntax-ppss-flush-cache (beg &rest ignored) |
diff --git a/lisp/simple.el b/lisp/simple.el index f6c580ffcd6..338a0600829 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -609,8 +609,7 @@ buffer if the variable `delete-trailing-lines' is non-nil." | |||
| 609 | (start (or start (point-min)))) | 609 | (start (or start (point-min)))) |
| 610 | (goto-char start) | 610 | (goto-char start) |
| 611 | (while (re-search-forward "\\s-$" end-marker t) | 611 | (while (re-search-forward "\\s-$" end-marker t) |
| 612 | (save-match-data | 612 | (skip-syntax-backward "-" (line-beginning-position)) |
| 613 | (skip-syntax-backward "-" (line-beginning-position))) | ||
| 614 | ;; Don't delete formfeeds, even if they are considered whitespace. | 613 | ;; Don't delete formfeeds, even if they are considered whitespace. |
| 615 | (if (looking-at-p ".*\f") | 614 | (if (looking-at-p ".*\f") |
| 616 | (goto-char (match-end 0))) | 615 | (goto-char (match-end 0))) |