emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Matt Price <moptop99@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] don't always restore previous window configuration?
Date: Sat, 24 Nov 2018 11:55:30 +0100	[thread overview]
Message-ID: <87tvk62199.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAN_Dec_fghAFCk_PHcg5RP4M9nUuuXbK=gbAJVQ1CvzpvSyGtA@mail.gmail.com> (Matt Price's message of "Fri, 23 Nov 2018 10:20:56 -0500")

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

  reply	other threads:[~2018-11-24 10:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvk62199.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).