[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 8dafacd: * lisp/emacs-lisp/syntax.el (syntax-ppss-t
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 8dafacd: * lisp/emacs-lisp/syntax.el (syntax-ppss-table): New var |
Date: |
Sat, 16 Jan 2016 20:06:07 +0000 |
branch: master
commit 8dafacd0419ea890af461c9d42d4642155681eec
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* lisp/emacs-lisp/syntax.el (syntax-ppss-table): New var
(syntax-ppss):
* lisp/font-lock.el (font-lock-fontify-syntactically-region): Use it.
---
etc/NEWS | 2 ++
lisp/emacs-lisp/syntax.el | 6 +++++-
lisp/font-lock.el | 3 ++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 4265445..cb93979 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -73,6 +73,8 @@ different group ID.
* Lisp Changes in Emacs 25.2
+** New var syntax-ppss-table to control the syntax-table used in syntax-ppss
+
** Autoload files can be generated without timestamps,
by setting `autoload-timestamps' to nil.
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index e20a210..c221a01 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
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 3c1f01d..c79835d 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1564,6 +1564,7 @@ START should be at the beginning of a line."
"Put proper face on each string and comment between START and END.
START should be at the beginning of a line."
(syntax-propertize end) ; Apply any needed syntax-table properties.
+ (with-syntax-table (or syntax-ppss-table (syntax-table))
(let ((comment-end-regexp
(or font-lock-comment-end-skip
(regexp-quote
@@ -1598,7 +1599,7 @@ START should be at the beginning of a line."
font-lock-comment-delimiter-face))))
(< (point) end))
(setq state (parse-partial-sexp (point) end nil nil state
- 'syntax-table)))))
+ 'syntax-table))))))
;;; End of Syntactic fontification functions.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 8dafacd: * lisp/emacs-lisp/syntax.el (syntax-ppss-table): New var,
Stefan Monnier <=