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: view-mode exit hook? Date: Tue, 18 Dec 2007 11:03:23 -0800 Message-ID: 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 1198004651 16474 80.91.229.12 (18 Dec 2007 19:04:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Dec 2007 19:04:11 +0000 (UTC) Cc: rudalics@gmx.at To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 18 20:04:23 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 1J4hjk-0005ec-T2 for ged-emacs-devel@m.gmane.org; Tue, 18 Dec 2007 20:04:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4hjR-0002lu-Ny for ged-emacs-devel@m.gmane.org; Tue, 18 Dec 2007 14:03:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J4hjO-0002lm-UX for emacs-devel@gnu.org; Tue, 18 Dec 2007 14:03:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J4hjO-0002la-9w for emacs-devel@gnu.org; Tue, 18 Dec 2007 14:03:54 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4hjO-0002lX-6T for emacs-devel@gnu.org; Tue, 18 Dec 2007 14:03: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 1J4hjN-0003CG-OH for emacs-devel@gnu.org; Tue, 18 Dec 2007 14:03:53 -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 lBIJ3mH3023778; Tue, 18 Dec 2007 13:03:48 -0600 Original-Received: from rcsmt251.oracle.com (rcsmt251.oracle.com [148.87.90.196]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id lBIJ3cFV001966; Tue, 18 Dec 2007 12:03:47 -0700 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-81-149.vpn.oracle.com by acsmt351.oracle.com with ESMTP id 3449400931198004600; Tue, 18 Dec 2007 11:03:20 -0800 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) 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:85259 Archived-At: What is the recommended way to run some code when view-mode exits? For entering view-mode, `view-mode-hook' can be used (it is run by `view-mode-enable'), but I don't see anything equivalent for exiting. Are users supposed to advise view-mode code (e.g. `view-mode-exit'), or is there a better, recommended course of action? My use case: When view-mode is entered, my own code fits the frame (assuming it's one-window-p) to the viewed buffer. My tweaked version of `display-buffer' takes care of that. But when view-mode is exited, the frame is not re-fit to the buffer that is now displayed there. I'm looking for a way to call my function `fit-frame', preferably via a hook run after view-mode has exited and the other buffer is displayed in the frame, that is, at the very end of `view-mode-exit'. Even better, perhaps, would be for view-mode to restore the frame config after it exits. That way, the frame would return to its prior state for the buffer that was shown there previously. That is preferable for two reasons: (1) no need to explicitly re-fit the buffer and (2) if the user had manually resized the frame for the prior buffer, returning to that buffer would not override the user's frame size preference by fitting it.