From ff40570650c060b91c3939c80b5172ac4b01be82 Mon Sep 17 00:00:00 2001 From: memeplex Date: Thu, 22 Jan 2015 17:18:34 -0300 Subject: [PATCH] python.el: fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19650 --- .emacs.d/lisp/python.el | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/.emacs.d/lisp/python.el b/.emacs.d/lisp/python.el index d340550..2963706 100644 --- a/.emacs.d/lisp/python.el +++ b/.emacs.d/lisp/python.el @@ -2364,24 +2364,31 @@ goes wrong and syntax highlighting in the shell gets messed up." (buffer-undo-list t)) ;; When input hasn't changed, do nothing. (when (not (string= input old-input)) - (delete-region (cdr (python-util-comint-last-prompt)) (point-max)) - (insert - (python-shell-font-lock-with-font-lock-buffer - (delete-region (line-beginning-position) - (line-end-position)) - (insert input) - ;; Ensure buffer is fontified, keeping it - ;; compatible with Emacs < 24.4. - (if (fboundp 'font-lock-ensure) - (funcall 'font-lock-ensure) - (font-lock-default-fontify-buffer)) - ;; Replace FACE text properties with FONT-LOCK-FACE so - ;; 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)))) - (goto-char current-point)))))) + (let ((beg) (end)) + (when (featurep 'hippie-exp) + (setq beg (marker-position he-string-beg) + end (marker-position he-string-end))) + (delete-region (cdr (python-util-comint-last-prompt)) (point-max)) + (insert + (python-shell-font-lock-with-font-lock-buffer + (delete-region (line-beginning-position) + (line-end-position)) + (insert input) + ;; Ensure buffer is fontified, keeping it + ;; compatible with Emacs < 24.4. + (if (fboundp 'font-lock-ensure) + (funcall 'font-lock-ensure) + (font-lock-default-fontify-buffer)) + ;; Replace FACE text properties with FONT-LOCK-FACE so + ;; 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)))) + (when (featurep 'hippie-exp) + (set-marker he-string-beg beg) + (set-marker he-string-end end)) + (goto-char current-point))))))) (defun python-shell-font-lock-turn-on (&optional msg) "Turn on shell font-lock. -- 2.2.1