From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gebser@speakeasy.net Newsgroups: gmane.emacs.help Subject: Re: GNU emacs locks files modified with CVS Date: Wed, 17 Dec 2003 10:34:16 -0500 (EST) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: Reply-To: gebser@speakeasy.net NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1071675484 26553 80.91.224.253 (17 Dec 2003 15:38:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2003 15:38:04 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 16:38:00 2003 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 1AWdkO-0000Fg-00 for ; Wed, 17 Dec 2003 16:38:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AWefo-0006LF-GN for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2003 11:37:20 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AWefE-00061q-Nn for help-gnu-emacs@gnu.org; Wed, 17 Dec 2003 11:36:45 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AWeeL-00040u-7s for help-gnu-emacs@gnu.org; Wed, 17 Dec 2003 11:36:21 -0500 Original-Received: from [216.254.0.201] (helo=mail1.speakeasy.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AWeeI-0003sY-2m for help-gnu-emacs@gnu.org; Wed, 17 Dec 2003 11:35:46 -0500 Original-Received: (qmail 14631 invoked from network); 17 Dec 2003 15:34:17 -0000 Original-Received: from dsl093-011-017.cle1.dsl.speakeasy.net (HELO heidegger.mousecar.net) ([66.93.11.17]) (envelope-sender ) by mail1.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 17 Dec 2003 15:34:17 -0000 Original-To: Maurizio Loreti In-Reply-To: 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:15369 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15369 Of course everyone can set up their systems however they wish, but I use: export DISPLAY=$(who -lum|awk -F '(' '{print $2}'|awk -F ')' '{print $1}'):0 in my ~/.bashrc and have no problem logging in and/or running remotely whatever X apps I want. Because it would take a lot of thinking to hash out which is the correct file to put this in, whether the DISPLAY is a resource or not, whether this variable should be set for all interactive shells or just for logins, and because I don't wish to argue any of this, I'll just say that I disagree and believe that .bashrc *is* the proper place for setting DISPLAY. As said at the outset, everyone can set up their systems however they wish. hth, ken At 07:42 (UTC+0100) on 17 Dec 2003 Maurizio Loreti said: = Pepijn Kenter writes: = = > gebser@speakeasy.net 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" = `----- = =