From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: comint fix for shell colors Date: Fri, 18 Nov 2016 12:07:46 +0200 Message-ID: <83twb5cd8t.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1479463712 3293 195.159.176.226 (18 Nov 2016 10:08:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 Nov 2016 10:08:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: Erik Selberg Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 18 11:08:23 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7g5n-0007pi-8G for ged-emacs-devel@m.gmane.org; Fri, 18 Nov 2016 11:08:23 +0100 Original-Received: from localhost ([::1]:35548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7g5q-0001tE-Mr for ged-emacs-devel@m.gmane.org; Fri, 18 Nov 2016 05:08:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7g5C-0001s6-38 for emacs-devel@gnu.org; Fri, 18 Nov 2016 05:07:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7g58-0000wY-VW for emacs-devel@gnu.org; Fri, 18 Nov 2016 05:07:46 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7g58-0000wN-Ru; Fri, 18 Nov 2016 05:07:42 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2382 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c7g58-0007sS-8u; Fri, 18 Nov 2016 05:07:42 -0500 In-reply-to: (message from Erik Selberg on Mon, 14 Nov 2016 23:14:25 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:209472 Archived-At: > From: Erik Selberg > Date: Mon, 14 Nov 2016 23:14:25 -0800 > > I've been trying to use shell (vs term / mult-term) with bash / zsh and my color prompts. In comint, > comint-highlight-prompt clobbers the colors. I made the following patch against 24.5 but I see comint has > been updated in 25. What's the right process for adding this for 25? This is solved for me locally, but seems > something that could be added for all. Please rebase the patch on the current master branch and resubmit. See also a few minor comments below. > *** /tmp/comint.el 2016-11-14 23:04:50.000000000 -0800 > --- /Users/selberg/elisp/comint.el 2016-11-14 23:06:36.000000000 -0800 > *************** > *** 104,109 **** > --- 104,110 ---- > (require 'ring) > (require 'ansi-color) > (require 'regexp-opt) ;For regexp-opt-charset. > + (require 'simple) ;For password-word-equivalents simple.el is preloaded, so there shouldn't be a need to require it. > + (defcustom comint-do-highlight-prompt t > + "Highlight prompt. Set to nil to let underlying process set colors (useful for modern shells)" The first line of the doc string should be a single complete sentence. The rest should go to the next lines. > + :type 'boolean > + :group 'comint > + :version "22.1" Please update the version tag to 26.1. > + ) Please don't put closing parentheses on a separate line. > "Snapshot the current `comint-last-prompt'. > Freezes the `font-lock-face' text property in place." > (when comint-last-prompt > + (if comint-do-highlight-prompt > (with-silent-modifications > (add-text-properties > (car comint-last-prompt) > (cdr comint-last-prompt) > ! '(font-lock-face comint-highlight-prompt)) > ! ) > ! ) Once again, please put all the closing parentheses on the last line of their sexp. > ;; Reset comint-last-prompt so later on comint-output-filter does > ;; not remove the font-lock-face text property of the previous > ;; (this) prompt. > ! (setq comint-last-prompt nil) > ! )) Same here. > (setq comint-last-prompt > (cons (copy-marker prompt-start) (point-marker))) > ! (if comint-do-highlight-prompt > ! (add-text-properties prompt-start (point) > ! '(rear-nonsticky t > ! font-lock-face comint-highlight-prompt)) > ! ) > ! ) And here. Finally, please include with the patch a ChangeLog-style commit log message for the changes, and a suitable entry for NEWS. Thanks for working on this.