]> git.eshelyaron.com Git - emacs.git/commitdiff
python.el: Fix shell font-lock multiline input.
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Sun, 8 Feb 2015 03:36:30 +0000 (00:36 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Sun, 8 Feb 2015 03:36:30 +0000 (00:36 -0300)
Fixes: debbugs:19744
* lisp/progmodes/python.el
(python-shell-font-lock-post-command-hook): Handle multiline
input.

lisp/ChangeLog
lisp/progmodes/python.el

index 3b0bdd5188599b819fa529495b57845bd7a95d8d..f14a98485218446e050118e1628599d3db6dabac 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-08  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       python.el: Fix shell font-lock multiline input.  (Bug#19744)
+
+       * progmodes/python.el
+       (python-shell-font-lock-post-command-hook): Handle multiline
+       input.
+
 2015-02-08  Fabián Ezequiel Gallina  <fgallina@gnu.org>
 
        python.el: Make shell font-lock respect markers.  (Bug#19650)
index 897af2c236c594420250967546566a8efd54087f..c87b1f347a31139cf3f07ba9b6892cee0551fc9c 100644 (file)
@@ -2359,13 +2359,15 @@ goes wrong and syntax highlighting in the shell gets messed up."
     (let ((input (buffer-substring-no-properties
                   (cdr (python-util-comint-last-prompt)) (point-max)))
           (pos (point))
-          (buffer-undo-list t))
+          (buffer-undo-list t)
+          (font-lock-buffer-pos nil))
       ;; Keep all markers untouched, this prevents `hippie-expand' and
       ;; others from getting confused.  Bug#19650.
       (insert-before-markers
        (python-shell-font-lock-with-font-lock-buffer
         (delete-region (line-beginning-position)
-                        (line-end-position))
+                        (point-max))
+         (setq font-lock-buffer-pos (point))
          (insert input)
         ;; Ensure buffer is fontified, keeping it
         ;; compatible with Emacs < 24.4.
@@ -2376,8 +2378,8 @@ goes wrong and syntax highlighting in the shell gets messed up."
         ;; they are not overwritten by comint buffer's font lock.
         (python-util-text-properties-replace-name
          'face 'font-lock-face)
-        (buffer-substring (line-beginning-position)
-                           (line-end-position))))
+        (buffer-substring font-lock-buffer-pos
+                           (point-max))))
       ;; Remove non-fontified original text.
       (delete-region pos (cdr (python-util-comint-last-prompt)))
       ;; Point should be already at pos, this is for extra safety.