From: Fabián Ezequiel Gallina Date: Sat, 3 Nov 2012 12:20:02 +0000 (-0300) Subject: * progmodes/python.el (inferior-python-mode): Fix hang in X-Git-Tag: emacs-24.2.90~180 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=12fd5ee1ae617b212e4d00e2ed4c196d3656f615;p=emacs.git * progmodes/python.el (inferior-python-mode): Fix hang in jit-lock. Fixes: debbugs:12645 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b560651abb..4844872c73a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-11-03 Fabián Ezequiel Gallina + + * progmodes/python.el (inferior-python-mode): Fix hang in + jit-lock (Bug#12645). + 2012-11-03 Martin Rudalics * window.el (switch-to-visible-buffer) 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. (set (make-local-variable 'font-lock-defaults) '(python-font-lock-keywords nil nil nil nil)) (set (make-local-variable 'syntax-propertize-function) - (syntax-propertize-rules - (comint-prompt-regexp - (0 (ignore - (put-text-property - comint-last-input-start end 'syntax-table - python-shell-output-syntax-table) - (font-lock-unfontify-region comint-last-input-start end)))) - ((python-rx string-delimiter) - (0 (ignore - (and (not (eq (get-text-property start 'field) 'output)) - (python-syntax-stringify)))))))) + (eval + ;; XXX: Unfortunately eval is needed here to make use of the + ;; dynamic value of `comint-prompt-regexp'. + `(syntax-propertize-rules + (,comint-prompt-regexp + (0 (ignore + (put-text-property + comint-last-input-start end 'syntax-table + python-shell-output-syntax-table) + ;; XXX: This might look weird, but it is the easiest + ;; way to ensure font lock gets cleaned up before the + ;; current prompt, which is needed for unclosed + ;; strings to not mess up with current input. + (font-lock-unfontify-region comint-last-input-start end)))) + (,(python-rx string-delimiter) + (0 (ignore + (and (not (eq (get-text-property start 'field) 'output)) + (python-syntax-stringify))))))))) (compilation-shell-minor-mode 1)) (defun python-shell-make-comint (cmd proc-name &optional pop internal)