From: Wolfgang Jenkner <wjenkner@inode.at>
To: Glenn Morris <rgm@gnu.org>
Cc: 20084@debbugs.gnu.org, Charles Tam <me@charlest.net>
Subject: bug#20084: comint-highlight-prompt overrides ANSI colors in 24.4
Date: Thu, 12 Mar 2015 03:00:13 +0100 [thread overview]
Message-ID: <85k2ynexw9.fsf@iznogoud.viz> (raw)
In-Reply-To: <CAKu+9YUBrsz2sQG8Bq+N2oXBw6gRAKT3ZraoKV1HKNiYX5q0xA@mail.gmail.com>
On Wed, Mar 11 2015, Glenn Morris wrote:
> Perhaps related to http://debbugs.gnu.org/14744, which I see was applied
> 2013-08-08, without any comment being made to the associated bug report, sigh.
Another symptom of the same bug introduced there is that copious
colourful output, as produced by, say, `ls /usr/bin', will have "white
spots".
I've been using something like the following patch for some time:
-- >8 --
Subject: [PATCH] Preserve face text properties in comint prompt.
* lisp/comint.el (comint-snapshot-last-prompt): Use
font-lock-prepend-text-property for comint-highlight-prompt.
(comint-output-filter): Remove only comint-highlight-prompt.
Thus, the original face text property of a prompt "candidate" (the
last line of an output chunk not ending with a newline) is
preserved. This amends the fixing of bug#14744. (Bug#20084)
---
lisp/comint.el | 38 ++++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index b52d7fd..65b9c3c 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1926,10 +1926,10 @@ the start, the cdr to the end of the last prompt recognized.")
Freezes the `font-lock-face' text property in place."
(when comint-last-prompt
(with-silent-modifications
- (add-text-properties
+ (font-lock-prepend-text-property
(car comint-last-prompt)
(cdr comint-last-prompt)
- '(font-lock-face comint-highlight-prompt)))
+ 'font-lock-face 'comint-highlight-prompt))
;; Reset comint-last-prompt so later on comint-output-filter does
;; not remove the font-lock-face text property of the previous
;; (this) prompt.
@@ -2081,14 +2081,36 @@ Make backspaces delete the previous character."
(add-text-properties prompt-start (point)
'(read-only t front-sticky (read-only)))))
(when comint-last-prompt
- (remove-text-properties (car comint-last-prompt)
- (cdr comint-last-prompt)
- '(font-lock-face)))
+ (let ((start (car comint-last-prompt))
+ (limit (cdr comint-last-prompt))
+ face end)
+ (with-silent-modifications
+ (while
+ (progn
+ (setq end
+ (next-single-property-change start
+ 'font-lock-face
+ nil
+ limit))
+ (setq face (get-text-property start 'font-lock-face))
+ (put-text-property
+ start end 'font-lock-face
+ (if (and (consp face)
+ (not (or
+ (eq (car face) 'foreground-color)
+ (eq (car face) 'background-color)
+ (keywordp (car face)))))
+ (remove 'comint-highlight-prompt face)
+ (unless (eq face 'comint-highlight-prompt)
+ face)))
+ (< (setq start end) limit))))))
(setq comint-last-prompt
(cons (copy-marker prompt-start) (point-marker)))
- (add-text-properties prompt-start (point)
- '(rear-nonsticky t
- font-lock-face comint-highlight-prompt)))
+ (with-silent-modifications
+ (font-lock-prepend-text-property prompt-start (point)
+ 'font-lock-face
+ 'comint-highlight-prompt)
+ (add-text-properties prompt-start (point) '(rear-nonsticky t))))
(goto-char saved-point)))))))
(defun comint-preinput-scroll-to-bottom ()
--
2.3.0
next prev parent reply other threads:[~2015-03-12 2:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 16:01 bug#20084: comint-highlight-prompt overrides ANSI colors in 24.4 Charles Tam
2015-03-11 19:00 ` Glenn Morris
2015-03-12 2:00 ` Wolfgang Jenkner [this message]
2015-03-20 2:22 ` Wolfgang Jenkner
2015-03-20 14:24 ` Stefan Monnier
2015-03-22 16:29 ` Wolfgang Jenkner
2015-03-22 16:36 ` Wolfgang Jenkner
2015-03-23 2:10 ` Stefan Monnier
2015-03-23 19:06 ` Wolfgang Jenkner
2015-03-23 20:50 ` Stefan Monnier
2015-03-20 2:31 ` Wolfgang Jenkner
2015-03-25 0:53 ` Glenn Morris
2015-03-27 3:27 ` Wolfgang Jenkner
2015-03-30 15:54 ` Wolfgang Jenkner
2015-03-31 15:01 ` Wolfgang Jenkner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85k2ynexw9.fsf@iznogoud.viz \
--to=wjenkner@inode.at \
--cc=20084@debbugs.gnu.org \
--cc=me@charlest.net \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.