GNU bug report logs -
#32344
Add option to keep colorization in comint, use it in python.el
Previous Next
Reported by: Carlos Pita <carlosjosepita <at> gmail.com>
Date: Thu, 2 Aug 2018 00:15:02 UTC
Severity: minor
Tags: fixed, patch
Found in version 26.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #61 received at 32344 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Could you post the patch here instead? It's nice to have the proposed
> patches in the bug tracker.
(Included below.)
> Anyway, while Juri's suggestion makes sense (merging faces) in general,
> I think the mechanism here (making comint not do any face mangling for
> the modes that do it themselves) is cleaner. So I think Carlos' patch
> should be applied to Emacs.
Which I'm doing now.
[pita.patch (text/x-diff, inline)]
From 27acd97dfec7ecd9667a032e3a94650cb01244c1 Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita <at> gmail.com>
Date: Sun, 13 Oct 2019 18:42:37 -0300
Subject: [PATCH] Keep python colorization in comint (Bug#32344)
* lisp/comint.el (comint-highlight-input, comint-send-input): add
option to let major modes that colorize their input stop comint from
overriding that specialized colorization.
* lisp/progmodes/python.el (inferior-python-mode): Use the new comint
`comint-highlight-input' customization option in order to keep
colorization done by python.el.
---
lisp/comint.el | 13 ++++++++++---
lisp/progmodes/python.el | 1 +
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index 4bb43670354..b8f5205d9e5 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -223,6 +223,12 @@ This variable is buffer-local."
(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 @@ Similarly for Soar, Scheme, etc."
(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
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b168b62c291..8f823532802 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2796,6 +2796,7 @@ variable.
python-pdbtrack-comint-output-filter-function
python-comint-postoutput-scroll-to-bottom
comint-watch-for-password-prompt))
+ (set (make-local-variable 'comint-highlight-input) nil)
(set (make-local-variable 'compilation-error-regexp-alist)
python-shell-compilation-regexp-alist)
(add-hook 'completion-at-point-functions
[Message part 3 (text/plain, inline)]
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 275 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.