From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: desktop-restore-frames Date: Mon, 15 Jul 2013 02:08:14 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1373846941 3114 80.91.229.3 (15 Jul 2013 00:09:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Jul 2013 00:09:01 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 15 02:09:03 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UyWLc-0007Mg-5R for ged-emacs-devel@m.gmane.org; Mon, 15 Jul 2013 02:09:00 +0200 Original-Received: from localhost ([::1]:57760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyWLb-0002MS-LP for ged-emacs-devel@m.gmane.org; Sun, 14 Jul 2013 20:08:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyWLZ-0002MJ-2W for emacs-devel@gnu.org; Sun, 14 Jul 2013 20:08:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyWLX-0005Sw-Pb for emacs-devel@gnu.org; Sun, 14 Jul 2013 20:08:57 -0400 Original-Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:43907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyWLX-0005Sr-Iq for emacs-devel@gnu.org; Sun, 14 Jul 2013 20:08:55 -0400 Original-Received: by mail-ea0-f176.google.com with SMTP id z15so7301873ead.21 for ; Sun, 14 Jul 2013 17:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=BecY1JECKOwRiPYhYxys17XwPCEoSk4D3kBZ4JQHg8w=; b=rnKbgNz9DXMEPQ+oId0bf5sY1YOfC6H/gbMyo6v9ihsLOsaRv3njkMubFu8kBoCfk7 u9tIc3iUTrX4FxQcGPemRc2LdVK43bZBezmzBev+6Mjg+x1aVdqlVthQfOevLbPzBoYo TqAvuwM08UO6XJgkM0B5PRnNbSClhn3uG2F/YLnY4vNNPrZMIRGtXiMeEPvGet72pUPO CvYJyOIUw/FVxsGczo89sZDw3iLQmp4WqjaYh2FC1Pj8N2sHJWSk3RtH2s+dO9q902YP 9pHQDjGNI65wm5akOeHgjXM7BehzxCrMq+qLl4nVsq8adRvnXfVTCbi4sA7ztaBrCmgg CQIg== X-Received: by 10.15.21.78 with SMTP id c54mr55931356eeu.14.1373846934902; Sun, 14 Jul 2013 17:08:54 -0700 (PDT) Original-Received: by 10.14.142.4 with HTTP; Sun, 14 Jul 2013 17:08:14 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161889 Archived-At: OK, I've just committed a change to desktop.el which enables desktop-restore-frames by default. At this point, the code is working well enough in my setup, which alas is wholly Windows-specific. So it's time to let the little bird fly and start receiving suggestions, feedback, bug reports and possibly blunt force trauma. * ADDED: - Option restore-in-current-display now offers three possibilities: t, which forces frames to the current display; nil, which allows each frame to go to their display, and delete, which restores frames in the current display and deletes others. - New option desktop-restoring-reuses frames, with three possible values: reuse existing frames (if possible, else delete them), delete existing frames (and create new ones for saved frames), and keep the existing ones (and restore saved frames in new ones). A problem with `keep' is that is more useful for M-x desktop-read than for the initial read, because it does keep the initial frame, which is likely not what the user wants. Workarounds include adding code in your .emacs to delete that frame: (setq *initial* (selected-frame)) (add-hook 'desktop-after-read-hook (lambda () (when *initial* (ignore-errors (delete-frame *initial*)) (setq *initial* nil)))) or adding a new option, if necessary. - Support for minibuffer-only and minibufferless frames. In many normal setups, saving & restoring these kind of frames should work as expected. I haven't added an option to skip restoring minibuffer-only frames, as Drew suggested. Let's try this first and I can add it afterwards if required. - Workaround for bug/feature/infelicity#14795. Now frames should be restored with the right height, regardless of their tool-bar-mode setting. - Vastly improved parameter filtering. It now allows setting filtering functions to precisely determine when and how parameters are passed untouched, removed or modified. As a corollary, fullscreen, size/position and font parameters survive the tty roundtrip intact. * NOT ADDED / FOR DISCUSSION: - I have not made any attempt to detect off-screen frames and move them back on-screen. As there are legitimate uses of off-screen frames, we should discuss what is the expected UI before throwing code at it. - Currently, desktop-restore-frames is enabled by customize. In some cases, it seems it would be useful to be able to easily enable/disable it, either as an argument to desktop-save-mode or as a new pseudo-minor-mode. - M-x desktop-clear "cleans up" the desktop by removing buffers, etc. Should that command also (directly or via an argument) remove windows and/or frames? IMO both possibilities seem reasonable. - All names are up for discussion, of course. I'm really bad at naming functions and options. Also, suggestions to make docstrings clearer are very welcome. - Other than desktop-filter-parameters-alist, I have not added any low-level hook to allow tinkerers to piggyback into the save&restore mechanics. I suppose the existing hooks and advice-add should suffice, but if someone has anything specific in mind that would require other entry points, I'm all ears. - Some of this stuff, once polished, should be documented in the elisp or emacs manual. Not by me, though, sorry. * THINGS KNOWN NOT TO WORK: - Minibuffer(less|-only) frames do not survive the roundtrip to tty and back. It could be made to work, but it is a bit complex and I'm not sure how useful / necessary it really is. - On Windows, invisible frames turn visible the second time they are restored, as an interesting consequence of bug#14841. * BADLY NEEDED TESTING: - Non-Windows environments. - Anything "multi": multiple displays, multiple monitors, complex multi-frame setups, multiple terminals, etc. - daemon mode. - GUI and tty frames in the same session. I think that's all. Enjoy, Juanma