Subject: bug#32344:

From: Carlos Pita <[email-masked]>
Date: Sun, 13 Oct 2019 14:18:01 -0300

Hi Jorg,

I somehow totally missed your answer. Of course I'm glad to provide a
proper patch (and get rid of those awful advices in my init.el ;) ).
Indeed I was searching through my old reports at debbugs mainly in
order to push this one ahead, so it's nice to see you interested
(although a bit late from my side...).

I'm attaching a patch adding a new customization option to suppress
highlighting. As soon as you apply it I will be submitting the
corresponding PR to elpy in order to have full python highlighting all
along the line. The patch is against emacs 27, please let me know if
you have any problem applying it on top 26.

Best regards
--
Carlos
From 1f2392f09b9c0193e79382512a8a30388ce54bf8 Mon Sep 17 00:00:00 2001
From: memeplex <[email-masked]>
Date: Sun, 13 Oct 2019 13:57:11 -0300
Subject: [PATCH] Option for comint to honour original input highlighting

* comint.el (comint-send-input): add option to let major modes that
colorize their input (for example, python-mode) stop comint from
overriding that specialized colorization.
---
 lisp/comint.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index 4bb4367..b8f5205 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -223,6 +223,12 @@ comint-input-autoexpand
 		 (other :tag "on" t))
   :group 'comint)
 
+(defcustom comint-highlight-input t
+  "If non-nil, highlight input with `comint-highlight-input' face.
+Otherwise keep the original highlighting untouched."
+  :type 'boolean
+  :group 'comint)
+
 (defface comint-highlight-input '((t (:weight bold)))
   "Face to use to highlight user input."
   :group 'comint)
@@ -1881,9 +1887,10 @@ comint-send-input
               (end (if no-newline (point) (1- (point)))))
           (with-silent-modifications
             (when (> end beg)
-              (add-text-properties beg end
-                                   '(front-sticky t
-                                     font-lock-face comint-highlight-input))
+              (when comint-highlight-input
+               (add-text-properties beg end
+                                    '(front-sticky t
+                                      font-lock-face comint-highlight-input)))
               (unless comint-use-prompt-regexp
                 ;; Give old user input a field property of `input', to
                 ;; distinguish it from both process output and unsent
-- 
2.20.1