From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul R Newsgroups: gmane.emacs.help Subject: Re: Emacs Shell Ansi Colors Date: Mon, 29 Sep 2008 15:40:09 +0200 Message-ID: <8763of9ikm.fsf@gmail.com> References: <48DFDAB9.5020506@gmail.com> <87prmo3r45.fsf@tux.homenetwork> <87abdr9l3v.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222695744 11799 80.91.229.12 (29 Sep 2008 13:42:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2008 13:42:24 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Thierry Volpiatto To: "Lorenzo Isella" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 29 15:43:22 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KkJ1f-0006ER-85 for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2008 15:42:59 +0200 Original-Received: from localhost ([127.0.0.1]:34143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkJ0c-0006gx-Cf for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2008 09:41:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkIz7-00061R-7z for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:40:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkIz4-00060E-N5 for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:40:20 -0400 Original-Received: from [199.232.76.173] (port=55809 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkIz4-0005zd-E2 for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:40:18 -0400 Original-Received: from mu-out-0910.google.com ([209.85.134.188]:15606) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KkIz4-0002tw-5F for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:40:18 -0400 Original-Received: by mu-out-0910.google.com with SMTP id i2so1781770mue.6 for ; Mon, 29 Sep 2008 06:40:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:references:from :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=k09WivBRdm5aK6ffX5aaGPQ/+3WkXmiDmhEnaHNpPck=; b=T1QVhHPyqn/IkaLs+vxjyr1mRE8ZqiI6MDQu6j0qbZBRwItq+80hzS8onKrvwgXgto E8awvxM3NSHk437Sm8g1y5by4hW0RVVVmO3F6FonVxyy/s7alecVYQeMGTYkO24Mw3EL A86hToJWntBlLUKl7mHC6nkwK4RIlxgjoMceY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:cc:subject:references:from:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=yEzrr4BXRpC+rTaM7TFQJnPY5WCdnMOhPxfvQU2NSPja+Y+Q4KgwZZhtatNlO5eWVT 2RSswd0g+GYiStgz+QiimjeXZ/Fbt3XrO4Zn5lS/QIe1l14pz1nEP7GtRh0XI2OJ9J77 KxoWH3TuPPPxzJgaf5lnSx5+jQ9aYKkmkpfW0= Original-Received: by 10.180.227.2 with SMTP id z2mr2308433bkg.12.1222695616679; Mon, 29 Sep 2008 06:40:16 -0700 (PDT) Original-Received: from ubuT42 (pdc35-1-82-242-132-111.fbx.proxad.net [82.242.132.111]) by mx.google.com with ESMTPS id z15sm183694fkz.16.2008.09.29.06.40.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 29 Sep 2008 06:40:15 -0700 (PDT) In-Reply-To: (Lorenzo Isella's message of "Mon\, 29 Sep 2008 15\:02\:57 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58183 Archived-At: On Mon, 29 Sep 2008 15:02:57 +0200, "Lorenzo Isella" said: Lorenzo> ~$ env | grep TERM TERM=xterm COLORTERM=gnome-terminal I guess this is the output of the command run from within gnome-terminal, not from emacs shell mode :) Run it from shell mode you should read that the term is dumb. Lorenzo> [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias Lorenzo> ls='ls --color=auto' #alias Here we go. Emacs comint shell is dumb so the alias won't happen. Lorenzo> please, do not laugh, but I am a bit at a loss about the way Lorenzo> I should put this into my .emacs file. The part dealing with Lorenzo> the shell is now: I don't use M-x shell at all so I have hard time helping you more. Reading shell.el code yield : ,---- see lines starting with !!! | (interactive | (list | (and current-prefix-arg | (read-buffer "Shell buffer: " | (generate-new-buffer-name "*shell*"))))) | (setq buffer (get-buffer-create (or buffer "*shell*"))) | ;; Pop to buffer, so that the buffer's window will be correctly set | ;; when we call comint (so that comint sets the COLUMNS env var properly). | (pop-to-buffer buffer) | (unless (comint-check-proc buffer) | (let* ((prog (or explicit-shell-file-name | (getenv "ESHELL") shell-file-name)) | (name (file-name-nondirectory prog)) |!!!!! NOTICE BELOW | (startfile (concat "~/.emacs_" name)) | (xargs-name (intern-soft (concat "explicit-" name "-args")))) | (unless (file-exists-p startfile) | (setq startfile (concat "~/.emacs.d/init_" name ".sh"))) | (apply 'make-comint-in-buffer "shell" buffer prog | (if (file-exists-p startfile) startfile) | (if (and xargs-name (boundp xargs-name)) | (symbol-value xargs-name) | '("-i"))) | (shell-mode))) | buffer) `---- So what we read here is that shell will try to evaluate (with your shell) the file ~/.emacs_bash or ~/.emacs.d/init_bash.sh So just drop in either file alias ls='ls --color' followed by a blank line (thx comint) and it should work automagically. By the way, have you tried eshell ? In most cases, it just works. -- Paul