diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ff805d64024..ee98feaef5e 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1733,17 +1733,24 @@ variable. | |||
| 1733 | (set (make-local-variable 'font-lock-defaults) | 1733 | (set (make-local-variable 'font-lock-defaults) |
| 1734 | '(python-font-lock-keywords nil nil nil nil)) | 1734 | '(python-font-lock-keywords nil nil nil nil)) |
| 1735 | (set (make-local-variable 'syntax-propertize-function) | 1735 | (set (make-local-variable 'syntax-propertize-function) |
| 1736 | (syntax-propertize-rules | 1736 | (eval |
| 1737 | (comint-prompt-regexp | 1737 | ;; XXX: Unfortunately eval is needed here to make use of the |
| 1738 | (0 (ignore | 1738 | ;; dynamic value of `comint-prompt-regexp'. |
| 1739 | (put-text-property | 1739 | `(syntax-propertize-rules |
| 1740 | comint-last-input-start end 'syntax-table | 1740 | (,comint-prompt-regexp |
| 1741 | python-shell-output-syntax-table) | 1741 | (0 (ignore |
| 1742 | (font-lock-unfontify-region comint-last-input-start end)))) | 1742 | (put-text-property |
| 1743 | ((python-rx string-delimiter) | 1743 | comint-last-input-start end 'syntax-table |
| 1744 | (0 (ignore | 1744 | python-shell-output-syntax-table) |
| 1745 | (and (not (eq (get-text-property start 'field) 'output)) | 1745 | ;; XXX: This might look weird, but it is the easiest |
| 1746 | (python-syntax-stringify)))))))) | 1746 | ;; way to ensure font lock gets cleaned up before the |
| 1747 | ;; current prompt, which is needed for unclosed | ||
| 1748 | ;; strings to not mess up with current input. | ||
| 1749 | (font-lock-unfontify-region comint-last-input-start end)))) | ||
| 1750 | (,(python-rx string-delimiter) | ||
| 1751 | (0 (ignore | ||
| 1752 | (and (not (eq (get-text-property start 'field) 'output)) | ||
| 1753 | (python-syntax-stringify))))))))) | ||
| 1747 | (compilation-shell-minor-mode 1)) | 1754 | (compilation-shell-minor-mode 1)) |
| 1748 | 1755 | ||
| 1749 | (defun python-shell-make-comint (cmd proc-name &optional pop internal) | 1756 | (defun python-shell-make-comint (cmd proc-name &optional pop internal) |