Commit aeadd9a4 authored by Fabián Ezequiel Gallina's avatar Fabián Ezequiel Gallina Committed by Fabián Ezequiel Gallina

Migrated python-font-lock-syntactic-keywords to python-syntax-propertize-function

This is a backport of Stefan Monnier's migration to the new font-lock
machinery (introduced in 2010-09-10T23:13:42Z!

New Vars:
 + python-syntax-propertize-function

Deleted Vars:
 + python-font-lock-syntactic-keywords
parent 09268a54
......@@ -456,13 +456,15 @@ This variant of `rx' supports common python named REGEXPS."
(set-match-data nil)))))
(1 font-lock-variable-name-face nil nil))))
(defconst python-font-lock-syntactic-keywords
(defconst python-syntax-propertize-function
;; Make outer chars of matching triple-quote sequences into generic
;; string delimiters. Fixme: Is there a better way?
;; First avoid a sequence preceded by an odd number of backslashes.
`((,(concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix.
(3 (python-quote-syntax)))))
(;; ¡Backrefs don't work in syntax-propertize-rules!
(concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix.
(3 (ignore (python-quote-syntax))))))
(defun python-quote-syntax ()
"Put `syntax-table' property correctly on triple quote.
......@@ -1444,11 +1446,10 @@ variable.
(define-key inferior-python-mode-map (kbd "<tab>")
(when python-shell-enable-font-lock
(make-local-variable 'font-lock-defaults)
nil nil nil nil
(font-lock-syntactic-keywords . python-font-lock-syntactic-keywords))))
(set (make-local-variable 'font-lock-defaults)
'(python-font-lock-keywords nil nil nil nil))
(set (make-local-variable 'syntax-propertize-function)
(compilation-shell-minor-mode 1))
(defun python-shell-make-comint (cmd proc-name &optional pop)
......@@ -2805,9 +2806,10 @@ if that value is non-nil."
(set (make-local-variable 'parse-sexp-ignore-comments) t)
(set (make-local-variable 'font-lock-defaults)
nil nil nil nil
(font-lock-syntactic-keywords . python-font-lock-syntactic-keywords)))
'(python-font-lock-keywords nil nil nil nil))
(set (make-local-variable 'syntax-propertize-function)
(set (make-local-variable 'indent-line-function)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment