summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/syntax.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2016-01-16 15:06:04 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2016-01-16 15:06:04 -0500
commit8dafacd0419ea890af461c9d42d4642155681eec (patch)
tree8acc61f598a8f1dc1f235e4040e6b56aef914fb2 /lisp/emacs-lisp/syntax.el
parent56e1097584c13f2b6db85592769db1c6c36e9419 (diff)
downloademacs-8dafacd0419ea890af461c9d42d4642155681eec.tar.gz
* lisp/emacs-lisp/syntax.el (syntax-ppss-table): New var
(syntax-ppss): * lisp/font-lock.el (font-lock-fontify-syntactically-region): Use it.
Diffstat (limited to 'lisp/emacs-lisp/syntax.el')
-rw-r--r--lisp/emacs-lisp/syntax.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index e20a210de71..c221a017f51 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -416,6 +416,9 @@ point (where the PPSS is equivalent to nil).")
(error nil)))
syntax-ppss-stats))
+(defvar-local syntax-ppss-table nil
+ "Syntax-table to use during `syntax-ppss', if any.")
+
(defun syntax-ppss (&optional pos)
"Parse-Partial-Sexp State at POS, defaulting to point.
The returned value is the same as that of `parse-partial-sexp'
@@ -431,6 +434,7 @@ running the hook."
(unless pos (setq pos (point)))
(syntax-propertize pos)
;;
+ (with-syntax-table (or syntax-ppss-table (syntax-table))
(let ((old-ppss (cdr syntax-ppss-last))
(old-pos (car syntax-ppss-last))
(ppss nil)
@@ -567,7 +571,7 @@ running the hook."
;; we may end up calling parse-partial-sexp with a position before
;; point-min. In that case, just parse from point-min assuming
;; a nil state.
- (parse-partial-sexp (point-min) pos)))))
+ (parse-partial-sexp (point-min) pos))))))
;; Debugging functions