From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alexandre Oberlin Newsgroups: gmane.emacs.help Subject: Re: Different background color for different windows/modes Date: Sun, 23 Jul 2017 06:53:33 -0700 (PDT) Message-ID: <609841d6-4b1f-4aab-9bf6-5b3dc0cc4112@googlegroups.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1500818131 9586 195.159.176.226 (23 Jul 2017 13:55:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Jul 2017 13:55:31 +0000 (UTC) Injection-Date: Sun, 23 Jul 2017 13:53:33 +0000 User-Agent: G2/1.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 23 15:55:28 2017 Return-path: Envelope-to: geh-help-gnu-emacs@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 1dZHLz-0002Gp-K5 for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 15:55:27 +0200 Original-Received: from localhost ([::1]:50557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZHM5-0007Ms-Cv for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 09:55:33 -0400 X-Received: by 10.36.79.88 with SMTP id c85mr3238513itb.34.1500818013716; Sun, 23 Jul 2017 06:53:33 -0700 (PDT) X-Received: by 10.31.231.69 with SMTP id e66mr36262vkh.20.1500818013619; Sun, 23 Jul 2017 06:53:33 -0700 (PDT) Original-Path: usenet.stanford.edu!t6no510913itb.0!news-out.google.com!c30ni314qta.0!nntp.google.com!l55no1226166qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Original-Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=37.161.2.244; posting-account=IWjTFQoAAAAFS3md63aQJ_ttNKJFTj1L Original-NNTP-Posting-Host: 37.161.2.244 Original-Xref: usenet.stanford.edu gnu.emacs.help:219152 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:113842 Archived-At: Hello, Someone gave me a hint to do this in Emacs 24.4+ but I don't find the message on gnu.emacs.help (Is this NG dying?). The trick is to uses defface and face-remap-add-relative. It works very well, including in GNU Emacs 24.5.1 (x86_64-unknown-cygwin) under Cygwin without X. To modify the font and colors of your shell windows for instance, just add/load the code below from your .emacs and add more attributes and more modes (text, lisp, etc.) as desired. The commented out entries are not necessary but may come handy when tweaking your config. Important: this code should be loaded before you visit/find any concerned file or launch a shell from .emacs. ;;;;;;;;;;;;;;;;;;;;;;;; BEGIN .emacs CODE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (face-spec-reset-face 'myshellface) (defface myshellface '((t :foreground "black" :background "aquamarine" :weight semi-bold :underline nil )) "Face for shells." :group 'myfaces ) ;; (face-spec-set ;; 'myshellface ;; '((t :foreground "black" ;; :background "aquamarine" ;; :weight semi-bold ;; :underline nil ;; )) ;; 'face-defface-spec ;; ) ;; (facep 'myshellface) ;; (boundp 'myshellface) ;; (remove-hook 'shell-mode-hook ;; (lambda () ;; (face-remap-add-relative 'default 'myshellface))) (setq shell-mode-hook nil) (add-hook 'shell-mode-hook (lambda () (face-remap-add-relative 'default 'myshellface))) ;;;;;;;;;;;;;;;;;;;;;;;; END .emacs CODE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Cheers,