]> git.eshelyaron.com Git - emacs.git/commitdiff
* progmodes/python.el (inferior-python-mode): Fix hang in
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Sat, 3 Nov 2012 12:20:02 +0000 (09:20 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Sat, 3 Nov 2012 12:20:02 +0000 (09:20 -0300)
jit-lock.

Fixes: debbugs:12645
lisp/ChangeLog
lisp/progmodes/python.el

index 1b560651abbd961b4d57dc456dab646340a42453..4844872c73a25649d6ab2ddb930be32992043509 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-03  Fabián Ezequiel Gallina  <fgallina@cuca>
+
+       * progmodes/python.el (inferior-python-mode): Fix hang in
+       jit-lock (Bug#12645).
+
 2012-11-03  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (switch-to-visible-buffer)
index ff805d640240debaf58d467fd0e2a9285f1230e6..ee98feaef5e0626ca613f3e2f0870c01dcf2e1f5 100644 (file)
@@ -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)