From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Marschke Newsgroups: gmane.emacs.devel Subject: Re: screen & emacs Date: Thu, 3 Feb 2011 19:13:48 +0100 Message-ID: <20110203181348.GA15004@andres.andreas> References: <87k4hh4thk.fsf@sysu76.podval.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1296756872 22719 80.91.229.12 (3 Feb 2011 18:14:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Feb 2011 18:14:32 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 03 19:14:28 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pl3hL-0006nG-QI for ged-emacs-devel@m.gmane.org; Thu, 03 Feb 2011 19:14:28 +0100 Original-Received: from localhost ([127.0.0.1]:44828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl3hK-0005Qc-RG for ged-emacs-devel@m.gmane.org; Thu, 03 Feb 2011 13:14:26 -0500 Original-Received: from [140.186.70.92] (port=49642 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl3h4-0005Nw-QJ for emacs-devel@gnu.org; Thu, 03 Feb 2011 13:14:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pl3h2-0002kZ-2q for emacs-devel@gnu.org; Thu, 03 Feb 2011 13:14:09 -0500 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:44572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pl3h1-0002kR-MN for emacs-devel@gnu.org; Thu, 03 Feb 2011 13:14:08 -0500 Original-Received: by fxm12 with SMTP id 12so1510128fxm.0 for ; Thu, 03 Feb 2011 10:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=R5NkAJejXIhw0SGf98RkMn2Ol/7FneT0JTomoDKAeIs=; b=O4Edr5RWJhIwObLJLKrV40GvGYLaKwldDWyfve5fJm14t5Id6uxlidw2BnNgIGyzu8 T357OK+Si9wWjjokFPAO/paXKrPfoZbbEiJMxpd22JtA5O/kAEBqPrtKnn7Ua8jGzu5Q +/lOiNmpMLTUqFLhq4qIaOeiXX7c0kIuuxjAM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Duw4GHnx2/Rc290Urkd4+KqdPstoWF+EYYKMxQ6WWmC7kS2wjeHSJiPQHQmjpVaCIP UqhfrfzHV3u1DSgqbSBPk6RpH9EoIP556/IYM70ZxeelyBXJgcJyryHM2lEOJFe/BIdI IRtbwnVfSiFopNbw2uQJ2anlECy6+YUjYxPAw= Original-Received: by 10.223.87.72 with SMTP id v8mr8421944fal.107.1296756846344; Thu, 03 Feb 2011 10:14:06 -0800 (PST) Original-Received: from andres.andreas (p5B2A7C1E.dip.t-dialin.net [91.42.124.30]) by mx.google.com with ESMTPS id n2sm415836fam.4.2011.02.03.10.14.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Feb 2011 10:14:05 -0800 (PST) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135509 Archived-At: Hi! What you probably want is not just a deamonized Emacs in Screen but also emacsclients automatically starting. It shouldn't be wrong to leave the emacsclient on the other machine running. Another issue may be that your screen won't automagically change the Display value from the parent shell you started. I know this because I frequently restart my X.org and find that I cant start X-Apps anymore afterwards. Your best shot may be: - start emacs in screen (I auto-start my emacs each time I start a screen session) with `-nw' so it keeps in the screen - run M-x server-start in emacs or give it an `-f server-start' on the console - detach the screen - run from the console that has the X11 forwarding and the correct display currently something like emacsclient -c This will start emacsclient which will find your emacs-server and show show you a window in the current session. Here is a more elaborate example from both my `.screenrc' and my `.bashrc': --------: .bashrc function emacs() { if [ -x /tmp/emacs$UID/server ];then emacsclient -nw $@ else screen emacs -nw -f server-start $@ fi } This means eachtime I run `emacs' from the shell I either get a client if it finds a server at `/tmp/emacs$UID/' or start a new session. Now this has a few caveats as `/tmp/emacs$UID/server' may still be present even though emacs was roughly kulled in an errornous attempt to clean up the open and unused shells in your screen session(been there done that). But its an affordable price to pay for this convenience. --------: .screenrc # Welcome the user: #echo "welcome :-)" #echo "I love you today." msgwait 10 # Uncomment one/some following lines to automatically let # SCREEN start some programs in the given window numbers: screen -t MAIL 0 mutt screen -t MOCP 1 mocp screen -t FINCH 2 finch screen -t IRSSI 3 ssh xxtjaxx@ein-elch.de screen -t EMACS 4 emacs -nw -f server-start -D --debug-init # screen -t TORRENT 5 rtorrent ---------- This will start a screen automatically at screen no. 4 each time I initiate a new one. This is such a convenience to have when you use only one _main_ screen at a time for everything. If you have an issue with control characters in screen like 5D or the like because you typed C-. There is a fix. http://alioth.debian.org/~twb-guest/Preferences/.screen.el Happy Hacking! On Thu, Feb 03, 2011 at 12:28:10PM -0500, Sam Steingold wrote: > > * Justin Lilly [2011-02-02 23:58:18 -0500]: > > > > It seems as if you should be able to run a daemonized emacs. Multiple > > clients can then connect to it without stealing each other's > > connection. > > thanks for the suggestion, I tried "emacs -daemon". > > 1. For many years I have been running emacs under gdb at all times. > It appears no longer to be an option with -daemon. > > 2. Unless used with "-c", emacsclient connecting to the daemon under > screen seems to default to "-nw" (or maybe it depends on DISPLAY? - I am > still somewhat confused about the interplay between DISPLAY & ssh/ForwardX11). > I tried that for a while and discovered that M- et al do not work > (I need to do Esc- &c). > > 3. When Emacs is started as a daemon, it loads .emacs with window-system > set to nil. This means that when the client opens an X window (emacs > frame), it has the settings in .emacs which are "appropriate" for a > terminal, not a GUI. I am not sure how to handle this properly, except > for remove all (when window-system ...) from .emacs. > > just for the reference, my original request: > > > On Wed, Feb 2, 2011 at 11:44 PM, Sam Steingold wrote: > >> I use gnu screen on a server S to which I connect using ssh from various > >> client boxes (e.g., a windows desktop D and a linux laptop L). > >> This is great: I always see the same shell sessions on S regardless > >> where I connect from. > >> There is only one problem: I run ssh with ForwardX11=yes, so when I > >> start emacs on S, I see the usual GUI window on D or L (I still have to > >> figure out the right setting for DISPLAY for some reason) which is > >> precisely what I want. > >> Alas, when I open an emacs on S while connected from D and then go over > >> to L and ssh to S, then the screen session gets stolen from D and > >> appears on L, __BUT__ the emacs window (again, emacs is running on S, > >> but the window is shown on D) stays on D and does not go over to L > >> automagically. > >> Is there a way around this (except for "emacs -nw")? > >> > >> PS. One thing I hate about screen is that it does not terminate > >> "gracefully" on reboot: it is killed so the bash histories of various > >> widows are not saved... > > -- > Sam Steingold (http://sds.podval.org/) on gnu/linux terminal > http://iris.org.il http://www.PetitionOnline.com/tap12009/ > http://dhimmi.com http://ffii.org http://thereligionofpeace.com > If you think big enough, you'll never have to do it. > -- Cheers, Andreas Marschke