emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d7a67c5: (internal--syntax-propertize): Save match-


From: Stefan Monnier
Subject: [Emacs-diffs] master d7a67c5: (internal--syntax-propertize): Save match-data here (bug#21766)
Date: Thu, 29 Oct 2015 02:18:52 +0000

branch: master
commit d7a67c5a2fe63b6f087d6cae24c8f3b3c09eb57a
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    (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.
---
 lisp/emacs-lisp/syntax.el |   11 +++++------
 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 95ed775..d446a2c 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'."
 ;;; Link syntax-propertize with syntax.c.
 
 (defvar syntax-propertize-chunks
-  ;; We're not sure how far we'll go.  In my tests, using chunks of 20000
+  ;; We're not sure how far we'll go.  In my tests, using chunks of 2000
   ;; brings to overhead to something negligible.  Passing ‘charpos’ directly
   ;; also works (basically works line-by-line) but results in an overhead which
   ;; 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'."
 
 (defun internal--syntax-propertize (charpos)
   ;; FIXME: Called directly from C.
-  (syntax-propertize (min (+ syntax-propertize-chunks charpos) (point-max))))
+  (save-match-data
+    (syntax-propertize (min (+ syntax-propertize-chunks charpos) 
(point-max)))))
 
 ;;; Incrementally compute and memoize parser state.
 
@@ -376,12 +377,10 @@ This function should move the cursor back to some 
syntactically safe
 point (where the PPSS is equivalent to nil).")
 (make-obsolete-variable 'syntax-begin-function nil "25.1")
 
-(defvar syntax-ppss-cache nil
+(defvar-local syntax-ppss-cache nil
   "List of (POS . PPSS) pairs, in decreasing POS order.")
-(make-variable-buffer-local 'syntax-ppss-cache)
-(defvar syntax-ppss-last nil
+(defvar-local syntax-ppss-last nil
   "Cache of (LAST-POS . LAST-PPSS).")
-(make-variable-buffer-local 'syntax-ppss-last)
 
 (defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache)
 (defun syntax-ppss-flush-cache (beg &rest ignored)
diff --git a/lisp/simple.el b/lisp/simple.el
index f6c580f..338a060 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -609,8 +609,7 @@ buffer if the variable `delete-trailing-lines' is non-nil."
             (start (or start (point-min))))
         (goto-char start)
         (while (re-search-forward "\\s-$" end-marker t)
-          (save-match-data
-            (skip-syntax-backward "-" (line-beginning-position)))
+          (skip-syntax-backward "-" (line-beginning-position))
           ;; Don't delete formfeeds, even if they are considered whitespace.
           (if (looking-at-p ".*\f")
               (goto-char (match-end 0)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]