unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: gebser@speakeasy.net
Cc: help-gnu-emacs@gnu.org
Subject: Re: GNU emacs locks files modified with CVS
Date: Wed, 17 Dec 2003 10:34:16 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0312170923120.23118-100000@www> (raw)
In-Reply-To: <rmiskg6j37.fsf@mlinux.pd.infn.it>


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 <kenter_remove_spam@tpd.tno.nl> 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"
= `-----
= 
= 

  reply	other threads:[~2003-12-17 15:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.138.1071587578.868.help-gnu-emacs@gnu.org>
2003-12-16 14:51 ` GNU emacs locks files modified with CVS Pepijn Kenter
2003-12-16 16:26   ` gebser
2003-12-17  6:42   ` Maurizio Loreti
2003-12-17 15:34     ` gebser [this message]
     [not found] <mailman.195.1071679031.868.help-gnu-emacs@gnu.org>
2003-12-17 16:26 ` Kevin Rodgers
2003-12-17 19:03   ` gebser
2003-12-17 16:41 ` Pepijn Kenter
2003-12-17 17:54 ` Maurizio Loreti
2003-12-18 17:19   ` Kevin Rodgers
2003-12-15 12:25 Pepijn Kenter
2003-12-15 18:04 ` Kevin Rodgers
2003-12-16  9:44   ` Pepijn Kenter
2003-12-16 14:10     ` gebser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0312170923120.23118-100000@www \
    --to=gebser@speakeasy.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).