0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 11:02:53 +00:00

org-src.el: Prevent saving when editing fixed-width buffer, exiting will save already

* org-src.el (org-edit-src-save): Prevent saving when editing
fixed-width buffer, exiting will save already.
(org-edit-src-exit): Inconditionally kill the src/example
editing buffer.
This commit is contained in:
Bastien Guerry 2013-02-16 10:35:08 +01:00
parent 3eac442249
commit 602d6edb56

View file

@ -698,6 +698,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
(set-buffer-modified-p nil))
(org-src-switch-to-buffer (marker-buffer beg) (or context 'exit))
(if (eq context 'save) (save-buffer)
(with-current-buffer buffer
(set-buffer-modified-p nil))
(kill-buffer buffer))
(goto-char beg)
(when allow-write-back-p
@ -749,7 +751,9 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
(defun org-edit-src-save ()
"Save parent buffer with current state source-code buffer."
(interactive)
(org-src-in-org-buffer (save-buffer)))
(if (string-match "Fixed Width" (buffer-name))
(user-error "Use C-c ' to save and exit, C-c k to abort editing")
(org-src-in-org-buffer (save-buffer))))
(declare-function org-babel-tangle "ob-tangle" (&optional only-this-block target-file lang))