From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: floyd@barrow.com (Floyd L. Davidson) Newsgroups: gmane.emacs.help Subject: Re: different color for root Date: Thu, 04 Mar 2004 09:35:16 -0900 Organization: __________ Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <8765dkv4t7.fld@barrow.com> References: <87smgo3j85.fsf@rechner1.ddorf.de> <404752B1.70609@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1078709975 5115 80.91.224.253 (8 Mar 2004 01:39:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Mar 2004 01:39:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 08 02:39:29 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B09jt-0007Wf-00 for ; Mon, 08 Mar 2004 02:39:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B09gD-0005C3-IN for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Mar 2004 20:35:41 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!HSNX.atgi.net!falcon.america.net!eagle.america.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0 Cancel-Lock: sha1:s3t5Wbgcsd/5crxFunju6tBqdeM= Original-Lines: 51 Original-NNTP-Posting-Host: 209.124.156.192 Original-X-Trace: eagle.america.net 1078425370 209.124.156.192 (Thu, 04 Mar 2004 13:36:10 EST) Original-NNTP-Posting-Date: Thu, 04 Mar 2004 13:36:10 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:121471 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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 Xref: main.gmane.org gmane.emacs.help:17454 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17454 Kevin Rodgers wrote: >Fabian Braennstroem wrote: > > I have two different '.emacs' for me and 'root'; mainly just a change in the > > background-color. But starting Emacs for root under xfree does have the same > > color as starting it for me (user). Even uncommenting 'ecb' for root does not > > have any affect, it still loads. > > What do I do wrong? > >How are you "starting Emacs for root under xfree"? I will guess that >you're logged in as yourself, running a shell in an xterm, and then use >su to become root before starting emacs. In that case, root is the >effective user but you are still the real user. I think you can solve >your problem by using `su -` so that root is the real user, or by >starting Emacs as `emacs -u root` to load it's .emacs file. That might cause other problems, in particular the manner in which one su's to root has a lot of side effects. I would make the /root/.emacs file a symlink to the user's ~/.emacs file. That will cause both that user and root to always read the same init file, whether root is root because of a real login, sudo, or su. (That makes sense on a home machine. On a larger system with multiple system admins, don't do that. Instead, install the most *obnoxious* set of interactive defaults possible for emacs and everything else, to absolutely discourage any system admin from directly logging in as root as opposed to using su.) Put something like this into ~/.emacs, with appropriate changes of foreground or background colors. (if (eq (user-uid) 0) (progn (set-face-background 'default "black") (set-face-foreground 'default "green")) (progn (set-face-background 'default "black") (set-face-foreground 'default "goldenrod2"))) Root will be green on black, the regular user will be goldenrod2 on black. (I use a black background and normally a goldenrod2 foreground, so switching to green seemed a reasonable way to test this.) That also means various font-lock-face colors have to be chosen to work well with both possible combinations of foreground and background. -- Floyd L. Davidson Ukpeagvik (Barrow, Alaska) floyd@barrow.com