aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-10-13 18:44:35 +0200
committerLars Ingebrigtsen2021-10-13 19:00:31 +0200
commitab34293d849086a67effc52800e18bab1400ce72 (patch)
tree96cd11f83ebb2d91c5c7e3f8b5b0ed74f2b2e8cd /lisp/progmodes/python.el
parente494a2d00a4948a54cb6c9f403956db4526d4348 (diff)
downloademacs-ab34293d849086a67effc52800e18bab1400ce72.tar.gz
emacs-ab34293d849086a67effc52800e18bab1400ce72.zip
Fix problem with multiline fontification in interactive Python
* lisp/progmodes/python.el (python-shell-font-lock-post-command-hook): When doing multi-line (`C-c SPC') inputs, remove all the preceding lines when doing fontification (bug#47657).
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el8
1 files changed, 2 insertions, 6 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 75aae23051a..5819f59315b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2724,16 +2724,12 @@ goes wrong and syntax highlighting in the shell gets messed up."
2724 (deactivate-mark nil) 2724 (deactivate-mark nil)
2725 (start-pos prompt-end) 2725 (start-pos prompt-end)
2726 (buffer-undo-list t) 2726 (buffer-undo-list t)
2727 (font-lock-buffer-pos nil)
2728 (replacement 2727 (replacement
2729 (python-shell-font-lock-with-font-lock-buffer 2728 (python-shell-font-lock-with-font-lock-buffer
2730 (delete-region (line-beginning-position) 2729 (delete-region (point-min) (point-max))
2731 (point-max))
2732 (setq font-lock-buffer-pos (point))
2733 (insert input) 2730 (insert input)
2734 (font-lock-ensure) 2731 (font-lock-ensure)
2735 (buffer-substring font-lock-buffer-pos 2732 (buffer-string)))
2736 (point-max))))
2737 (replacement-length (length replacement)) 2733 (replacement-length (length replacement))
2738 (i 0)) 2734 (i 0))
2739 ;; Inject text properties to get input fontified. 2735 ;; Inject text properties to get input fontified.