org-src.el (org-edit-src-exit): Fix bug when saving an empty source buffer

* org-src.el (org-edit-src-exit): Fix bug when saving an empty
source buffer.

Thanks to Hsiu-Khuern Tang for reporting this.
This commit is contained in:
Bastien Guerry 2012-10-25 10:48:33 +02:00
parent c3390982cb
commit aba9e2b94d
1 changed files with 4 additions and 3 deletions

View File

@ -689,9 +689,10 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
(kill-buffer buffer))
(goto-char beg)
(when allow-write-back-p
(delete-region beg (1- end))
(insert code)
(delete-char 1)
(delete-region beg (max beg (1- end)))
(unless (string-match "^[ \t]*$" code)
(insert code)
(delete-char 1))
(goto-char beg)
(if single (just-one-space)))
(if (memq t (mapcar (lambda (overlay)