From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] don't always restore previous window configuration? Date: Sat, 24 Nov 2018 11:55:30 +0100 Message-ID: <87tvk62199.fsf@nicolasgoaziou.fr> References: <87zhu0nw36.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQVb7-0001VQ-P0 for emacs-orgmode@gnu.org; Sat, 24 Nov 2018 05:55:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQVb3-0006Kw-JP for emacs-orgmode@gnu.org; Sat, 24 Nov 2018 05:55:37 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:51153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gQVb3-0006J7-CQ for emacs-orgmode@gnu.org; Sat, 24 Nov 2018 05:55:33 -0500 In-Reply-To: (Matt Price's message of "Fri, 23 Nov 2018 10:20:56 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Matt Price Cc: Org Mode Hello, Matt Price writes: > OH man, that was a little harder than I thought it would be. Does `make > test` randomly checkout a new branch or something? No, it doesn't. > This patch adds a new long-winded variable `org-src-restore-window-config`, > t by default, which if set to `nil` will inhibit restoration of previous > window config in `org-edit-src-exit`. > I'm afraid I don't really understand the tests and I learn so slowly that I > don't have time to keep trying today. But hopefully this simple patch is > adequate. I also wrote a changelog entry in my git commit msg, which is > here: > > Make restoration of window config optional on exit from src buffer > > * org-srce.el (org-src-restore-window-config, org-exit-from-src): New > variable org-src-restore-window-config allows user to opt out of > restoring window config when exiting from source buffer with > org-exit-from-src. Thank you. Should it be a variable, though? Is there any strong reason, e.g., a valid use-case, to preserve window configuration? > * org-srce.el (org-src-restore-window-config, org-exit-from-src): New ^^^ typo > +(defcustom org-src-restore-saved-window-config t > + "Whether to restore windows to previous configuration. Non-nil means preserve window configuration after editing a source block. > +When non-nil (default), on exit from a source buffer, org will org -> Org > +try to restore the window configuration that was active when > +the source buffer was created." > + :group 'org-edit-structure > + :type 'boolean) You need to specify :version and :safe keyword. > + > (defvar org-src-mode-hook nil > "Hook run after Org switched a source code snippet to its Emacs mode. > \\ > @@ -1173,8 +1181,8 @@ Throw an error if there is no such buffer." > ;; Clean up left-over markers and restore window configuration. > (set-marker beg nil) > (set-marker end nil) > - (when org-src--saved-temp-window-config > - (set-window-configuration org-src--saved-temp-window-config) > + (when (and org-src--saved-temp-window-config org-src-restore-saved-window-config) ^^^ spurious space Regards, -- Nicolas Goaziou