mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-07 15:22:06 +00:00
Avoid altering window configuration when saving edit buffer.
Saving the edit buffer is achieved by calling org-edit-src-exit, saving the org buffer and returning to the edit buffer with org-edit-src-code. When those two functions are used in this context, they should not attempt to restore the saved window configuration, nor alter the saved window configuration.
This commit is contained in:
parent
9f6102f9e7
commit
081ff1ebe3
@ -1,3 +1,11 @@
|
|||||||
|
2009-11-08 Dan Davison <davison@stats.ox.ac.uk>
|
||||||
|
|
||||||
|
* org-src.el (org-edit-src-code): New optional argument context
|
||||||
|
allows calling functions to avoid altering the saved window
|
||||||
|
configuration.
|
||||||
|
(org-edit-src-exit): Do not restore window configuration when this
|
||||||
|
function is used in the context of saving the edit buffer.
|
||||||
|
|
||||||
2009-11-09 Carsten Dominik <carsten.dominik@gmail.com>
|
2009-11-09 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
* org-clock.el (org-clock-out, org-clock-cancel): Revert to
|
* org-clock.el (org-clock-out, org-clock-cancel): Revert to
|
||||||
|
@ -187,14 +187,16 @@ This minor mode is turned on in two situations:
|
|||||||
There is a mode hook, and keybindings for `org-edit-src-exit' and
|
There is a mode hook, and keybindings for `org-edit-src-exit' and
|
||||||
`org-edit-src-save'")
|
`org-edit-src-save'")
|
||||||
|
|
||||||
(defun org-edit-src-code ()
|
(defun org-edit-src-code (&optional context)
|
||||||
"Edit the source code example at point.
|
"Edit the source code example at point.
|
||||||
The example is copied to a separate buffer, and that buffer is switched
|
The example is copied to a separate buffer, and that buffer is switched
|
||||||
to the correct language mode. When done, exit with \\[org-edit-src-exit].
|
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
|
This will remove the original code in the Org buffer, and replace it with
|
||||||
the edited version."
|
the edited version. Optional argument CONTEXT is used by
|
||||||
|
\\[org-edit-src-save] when calling this function."
|
||||||
(interactive)
|
(interactive)
|
||||||
(setq org-edit-src-saved-temp-window-config (current-window-configuration))
|
(unless (eq context 'save)
|
||||||
|
(setq org-edit-src-saved-temp-window-config (current-window-configuration)))
|
||||||
(let ((line (org-current-line))
|
(let ((line (org-current-line))
|
||||||
(col (current-column))
|
(col (current-column))
|
||||||
(case-fold-search t)
|
(case-fold-search t)
|
||||||
@ -577,9 +579,10 @@ the language, a switch telling if the content should be in a single line."
|
|||||||
(org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))
|
(org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))
|
||||||
(move-marker beg nil)
|
(move-marker beg nil)
|
||||||
(move-marker end nil))
|
(move-marker end nil))
|
||||||
(when org-edit-src-saved-temp-window-config
|
(unless (eq context 'save)
|
||||||
(set-window-configuration org-edit-src-saved-temp-window-config)
|
(when org-edit-src-saved-temp-window-config
|
||||||
(setq org-edit-src-saved-temp-window-config nil)))
|
(set-window-configuration org-edit-src-saved-temp-window-config)
|
||||||
|
(setq org-edit-src-saved-temp-window-config nil))))
|
||||||
|
|
||||||
(defun org-edit-src-save ()
|
(defun org-edit-src-save ()
|
||||||
"Save parent buffer with current state source-code buffer."
|
"Save parent buffer with current state source-code buffer."
|
||||||
@ -591,8 +594,8 @@ the language, a switch telling if the content should be in a single line."
|
|||||||
(setq msg (current-message))
|
(setq msg (current-message))
|
||||||
(if (eq org-src-window-setup 'other-frame)
|
(if (eq org-src-window-setup 'other-frame)
|
||||||
(let ((org-src-window-setup 'current-window))
|
(let ((org-src-window-setup 'current-window))
|
||||||
(org-edit-src-code))
|
(org-edit-src-code 'save))
|
||||||
(org-edit-src-code)))
|
(org-edit-src-code 'save)))
|
||||||
(push-mark m 'nomessage)
|
(push-mark m 'nomessage)
|
||||||
(goto-char (min p (point-max)))
|
(goto-char (min p (point-max)))
|
||||||
(message (or msg ""))))
|
(message (or msg ""))))
|
||||||
|
Loading…
Reference in New Issue
Block a user