From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: view-mode exit hook? Date: Tue, 18 Dec 2007 23:24:26 -0800 Message-ID: References: <4768BC8F.90308@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1198049171 2784 80.91.229.12 (19 Dec 2007 07:26:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Dec 2007 07:26:11 +0000 (UTC) Cc: Emacs-Devel To: "martin rudalics" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 19 08:26:22 2007 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.50) id 1J4tJs-0003kY-4d for ged-emacs-devel@m.gmane.org; Wed, 19 Dec 2007 08:26:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4tJY-0006u9-Ku for ged-emacs-devel@m.gmane.org; Wed, 19 Dec 2007 02:26:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J4tJU-0006sA-P4 for emacs-devel@gnu.org; Wed, 19 Dec 2007 02:25:56 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J4tJS-0006pt-Pd for emacs-devel@gnu.org; Wed, 19 Dec 2007 02:25:55 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4tJS-0006pe-D7 for emacs-devel@gnu.org; Wed, 19 Dec 2007 02:25:54 -0500 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J4tJR-0006Cn-Ti for emacs-devel@gnu.org; Wed, 19 Dec 2007 02:25:54 -0500 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id lBJ7Pn6p030945; Wed, 19 Dec 2007 01:25:50 -0600 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id lBJ4jPvp011804; Wed, 19 Dec 2007 00:25:48 -0700 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-81-149.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 3451015881198049057; Tue, 18 Dec 2007 23:24:17 -0800 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <4768BC8F.90308@gmx.at> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:85272 Archived-At: > > I wasn't suggesting to use `view-mode-hook'. As I noted, that > > is run only upon entering the mode. I don't know whether > > view-mode manages to keep track of window configs - I thought > > it did, but that's beside the point here. What would be > > needed in this case would be restoring the frame config, not > > a window config. _If_ that were feasible. > > If you want to restore the frame configuration you have to save it first. > Where do you want to do that? All I said was that `view-mode-hook' might > be the wrong place. I don't want to save and restore it. I'm not trying to redesign view-mode. If you have an idea for that, fine; I'm not proposing one. I've said that I don't understand view-mode - especially its convoluted attempts to deal with remembering past contexts, trying to restore the right context in various scenarios, and all that. I won't get involved with that. If someone who does understand all that and is interested in this issue wants to tackle it to provide better behavior, fine. I'm not up to that task. I'm only asking a question about how users should deal with this kind of thing, what might be the recommended practice in this case. That's all. And, especially if there is no good answer (recommendation), I'm asking whether we should perhaps have a `view-mode-exit-hook'. This last question can make sense regardless of whether someone undertakes to make view-mode always DTRT wrt final frame configuration (if a consensus could even be reached about what that might mean). > > If the frame cannot be restored, I'm happy to deal with this by > > fitting the frame again upon view-mode exit, even though that is less > > desirable for a user than putting back the frame parameters s?he had > > before view-mode. > > > > I don't want to go near `view-exit-action', if I can avoid it. > > That code is far too complicated for a mortal such as I. I did think > > that I could recuperate the current value of `view-exit-action' and > > then tack my function call onto it, but that seems quite ugly. I'd > > sooner advise `view-mode-exit', I think (and I don't like to use > > advice either). > > > > I was looking for a simple and clean way to go, such as a hook. > > > > Does it make sense for Emacs to have a `view-mode-exit-hook'? > > You can always think of `view-exit-action' as doing that. For example, > there's no harm setting `view-exit-action' to a function that restores > a frame configuration saved earlier. The question remains _which_ frame > configuration you want to restore. `view-exit-action' is not currently a no-op, AFAICT. So adding the feature of fitting the frame would not simply be a matter of setting or binding `view-exit-action' to a `fit-frame' function. It would instead mean _adding_ frame fitting to whatever `view-exit-action' might already be doing. And that "whatever" is different, IIUC, depending on how view-mode is exited, and even, I think, depending on how view-mode was entered. (Again, I don't master that code, nor do I want to.) `view-exit-action' is not simply a hook; it is more complex (and perhaps more fragile). As I said, I can imagine tacking `fit-frame' onto whatever `view-exit-action' does already, but I'd sooner advise `view-mode-exit'. And neither of those prospects looks particularly appealing (clean) to me. >From what I've heard so far, there seems to be no recommended way to handle this kind of thing. In that case, I ask again, shouldn't there be a `view-mode-exit-hook'?