From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r100117: Run kill-emacs when exiting for display closed or SIGTERM/HUP. Date: Wed, 05 May 2010 09:21:44 +0200 Message-ID: <4BE11C88.2080705@swipnet.se> References: <3D94147C-CA80-4DB1-AD11-4707C3077275@swipnet.se> <4BDE87A4.5060701@swipnet.se> <4BDF1106.7060200@swipnet.se> <87633474hd.fsf@uwakimon.sk.tsukuba.ac.jp> <4BDFD57A.3050808@swipnet.se> <87d3xb7vge.fsf@uwakimon.sk.tsukuba.ac.jp> <4BE0184C.1090902@swipnet.se> <4BE02EA7.2070102@swipnet.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1273077086 17264 80.91.229.12 (5 May 2010 16:31:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 May 2010 16:31:26 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 05 18:31:24 2010 connect(): No such file or directory 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 1O9hVL-0005G7-0n for ged-emacs-devel@m.gmane.org; Wed, 05 May 2010 18:31:23 +0200 Original-Received: from localhost ([127.0.0.1]:51458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9hVJ-000240-1K for ged-emacs-devel@m.gmane.org; Wed, 05 May 2010 12:31:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9Yvn-0001W4-An for emacs-devel@gnu.org; Wed, 05 May 2010 03:22:07 -0400 Original-Received: from [140.186.70.92] (port=48873 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9Yvf-0001Pq-US for emacs-devel@gnu.org; Wed, 05 May 2010 03:22:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9YvW-00019K-AF for emacs-devel@gnu.org; Wed, 05 May 2010 03:21:59 -0400 Original-Received: from smtprelay-h12.telenor.se ([62.127.194.5]:36965) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9YvV-00018G-6D for emacs-devel@gnu.org; Wed, 05 May 2010 03:21:50 -0400 Original-Received: from ipb1.telenor.se (ipb1.telenor.se [195.54.127.164]) by smtprelay-h12.telenor.se (Postfix) with ESMTP id 5072CEA44D for ; Wed, 5 May 2010 09:22:52 +0200 (CEST) X-SENDER-IP: [85.225.45.110] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnVKAMO44EtV4S1uPGdsb2JhbACHaZVYDAEBAQE1Lb4sglyCNwQ X-IronPort-AV: E=Sophos;i="4.52,332,1270418400"; d="scan'208";a="70753987" Original-Received: from c-6e2de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.110]) by ipb1.telenor.se with ESMTP; 05 May 2010 09:21:46 +0200 Original-Received: from [172.20.199.2] (gaffa [172.20.199.2]) by coolsville.localdomain (Postfix) with ESMTP id 7AF897FA05A; Wed, 5 May 2010 09:21:44 +0200 (CEST) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:124534 Archived-At: 2010-05-04 20:50, Stefan Monnier skrev: > > I still don't understand what was that feature you're talking about. > The way I see it, it was more like some accidental behavior which > happened to be convenient. I'd like to use this "breakage" as an > opportunity to replace those lucky accidents by sound behavior. To get Emacs to automatically read my desktop: % cd to/dir/of/interest % emacs & To get session management to automatically read my desktop, --chdir emulates that usage. Maybe people just start Emacs at $HOME and load desktop interactivly, I don't know. >>> Doesn't matter as long as the end result is the one we want. >>> Usually I'd expect $HOME to be a good choice. >> And how will Emacs avoid to load my desktop file there if I didn't use >> it previously? > > That argues for a change in desktop.el to make it behave better with > session management. Yes it does. >> It may be to you, but it is not to me. I open files all the time from >> *scratch* just because the default directory there is right. It is a bug >> for Emacs not to restore this after a session restart. > > Can you describe your use-case more precisely? Some directory trees I work with are very deep, 7 to 8 layers of subdirectories are not uncommon. But they are part of the same project. I save the desktop at the top of that tree, because I do a svn up there before I start Emacs. When I am at the deepest part of the tree and want to open a file that is in another directory, I have to either C-x C-f or C-x b *s C-x C-f I find the latter to be much faster. > > BTW, why use --chdir rather than save the default-directories in the > session file if you think that it should work even without desktop.el? I doesn't work with desktop. desktop adds itself to after-init-hook, and that is run before session restore. So desktop will load my desktop in $HOME before default-directories are restored. > >> I'd like desktop.el to be more modular so we could save desktop >> automatically in the session specific restore data file. I tried >> once, but it was so hard coded to use just one file, so I gave up. > > Ah, now you're starting to talk. Can you give some details of what you > tried and where the "hardcoding" was showing its ugly head? desktop-save can't save to an arbitrary buffer. When desktop isn't used and Emacs is to be killed by the session manager, it would be good to save the desktop in the session-specific file. But desktop-read can't read just part of a file, so restore may become an issue. Ideally we would just load the session specific file on restart, but desktop has some cleanups it does in desktop-read after load. You never know if desktop-save is going to ask questions or not (well, except duplicating the logic behind ask-if-new and so on). This makes it unsuitable for use when the session manager says "save state". Note that in those cases, we may not be stopped at all, and user interaction should not take place. And there is the possibility that the desktop file is locked, so it will ask a question anyway. > >> If I start emacs in /some/dir without a desktop file and have desktop-mode >> enabled, there will be no desktop saved when I log out. >> When the session manager then restarts Emacs in $HOME it will read my >> desktop file in $HOME. That is a bug also. > > OK, let's try and fix it right, then. > My first attemt was to let desktop save its state if desktop is enabled, otherwise save it in the session specific file. But I now think that we must save in the session specific files always, due to the locking and stuff in desktop. Desktop may also choose to save in its file, so we save desktop in two places (just one if desktop-save-mode isn't enabled). On restore, you should somehow tell desktop not to load its file, because if it does, it might be the wrong thing to do. We wan't to restore to the state we had when stopped, and we don't know what has happend to that desktop file while we weren't running (some other Emacs may have modified it). But now session restore kicks in after desktop has already read its file. After we have restored from the session file, we must then tell desktop that it is now okay to save to its file again. If desktop-save-mode isn't on, this becomes easier. Jan D.