* possible patch: org-edit-src-code breaking window configuration
@ 2009-11-03 21:00 Eric Schulte
2009-11-03 23:18 ` Dan Davison
0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2009-11-03 21:00 UTC (permalink / raw)
To: Org Mode
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---
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: possible patch: org-edit-src-code breaking window configuration
2009-11-03 21:00 possible patch: org-edit-src-code breaking window configuration Eric Schulte
@ 2009-11-03 23:18 ` Dan Davison
2009-11-03 23:20 ` Dan Davison
2009-11-08 1:58 ` Dan Davison
0 siblings, 2 replies; 5+ messages in thread
From: Dan Davison @ 2009-11-03 23:18 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode
"Eric Schulte" <schulte.eric@gmail.com> writes:
> 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
Nice. I think it's a desirable improvement to my changes. I've had a
quick test (with all 4 possible values of org-src-window-setup) and it
seemed to work as hoped. I guess the new variable should be defvar'd as
nil in org-edit-src? There are already a number of other not-for-users
global variables used in a similar way in org-src, so it won't be
out-of-place.
Dan
>
> 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."
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: possible patch: org-edit-src-code breaking window configuration
2009-11-03 23:18 ` Dan Davison
@ 2009-11-03 23:20 ` Dan Davison
2009-11-08 1:58 ` Dan Davison
1 sibling, 0 replies; 5+ messages in thread
From: Dan Davison @ 2009-11-03 23:20 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode
Dan Davison <davison@stats.ox.ac.uk> writes:
> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
>> 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
>
> Nice. I think it's a desirable improvement to my changes. I've had a
> quick test (with all 4 possible values of org-src-window-setup) and it
> seemed to work as hoped. I guess the new variable should be defvar'd as
> nil in org-edit-src? There are already a number of other not-for-users
^^^^^^^^^^^
org-src.el
Sorry, typo. I was just too slow with C-g...
> global variables used in a similar way in org-src, so it won't be
> out-of-place.
>
> Dan
>
>>
>> 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."
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: possible patch: org-edit-src-code breaking window configuration
2009-11-03 23:18 ` Dan Davison
2009-11-03 23:20 ` Dan Davison
@ 2009-11-08 1:58 ` Dan Davison
2009-11-08 6:57 ` Carsten Dominik
1 sibling, 1 reply; 5+ messages in thread
From: Dan Davison @ 2009-11-08 1:58 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode
Dan Davison <davison@stats.ox.ac.uk> writes:
> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
>> 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
>
> Nice. I think it's a desirable improvement to my changes. I've had a
> quick test (with all 4 possible values of org-src-window-setup) and it
> seemed to work as hoped.
With the emphasis on 'quick' apparently. One further improvement on this
line of work: at the moment we are attempting to alter window
configuration when saving with C-x C-s in the edit buffer, which is
having unpleasant consequences. This is fixed in branch
org-src-window-setup at git://repo.or.cz/org-mode/babel.git.
Dan
> I guess the new variable should be defvar'd as
> nil in org-edit-src? There are already a number of other not-for-users
> global variables used in a similar way in org-src, so it won't be
> out-of-place.
>
> Dan
>
>>
>> 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."
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: possible patch: org-edit-src-code breaking window configuration
2009-11-08 1:58 ` Dan Davison
@ 2009-11-08 6:57 ` Carsten Dominik
0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-11-08 6:57 UTC (permalink / raw)
To: Dan Davison; +Cc: Org Mode
On Nov 8, 2009, at 2:58 AM, Dan Davison wrote:
> Dan Davison <davison@stats.ox.ac.uk> writes:
>
>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>
>>> 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
>>
>> Nice. I think it's a desirable improvement to my changes. I've had a
>> quick test (with all 4 possible values of org-src-window-setup) and
>> it
>> seemed to work as hoped.
>
> With the emphasis on 'quick' apparently. One further improvement on
> this
> line of work: at the moment we are attempting to alter window
> configuration when saving with C-x C-s in the edit buffer, which is
> having unpleasant consequences. This is fixed in branch
> org-src-window-setup at git://repo.or.cz/org-mode/babel.git.
Hi Dan,
I have noticed problems with C-x C-s while editing (beeps, and windows
change).
If your patch fixes this, please merge it in.
- Carsten
>
> Dan
>
>
>> I guess the new variable should be defvar'd as
>> nil in org-edit-src? There are already a number of other not-for-
>> users
>> global variables used in a similar way in org-src, so it won't be
>> out-of-place.
>>
>> Dan
>>
>>>
>>> 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."
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Remember: use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-08 6:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-03 21:00 possible patch: org-edit-src-code breaking window configuration Eric Schulte
2009-11-03 23:18 ` Dan Davison
2009-11-03 23:20 ` Dan Davison
2009-11-08 1:58 ` Dan Davison
2009-11-08 6:57 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.