diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-02-17 22:29:06 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-02-17 22:32:50 +0100 |
commit | bf601016dce45df7eeaebe270063829c8a3715b3 (patch) | |
tree | 4b79ed51b4d16937acfc3ef80c804a9ff6df74ff | |
parent | 7ca2e027a618e6435c762acbdb65c937d71bcc48 (diff) | |
download | org-mode-bf601016dce45df7eeaebe270063829c8a3715b3.tar.gz |
Properly save source blocks with `save-some-buffers'
* lisp/org-src.el (org-src-mode-configure-edit-buffer): Set
`write-contents-functions' so that saving a remote editing buffer
always call `org-edit-src-save'.
(org-edit-src-save): Return a non-nil value explicitly.
Reported-by: Thibault Polge <thibault@thb.lt>
<http://permalink.gmane.org/gmane.emacs.orgmode/112201>
-rw-r--r-- | lisp/org-src.el | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el index b45306e..32883b0 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -646,7 +646,8 @@ See also `org-src-mode-hook'." (setq buffer-offer-save t) (setq buffer-file-name (concat (buffer-file-name (marker-buffer org-src--beg-marker)) - "[" (buffer-name) "]"))) + "[" (buffer-name) "]")) + (setq-local write-contents-functions '(org-edit-src-save))) (setq buffer-read-only t)))) (add-hook 'org-src-mode-hook #'org-src-mode-configure-edit-buffer) @@ -1032,7 +1033,10 @@ Throw an error if there is no such buffer." (insert edited-code) (when (and expecting-bol (not (bolp))) (insert "\n"))) (save-buffer) - (move-overlay overlay beg (point))))) + (move-overlay overlay beg (point)))) + ;; `write-contents-functions' require the function to return + ;; a non-nil value so that other functions are not called. + t) (defun org-edit-src-exit () "Kill current sub-editing buffer and return to source buffer." |