diff options
| author | Stefan Monnier | 2016-01-16 15:06:04 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2016-01-16 15:06:04 -0500 |
| commit | 8dafacd0419ea890af461c9d42d4642155681eec (patch) | |
| tree | 8acc61f598a8f1dc1f235e4040e6b56aef914fb2 | |
| parent | 56e1097584c13f2b6db85592769db1c6c36e9419 (diff) | |
| download | emacs-8dafacd0419ea890af461c9d42d4642155681eec.tar.gz emacs-8dafacd0419ea890af461c9d42d4642155681eec.zip | |
* lisp/emacs-lisp/syntax.el (syntax-ppss-table): New var
(syntax-ppss):
* lisp/font-lock.el (font-lock-fontify-syntactically-region): Use it.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/syntax.el | 6 | ||||
| -rw-r--r-- | lisp/font-lock.el | 3 |
3 files changed, 9 insertions, 2 deletions
| @@ -73,6 +73,8 @@ different group ID. | |||
| 73 | 73 | ||
| 74 | * Lisp Changes in Emacs 25.2 | 74 | * Lisp Changes in Emacs 25.2 |
| 75 | 75 | ||
| 76 | ** New var syntax-ppss-table to control the syntax-table used in syntax-ppss | ||
| 77 | |||
| 76 | ** Autoload files can be generated without timestamps, | 78 | ** Autoload files can be generated without timestamps, |
| 77 | by setting `autoload-timestamps' to nil. | 79 | by setting `autoload-timestamps' to nil. |
| 78 | 80 | ||
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).") | |||
| 416 | (error nil))) | 416 | (error nil))) |
| 417 | syntax-ppss-stats)) | 417 | syntax-ppss-stats)) |
| 418 | 418 | ||
| 419 | (defvar-local syntax-ppss-table nil | ||
| 420 | "Syntax-table to use during `syntax-ppss', if any.") | ||
| 421 | |||
| 419 | (defun syntax-ppss (&optional pos) | 422 | (defun syntax-ppss (&optional pos) |
| 420 | "Parse-Partial-Sexp State at POS, defaulting to point. | 423 | "Parse-Partial-Sexp State at POS, defaulting to point. |
| 421 | The returned value is the same as that of `parse-partial-sexp' | 424 | The returned value is the same as that of `parse-partial-sexp' |
| @@ -431,6 +434,7 @@ running the hook." | |||
| 431 | (unless pos (setq pos (point))) | 434 | (unless pos (setq pos (point))) |
| 432 | (syntax-propertize pos) | 435 | (syntax-propertize pos) |
| 433 | ;; | 436 | ;; |
| 437 | (with-syntax-table (or syntax-ppss-table (syntax-table)) | ||
| 434 | (let ((old-ppss (cdr syntax-ppss-last)) | 438 | (let ((old-ppss (cdr syntax-ppss-last)) |
| 435 | (old-pos (car syntax-ppss-last)) | 439 | (old-pos (car syntax-ppss-last)) |
| 436 | (ppss nil) | 440 | (ppss nil) |
| @@ -567,7 +571,7 @@ running the hook." | |||
| 567 | ;; we may end up calling parse-partial-sexp with a position before | 571 | ;; we may end up calling parse-partial-sexp with a position before |
| 568 | ;; point-min. In that case, just parse from point-min assuming | 572 | ;; point-min. In that case, just parse from point-min assuming |
| 569 | ;; a nil state. | 573 | ;; a nil state. |
| 570 | (parse-partial-sexp (point-min) pos))))) | 574 | (parse-partial-sexp (point-min) pos)))))) |
| 571 | 575 | ||
| 572 | ;; Debugging functions | 576 | ;; Debugging functions |
| 573 | 577 | ||
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 3c1f01d5886..c79835dda49 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -1564,6 +1564,7 @@ START should be at the beginning of a line." | |||
| 1564 | "Put proper face on each string and comment between START and END. | 1564 | "Put proper face on each string and comment between START and END. |
| 1565 | START should be at the beginning of a line." | 1565 | START should be at the beginning of a line." |
| 1566 | (syntax-propertize end) ; Apply any needed syntax-table properties. | 1566 | (syntax-propertize end) ; Apply any needed syntax-table properties. |
| 1567 | (with-syntax-table (or syntax-ppss-table (syntax-table)) | ||
| 1567 | (let ((comment-end-regexp | 1568 | (let ((comment-end-regexp |
| 1568 | (or font-lock-comment-end-skip | 1569 | (or font-lock-comment-end-skip |
| 1569 | (regexp-quote | 1570 | (regexp-quote |
| @@ -1598,7 +1599,7 @@ START should be at the beginning of a line." | |||
| 1598 | font-lock-comment-delimiter-face)))) | 1599 | font-lock-comment-delimiter-face)))) |
| 1599 | (< (point) end)) | 1600 | (< (point) end)) |
| 1600 | (setq state (parse-partial-sexp (point) end nil nil state | 1601 | (setq state (parse-partial-sexp (point) end nil nil state |
| 1601 | 'syntax-table))))) | 1602 | 'syntax-table)))))) |
| 1602 | 1603 | ||
| 1603 | ;;; End of Syntactic fontification functions. | 1604 | ;;; End of Syntactic fontification functions. |
| 1604 | 1605 | ||