diff options
author | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2015-02-08 00:36:30 -0300 |
---|---|---|
committer | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2015-02-08 00:36:30 -0300 |
commit | 67dfbd60573f6df8f0b096e5e2ec7f54fdff94bf (patch) | |
tree | 42ebd4413f321793e2f7bf425c656a836fbf3257 /lisp | |
parent | 52df70a887ae8b187decb6c92cad32cf11f4c788 (diff) | |
download | emacs-67dfbd60573f6df8f0b096e5e2ec7f54fdff94bf.tar.gz |
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')
-rw-r--r-- | lisp/ChangeLog | 8 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3b0bdd51885..f14a9848521 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 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) * progmodes/python.el (python-shell-font-lock-cleanup-buffer): Use 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." (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. |