aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2015-02-08 00:36:30 -0300
committerFabián Ezequiel Gallina2015-02-08 00:36:30 -0300
commit67dfbd60573f6df8f0b096e5e2ec7f54fdff94bf (patch)
tree42ebd4413f321793e2f7bf425c656a836fbf3257 /lisp/progmodes/python.el
parent52df70a887ae8b187decb6c92cad32cf11f4c788 (diff)
downloademacs-67dfbd60573f6df8f0b096e5e2ec7f54fdff94bf.tar.gz
emacs-67dfbd60573f6df8f0b096e5e2ec7f54fdff94bf.zip
python.el: Fix shell font-lock multiline input.
Fixes: debbugs:19744 * lisp/progmodes/python.el (python-shell-font-lock-post-command-hook): Handle multiline input.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 897af2c236c..c87b1f347a3 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2359,13 +2359,15 @@ goes wrong and syntax highlighting in the shell gets messed up."
2359 (let ((input (buffer-substring-no-properties 2359 (let ((input (buffer-substring-no-properties
2360 (cdr (python-util-comint-last-prompt)) (point-max))) 2360 (cdr (python-util-comint-last-prompt)) (point-max)))
2361 (pos (point)) 2361 (pos (point))
2362 (buffer-undo-list t)) 2362 (buffer-undo-list t)
2363 (font-lock-buffer-pos nil))
2363 ;; Keep all markers untouched, this prevents `hippie-expand' and 2364 ;; Keep all markers untouched, this prevents `hippie-expand' and
2364 ;; others from getting confused. Bug#19650. 2365 ;; others from getting confused. Bug#19650.
2365 (insert-before-markers 2366 (insert-before-markers
2366 (python-shell-font-lock-with-font-lock-buffer 2367 (python-shell-font-lock-with-font-lock-buffer
2367 (delete-region (line-beginning-position) 2368 (delete-region (line-beginning-position)
2368 (line-end-position)) 2369 (point-max))
2370 (setq font-lock-buffer-pos (point))
2369 (insert input) 2371 (insert input)
2370 ;; Ensure buffer is fontified, keeping it 2372 ;; Ensure buffer is fontified, keeping it
2371 ;; compatible with Emacs < 24.4. 2373 ;; compatible with Emacs < 24.4.
@@ -2376,8 +2378,8 @@ goes wrong and syntax highlighting in the shell gets messed up."
2376 ;; they are not overwritten by comint buffer's font lock. 2378 ;; they are not overwritten by comint buffer's font lock.
2377 (python-util-text-properties-replace-name 2379 (python-util-text-properties-replace-name
2378 'face 'font-lock-face) 2380 'face 'font-lock-face)
2379 (buffer-substring (line-beginning-position) 2381 (buffer-substring font-lock-buffer-pos
2380 (line-end-position)))) 2382 (point-max))))
2381 ;; Remove non-fontified original text. 2383 ;; Remove non-fontified original text.
2382 (delete-region pos (cdr (python-util-comint-last-prompt))) 2384 (delete-region pos (cdr (python-util-comint-last-prompt)))
2383 ;; Point should be already at pos, this is for extra safety. 2385 ;; Point should be already at pos, this is for extra safety.