From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: [PATCH] don't always restore previous window configuration? Date: Sat, 24 Nov 2018 10:24:23 -0500 Message-ID: References: <87zhu0nw36.fsf@gmail.com> <87tvk62199.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008134bf057b6ab0b6" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQZmx-0005Wp-CP for emacs-orgmode@gnu.org; Sat, 24 Nov 2018 10:24:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQZmv-0006Rt-UR for emacs-orgmode@gnu.org; Sat, 24 Nov 2018 10:24:07 -0500 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:34255) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQZmu-0006Q1-JJ for emacs-orgmode@gnu.org; Sat, 24 Nov 2018 10:24:05 -0500 Received: by mail-io1-xd30.google.com with SMTP id f6so10758710iob.1 for ; Sat, 24 Nov 2018 07:24:02 -0800 (PST) In-Reply-To: <87tvk62199.fsf@nicolasgoaziou.fr> 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: Org Mode --0000000000008134bf057b6ab0b6 Content-Type: text/plain; charset="UTF-8" On Sat, Nov 24, 2018 at 5:55 AM Nicolas Goaziou wrote: > 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. > Then I'm sorry for the noise (and also for this aside!). Magit, or git, or some other tool was doing something quite strange and disturbing, and I am now seeing these remotes in my repo: dup /tmp/tmp-orgtest/org-annex-testoRSq4r/ (fetch) dup /tmp/tmp-orgtest/org-annex-testoRSq4r/ (push) origin https://code.orgmode.org/bzg/org-mode.git (fetch) origin https://code.orgmode.org/bzg/org-mode.git (push) original /tmp/tmp-orgtest/org-annex-testrgbPft/ (fetch) original /tmp/tmp-orgtest/org-annex-testrgbPft/ (push) > > * 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? > I'm not sure. Until now only Eric and I had commented on this feature. I will say that I will probably never go back to the old behavior, but maybe there are people who prefer it. I believe there are 6 possible options for org-src-window-setup (though only 5 are listed in the defcustom definition, I think that org-src-switch-to-buffer also recognizes 'silently). It may be that some of those options only make sense if the window config is restored after closing the src buffer. ~org-src--saved-window-config~ is only used in this function, so instead of adding a new variable we could just get rid of an old one :-). > * 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 > thank you for the improvements. I'll wait to see what is decided about the other issue above. --0000000000008134bf057b6ab0b6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sat, Nov 24, 2018 at 5:55 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Hello,

Matt Price <mopt= op99@gmail.com> writes:

> OH man, that was a little harder than I thought it would be. Does `mak= e
> test` randomly checkout a new branch or something?

No, it doesn't.
Then I'm sorry for the noise (= and also for this aside!).=C2=A0 Magit, or git, or some other tool was doin= g something quite strange and disturbing, and I am now seeing these remotes= in my repo:
dup=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /tmp/tm= p-orgtest/org-annex-testoRSq4r/ (fetch)
dup=C2=A0=C2=A0=C2=A0=C2=A0 /tmp= /tmp-orgtest/org-annex-testoRSq4r/ (push)
origin=C2=A0 https://code.orgmode.org/bzg/org-mode.= git (fetch)
origin=C2=A0 https://code.orgmode.org/bzg/org-mode.git (push)
original= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /tmp/tmp-orgtest/org-annex-testr= gbPft/ (fetch)
original=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /tmp/t= mp-orgtest/org-annex-testrgbPft/ (push)



> * org-srce.el (org-src-restore-window-config, org-exit-from-src): = New
>=C2=A0 =C2=A0variable org-src-restore-window-config allows user to opt = out of
>=C2=A0 =C2=A0restoring window config when exiting from source buffer wi= th
>=C2=A0 =C2=A0org-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?
I&= #39;m not sure. Until now only Eric and I had commented on this feature.=C2= =A0 I will say that I will probably never go back to the old behavior, but = maybe there are people who prefer it. I believe there are 6 possible option= s for org-src-window-setup (though only 5 are listed in the defcustom defin= ition, I think that org-src-switch-to-buffer also recognizes 'silently)= . It may be that some of those options only make sense if the window config= is restored after closing the src buffer.

~org-src--saved-window-conf= ig~ is only used in this function, so instead of adding a new variable we c= ould just get rid of an old one :-).
<= br>
> * org-srce.el (org-src-restore-window-config, org-exit-from-src): New<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^^^
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0typo

> +(defcustom org-src-restore-saved-window-config t
> +=C2=A0 "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."
> +=C2=A0 :group 'org-edit-structure
> +=C2=A0 :type 'boolean)

You need to specify :version and :safe keyword.
> +
>=C2=A0 (defvar org-src-mode-hook nil
>=C2=A0 =C2=A0 "Hook run after Org switched a source code snippet t= o its Emacs mode.
>=C2=A0 \\<org-mode-map>
> @@ -1173,8 +1181,8 @@ Throw an error if there is no such buffer."=
>=C2=A0 =C2=A0 =C2=A0 ;; Clean up left-over markers and restore window c= onfiguration.
>=C2=A0 =C2=A0 =C2=A0 (set-marker beg nil)
>=C2=A0 =C2=A0 =C2=A0 (set-marker end nil)
> -=C2=A0 =C2=A0 (when org-src--saved-temp-window-config
> -=C2=A0 =C2=A0 =C2=A0 (set-window-configuration org-src--saved-temp-wi= ndow-config)
> +=C2=A0 =C2=A0 (when (and=C2=A0 org-src--saved-temp-window-config org-= src-restore-saved-window-config)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^^^
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 spurious space
thank you for the improvements. I'll wait to see what is decided abo= ut the other issue above. =C2=A0
--0000000000008134bf057b6ab0b6--