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

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

Re: GNU emacs locks files modified with CVS


From: Maurizio Loreti
Subject: Re: GNU emacs locks files modified with CVS
Date: 17 Dec 2003 07:42:36 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Pepijn Kenter <address@hidden> writes:

> address@hidden wrote:
> > There's two ways which will keep/set the DISPLAY variable:
> > First, if the DISPLAY variable is set in user1 and you do "su
> > user2", then the environment of user1 will carry into user2.  IOW,
> > you're good. Second, if you, instead, do "su - user2", then you will
> > have a fresh environment, that of user2.  If user2's environment
> > doesn't have the DISPLAY variable set properly, you can do this by
> > setting this in user2's ~/.bashrc file... if user2's default shell
> > is bash-- if you're using some other shell, consult the manpage for
> > the proper file and command syntax for setting the environment.
> >
> Thanks for your reply but the .bashrc seems to me the wrong place to
> set the DISPLAY variable.
> If you login from another machine it won't be set properly.

Correct.  The right place is .bash_profile, executed at login.

FWIW, this is from my own .bash_profile:

,-----
| # Tries to figure out a correct DISPLAY environment variable
| 
| if [ -n "$DISPLAY" ]
| then
|   # if DISPLAY is set, we assume it is also valid; if it is not,
|   # the user may always change it later ($DISPLAY is printed at
|   # the end of the login procedure).
| 
|   REMOTE="${DISPLAY%%:*}"
| else
|   temp0=$(who am i | awk '{print $2}')
|   
|   if [ "$temp0" = "console" ]
|   then
|     REMOTE="localhost"
|     DISPLAY=":0.0"
|   else
|     temp1=$(who --lookup | grep "$temp0 " | uniq | awk '{print $6}')
|     # Note the blank-------------------^
|     if [ -n "$temp1" ]
|     then
|       temp2=$(echo $temp1 | sed -e 's/(//' -e 's/)//')
|       temp3=$(echo $temp2 | cut -d. -f2)
|       if [ "$temp3" = "pd" ]
|       then
|         # If on host.pd.infn.it, DISPLAY="host:0.0";
|         # if not, DISPLAY="host.dom.ain:0.0"
|         REMOTE=$(echo $temp2 | cut -d. -f1)
|       else
|         REMOTE="${temp2%%:*}"
|       fi
|       DISPLAY="${REMOTE}:0.0"
|       unset temp2 temp3
|     else
|       REMOTE=""
|       DISPLAY=":0.0"
|     fi
|     unset temp1
|   fi
|   unset temp0
| fi
| 
| export REMOTE DISPLAY
| echo "DISPLAY is now: $DISPLAY"
`-----

-- 
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy              ROT13: address@hidden


reply via email to

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