diff options
author | Dan Davison <davison@stats.ox.ac.uk> | 2010-08-17 23:40:53 -0400 |
---|---|---|
committer | Dan Davison <davison@stats.ox.ac.uk> | 2010-08-17 23:40:53 -0400 |
commit | 4ac8294020951bbd60a17fcca5035a0da4276b20 (patch) | |
tree | 70b285cceea79cfbd7c57feb364e0c5bc896e3d7 | |
parent | 76790e1aa807bc7d13af17db696ffa11ce764602 (diff) | |
download | org-mode-4ac8294020951bbd60a17fcca5035a0da4276b20.tar.gz |
Avoid error and unnecessary message in transient use of code edit buffer
* ob.el (org-babel-do-in-edit-buffer): Suppress message and
check that org-src buffer is current before attempting exit
* org-src.el (org-edit-src-code): New argument quietlyp allows
message to be suppressed
-rw-r--r-- | lisp/ob.el | 6 | ||||
-rw-r--r-- | lisp/org-src.el | 4 |
2 files changed, 6 insertions, 4 deletions
@@ -486,9 +486,11 @@ of the source block to the kill ring." "Evaluate BODY in edit buffer if there is a code block at point. Return t if a code block was found at point, nil otherwise." `(let ((org-src-window-setup 'switch-invisibly)) - (when (org-edit-src-code) + (when (org-edit-src-code nil nil nil 'quietly) ,@body - (org-edit-src-exit) t))) + (if (org-bound-and-true-p org-edit-src-from-org-mode) + (org-edit-src-exit)) + t))) (defun org-babel-do-key-sequence-in-edit-buffer (key) "Read key sequence and execute the command in edit buffer. diff --git a/lisp/org-src.el b/lisp/org-src.el index 3635bf7..7ed7606 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -194,7 +194,7 @@ This minor mode is turned on in two situations: There is a mode hook, and keybindings for `org-edit-src-exit' and `org-edit-src-save'") -(defun org-edit-src-code (&optional context code edit-buffer-name) +(defun org-edit-src-code (&optional context code edit-buffer-name quietp) "Edit the source code example at point. 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]. @@ -298,7 +298,7 @@ the edited version. Optional argument CONTEXT is used by (set-buffer-modified-p nil) (and org-edit-src-persistent-message (org-set-local 'header-line-format msg))) - (message "%s" msg) + (unless quietp (message "%s" msg)) t))) (defun org-edit-src-continue (e) |