ソースを参照

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
Dan Davison 14 年 前
コミット
4ac8294020
2 ファイル変更6 行追加4 行削除
  1. 4 2
      lisp/ob.el
  2. 2 2
      lisp/org-src.el

+ 4 - 2
lisp/ob.el

@@ -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.

+ 2 - 2
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)