* don't always restore previous window configuration?
@ 2018-11-22 19:09 Matt Price
2018-11-23 6:31 ` Eric S Fraga
0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2018-11-22 19:09 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 999 bytes --]
I've recently switched to using the current window for editing src blocks w
~(setq org-src-window-setup 'current=window)~. I like this a lot, and it
lets me swtich rapidly back and forth between the parent buffer and source
code. Often when I ma working I split some of hte other windows to display
other fn definitions or help buffers. I would strongly perfer for htat
window layout not to hcange when I switch back to the parent buffer. I was
able to change this for myself by wrapping the final ~when
org-src--saved-temp-window-config~ in the definition of ~org-edit-src-exit~
in an unless statement:
(unless (eq 'current-window org-src-window-setup)
(when org-src--saved-temp-window-config
(set-window-configuration org-src--saved-temp-window-config)
(setq org-src--saved-temp-window-config nil)))
SO far this is working for me but I wondered whether other people would
similarly want to change this behaviour and I should put together a proper
proposal & patch?
[-- Attachment #2: Type: text/html, Size: 1202 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: don't always restore previous window configuration?
2018-11-22 19:09 don't always restore previous window configuration? Matt Price
@ 2018-11-23 6:31 ` Eric S Fraga
2018-11-23 15:20 ` [PATCH] " Matt Price
0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2018-11-23 6:31 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
On Thursday, 22 Nov 2018 at 14:09, Matt Price wrote:
> SO far this is working for me but I wondered whether other people would
> similarly want to change this behaviour and I should put together a proper
> proposal & patch?
Yes, please. This is becoming more and more necessary as monitors get
larger. I am using a very wide (and very nice) 38" monitor at work. My
window configuration within a single frame can get quite
complex. Having org (and other tools) change this configuration can be
quite annoying.
--
Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] don't always restore previous window configuration?
2018-11-23 6:31 ` Eric S Fraga
@ 2018-11-23 15:20 ` Matt Price
2018-11-24 10:55 ` Nicolas Goaziou
0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2018-11-23 15:20 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1.1: Type: text/plain, Size: 1517 bytes --]
OH man, that was a little harder than I thought it would be. Does `make
test` randomly checkout a new branch or something?
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.
On Fri, Nov 23, 2018 at 1:31 AM Eric S Fraga <esflists@gmail.com> wrote:
> On Thursday, 22 Nov 2018 at 14:09, Matt Price wrote:
> > SO far this is working for me but I wondered whether other people would
> > similarly want to change this behaviour and I should put together a
> proper
> > proposal & patch?
>
> Yes, please. This is becoming more and more necessary as monitors get
> larger. I am using a very wide (and very nice) 38" monitor at work. My
> window configuration within a single frame can get quite
> complex. Having org (and other tools) change this configuration can be
> quite annoying.
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442
>
[-- Attachment #1.2: Type: text/html, Size: 1999 bytes --]
[-- Attachment #2: 0001-Make-restoration-of-window-config-optional-on-exit-f.patch --]
[-- Type: text/x-patch, Size: 1795 bytes --]
From 7adeca638eff962770874078822e2a3d23430b2b Mon Sep 17 00:00:00 2001
From: Matt Price <matt.price@utoronto.ca>
Date: Fri, 23 Nov 2018 09:16:40 -0500
Subject: [PATCH] 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-rewtore-window-config allows user to opt out of
restoring windor config when exiting from source buffer with
org-exit-from-src.
---
lisp/org-src.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 12163156f..386bad413 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -166,6 +166,14 @@ other-frame Use `switch-to-buffer-other-frame' to display edit buffer.
(const other-window)
(const reorganize-frame)))
+(defcustom org-src-restore-saved-window-config t
+ "Whether to restore windows to previous configuration.
+When non-nil (default), on exit from a source buffer, org will
+try to restore the window configuration that was active when
+the source buffer was created."
+ :group 'org-edit-structure
+ :type 'boolean)
+
(defvar org-src-mode-hook nil
"Hook run after Org switched a source code snippet to its Emacs mode.
\\<org-mode-map>
@@ -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)
+ (set-window-configuration org-src--saved-temp-window-config)
(setq org-src--saved-temp-window-config nil))))
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] don't always restore previous window configuration?
2018-11-23 15:20 ` [PATCH] " Matt Price
@ 2018-11-24 10:55 ` Nicolas Goaziou
2018-11-24 15:24 ` Matt Price
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-11-24 10:55 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
Hello,
Matt Price <moptop99@gmail.com> 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.
> \\<org-mode-map>
> @@ -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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] don't always restore previous window configuration?
2018-11-24 10:55 ` Nicolas Goaziou
@ 2018-11-24 15:24 ` Matt Price
2018-11-25 9:02 ` Nicolas Goaziou
0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2018-11-24 15:24 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 3137 bytes --]
On Sat, Nov 24, 2018 at 5:55 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:
> Hello,
>
> Matt Price <moptop99@gmail.com> 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.
> > \\<org-mode-map>
> > @@ -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.
[-- Attachment #2: Type: text/html, Size: 4466 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] don't always restore previous window configuration?
2018-11-24 15:24 ` Matt Price
@ 2018-11-25 9:02 ` Nicolas Goaziou
2018-11-25 20:56 ` Matt Price
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-11-25 9:02 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
Hello,
Matt Price <moptop99@gmail.com> writes:
> 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)
My bad. It seems "test-org-annex.el" messes with "git init". Since
I don't have git-annex command, these tests are usually skipped, so
I hadn't noticed.
> 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 :-).
IMO, the only value for `org-src-window-setup' where it might be
meaningful to preserve windows excursion is `reorganize-frame', since it
can disturb a lot the configuration used before editing the block.
However, the docstring disagrees: "When exiting the edit buffer, return
to one window."
Therefore, I suggest to simply do not restore previous configuration in
Org 9.3, and document it in incompatible changes. It will leave time to
test it and complain if something is not right.
WDYT?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] don't always restore previous window configuration?
2018-11-25 9:02 ` Nicolas Goaziou
@ 2018-11-25 20:56 ` Matt Price
2018-11-25 22:30 ` Nicolas Goaziou
0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2018-11-25 20:56 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 2182 bytes --]
On Sun, Nov 25, 2018, 4:02 AM Nicolas Goaziou <mail@nicolasgoaziou.fr wrote:
> Hello,
>
> Matt Price <moptop99@gmail.com> writes:
>
> > 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)
>
> My bad. It seems "test-org-annex.el" messes with "git init". Since
> I don't have git-annex command, these tests are usually skipped, so
> I hadn't noticed.
>
> > 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 :-).
>
> IMO, the only value for `org-src-window-setup' where it might be
> meaningful to preserve windows excursion is `reorganize-frame', since it
> can disturb a lot the configuration used before editing the block.
> However, the docstring disagrees: "When exiting the edit buffer, return
> to one window."
>
> Therefore, I suggest to simply do not restore previous configuration in
> Org 9.3, and document it in incompatible changes. It will leave time to
> test it and complain if something is not right.
>
> WDYT?
>
Personally I prefer your solution. Would you like me to make a new patch or
would you prefer to do this yourself?
>
[-- Attachment #2: Type: text/html, Size: 3317 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] don't always restore previous window configuration?
2018-11-25 20:56 ` Matt Price
@ 2018-11-25 22:30 ` Nicolas Goaziou
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2018-11-25 22:30 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
Hello,
Matt Price <moptop99@gmail.com> writes:
> Personally I prefer your solution. Would you like me to make a new patch or
> would you prefer to do this yourself?
Please be my guest. ;)
Thank you!
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-11-25 22:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22 19:09 don't always restore previous window configuration? Matt Price
2018-11-23 6:31 ` Eric S Fraga
2018-11-23 15:20 ` [PATCH] " Matt Price
2018-11-24 10:55 ` Nicolas Goaziou
2018-11-24 15:24 ` Matt Price
2018-11-25 9:02 ` Nicolas Goaziou
2018-11-25 20:56 ` Matt Price
2018-11-25 22:30 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).