emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: possible patch: org-edit-src-code breaking window configuration
Date: Tue, 03 Nov 2009 14:00:44 -0700	[thread overview]
Message-ID: <m2y6mn9vcz.fsf@gmail.com> (raw)

Hi,

I've noticed that org-edit-src breaks my window configuration.  The
patch below fixes this, but introduces a new global variable, and might
not have sensible behavior if multiple source-code blocks are edited at
once.  Even so I personally prefer it's behavior to the current default
behavior of removing all windows from the current frame.

thoughts? -- Eric

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org-src.el b/lisp/org-src.el
index eba8ef3..2f578b9 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -193,6 +193,7 @@ to the correct language mode.  When done, exit with \\[org-edit-src-exit].
 This will remove the original code in the Org buffer, and replace it with
 the edited version."
   (interactive)
+  (setq org-edit-src-saved-temp-window-config (current-window-configuration))
   (let ((line (org-current-line))
 	(col (current-column))
 	(case-fold-search t)
@@ -574,7 +575,10 @@ the language, a switch telling if the content should be in a single line."
     (org-goto-line (1- (+ (org-current-line) line)))
     (org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))
     (move-marker beg nil)
-    (move-marker end nil)))
+    (move-marker end nil))
+  (when org-edit-src-saved-temp-window-config
+    (set-window-configuration org-edit-src-saved-temp-window-config)
+    (setq org-edit-src-saved-temp-window-config nil)))
 
 (defun org-edit-src-save ()
   "Save parent buffer with current state source-code buffer."
--8<---------------cut here---------------end--------------->8---

             reply	other threads:[~2009-11-03 21:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 21:00 Eric Schulte [this message]
2009-11-03 23:18 ` possible patch: org-edit-src-code breaking window configuration Dan Davison
2009-11-03 23:20   ` Dan Davison
2009-11-08  1:58   ` Dan Davison
2009-11-08  6:57     ` Carsten Dominik

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=m2y6mn9vcz.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).