emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] don't always restore previous window configuration?


From: Matt Price
Subject: Re: [O] [PATCH] don't always restore previous window configuration?
Date: Sat, 24 Nov 2018 10:24:23 -0500



On Sat, Nov 24, 2018 at 5:55 AM Nicolas Goaziou <address@hidden> wrote:
Hello,

Matt Price <address@hidden> 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.  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]