help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: different color for root


From: Floyd L. Davidson
Subject: Re: different color for root
Date: Thu, 04 Mar 2004 09:35:16 -0900
User-agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0

Kevin Rodgers <ihs_4664@yahoo.com> 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           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]