From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Igrishin Newsgroups: gmane.emacs.help Subject: Re: Commands like ls(1) does not emits color sequences in 25.0.50.1 Date: Tue, 8 Sep 2015 11:18:49 +0300 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1441700403 16277 80.91.229.3 (8 Sep 2015 08:20:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Sep 2015 08:20:03 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Random832 Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 08 10:19:58 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZZE87-00055U-Bg for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 10:19:51 +0200 Original-Received: from localhost ([::1]:60683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZE87-00038t-5W for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 04:19:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZE7v-00038b-8M for help-gnu-emacs@gnu.org; Tue, 08 Sep 2015 04:19:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZE7q-0001zu-Ux for help-gnu-emacs@gnu.org; Tue, 08 Sep 2015 04:19:39 -0400 Original-Received: from mail-io0-f173.google.com ([209.85.223.173]:35191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZE7q-0001zm-PH for help-gnu-emacs@gnu.org; Tue, 08 Sep 2015 04:19:34 -0400 Original-Received: by ioiz6 with SMTP id z6so109231349ioi.2 for ; Tue, 08 Sep 2015 01:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SG7d3NwJMYWSfPENw9hpnPVgbEFhr6S+vJrH/MN4MKE=; b=JFG03hknHqpQvVsz4X8tbX8eyg+8nMjm9utwc5YdEKOo674qpecp+NZRISSBoo/GBq NU1QeRLlx6mKlQ+jSYwbtxM+Uz0oc/y5guMTM0pC6BMl9q9DcCkqDgT5Eta42uGX2A4F sIBm4Q3/bvqsB3syVqNllXacbBE52tEQFa9Y9KoKcmEaVkKgD7aQW4HPbJksCQQJjSso OPHs4oJDzIeFS/QA3sOXXh7bAEjcCbJCsIpCY/ALFY2lFbQbZg6rKRvfzCPbtU2Li9yA kh++at261f+j/mn1BSHls/orTw2uZZDawBOgY27K7WjtyGaPMGmYyDSvcw34Ubobzkle Zbjg== X-Received: by 10.107.14.73 with SMTP id 70mr40386134ioo.11.1441700329156; Tue, 08 Sep 2015 01:18:49 -0700 (PDT) Original-Received: by 10.79.72.131 with HTTP; Tue, 8 Sep 2015 01:18:49 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.223.173 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107078 Archived-At: 2015-09-08 0:58 GMT+03:00 Random832 : > Dmitry Igrishin writes: > > > To workaround this problem I've tried to add > > (setenv "TERM" "ansi") to the init.el, but Emacs resets the TERM > > variable to "dumb" upon the startup. Is this expected? > > Yes, it is expected. You can see where it does this in the comint-exec-1 > function. You can test for the EMACS environment variable in your shell > (it will be set to "t" if running within emacs) and reset the TERM in > your e.g. bashrc file. > if [ "$TERM" = dumb ] && [ "$EMACS" = t ]; then > TERM=dumb-emacs-ansi > fi > I see. But in Emacs 25.0.50.1 the $EMACS variable is not intialized, when running shell, but the INSIDE_EMACS is: $ env | grep EMACS INSIDE_EMACS=25.0.50.1,comint Also I've noticed that exporting COLORTERM with value "dumb" forces ls(1) to emit color sequences in my case. So, I've added the following line to .bashrc: (echo -n $INSIDE_EMACS | grep comint) > /dev/null && export COLORTERM=dumb Shrug... > I would tend to use a handcrafted terminfo entry (provided below) that > has only the color codes (and bold, italic, underline), and nothing > else, so that full-screen apps don't think they will work. Many > applications (top and vim both do on my machine) will assume they can > anyway, though. > > dumb-emacs-ansi|Emacs dumb terminal with ANSI color codes, > am, > colors#8, it#8, ncv#13, pairs#64, > bold=\E[1m, cud1=^J, ht=^I, ind=^J, op=\E[39;49m, > ritm=\E[23m, rmul=\E[24m, setab=\E[4%p1%dm, > setaf=\E[3%p1%dm, sgr0=\E[m, sitm=\E[3m, smul=\E[4m, > > Note: 'ncv' is set to disallow reverse, blink, and standout, since these > are mapped by default to faces that set the foreground color (C-h v > ansi-color-faces-vector), but also does not provide codes to use them in > the first place - only color, bold, italic, and underline are provided. > > I couldn't find any way to actually indicate the behavior that emacs has > when given a backspace or carriage return (it actually deletes > characters, rather than moving backwards to overtype them), so I omitted > these codes. So, in that sense, this entry is even dumber than dumb. > Thank you! These solution can be useful indeed! -- // Dmitry.