diff options
author | Dan Davison <davison@stats.ox.ac.uk> | 2010-08-17 22:37:19 -0400 |
---|---|---|
committer | Dan Davison <davison@stats.ox.ac.uk> | 2010-08-17 22:37:19 -0400 |
commit | 76790e1aa807bc7d13af17db696ffa11ce764602 (patch) | |
tree | 953e0bc713e0c9eae241f710b3cc4a491851635d | |
parent | f9cecd192dd231f163b7d99a1cf6f00d2567b09e (diff) | |
download | org-mode-76790e1aa807bc7d13af17db696ffa11ce764602.tar.gz |
Get rid of some compiler warnings.
* org-src.el (ob-comint): require 'ob-comint
(org-src-babel-info): define variable
Also, reposition `org-src-do-at-code-block' and
`org-src-do-key-sequence-at-code-block' function definitions within
the file.
-rw-r--r-- | lisp/org-src.el | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el index 22c9952..3635bf7 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -35,6 +35,7 @@ (require 'org-macs) (require 'org-compat) (require 'ob-keys) +(require 'ob-comint) (eval-when-compile (require 'cl)) @@ -167,39 +168,6 @@ For example, there is no ocaml-mode in Emacs, but the mode to use is (defvar org-src-mode-map (make-sparse-keymap)) (define-key org-src-mode-map "\C-c'" 'org-edit-src-exit) -(defmacro org-src-do-at-code-block (&rest body) - "Execute a command from an edit buffer in the Org-mode buffer." - `(let ((beg-marker org-edit-src-beg-marker)) - (if beg-marker - (with-current-buffer (marker-buffer beg-marker) - (goto-char (marker-position beg-marker)) - ,@body)))) - -(defun org-src-do-key-sequence-at-code-block (&optional key) - "Execute key sequence at code block in the source Org buffer. -The command bound to KEY in the Org-babel key map is executed -remotely with point temporarily at the start of the code block in -the Org buffer. - -This command is not bound to a key by default, to avoid conflicts -with language major mode bindings. To bind it to C-c @ in all -language major modes, you could use - - (add-hook 'org-src-mode-hook - (lambda () (define-key org-src-mode-map \"\\C-c@\" - 'org-src-do-key-sequence-at-code-block))) - -In that case, for example, C-c @ t issued in code edit buffers -would tangle the current Org code block, C-c @ e would execute -the block and C-c @ h would display the other available -Org-babel commands." - (interactive "kOrg-babel key: ") - (if (equal key (kbd "C-g")) (keyboard-quit) - (org-edit-src-save) - (org-src-do-at-code-block - (call-interactively - (lookup-key org-babel-map key))))) - (defvar org-edit-src-force-single-line nil) (defvar org-edit-src-from-org-mode nil) (defvar org-edit-src-allow-write-back-p t) @@ -216,6 +184,8 @@ Org-babel commands." immediately; otherwise it will ask whether you want to return to the existing edit buffer.") +(defvar org-src-babel-info nil) + (define-minor-mode org-src-mode "Minor mode for language major mode buffers generated by org. This minor mode is turned on in two situations: @@ -709,6 +679,39 @@ the language, a switch telling if the content should be in a single line." (org-src-associate-babel-session org-src-babel-info))) (org-add-hook 'org-src-mode-hook 'org-src-babel-configure-edit-buffer) +(defmacro org-src-do-at-code-block (&rest body) + "Execute a command from an edit buffer in the Org-mode buffer." + `(let ((beg-marker org-edit-src-beg-marker)) + (if beg-marker + (with-current-buffer (marker-buffer beg-marker) + (goto-char (marker-position beg-marker)) + ,@body)))) + +(defun org-src-do-key-sequence-at-code-block (&optional key) + "Execute key sequence at code block in the source Org buffer. +The command bound to KEY in the Org-babel key map is executed +remotely with point temporarily at the start of the code block in +the Org buffer. + +This command is not bound to a key by default, to avoid conflicts +with language major mode bindings. To bind it to C-c @ in all +language major modes, you could use + + (add-hook 'org-src-mode-hook + (lambda () (define-key org-src-mode-map \"\\C-c@\" + 'org-src-do-key-sequence-at-code-block))) + +In that case, for example, C-c @ t issued in code edit buffers +would tangle the current Org code block, C-c @ e would execute +the block and C-c @ h would display the other available +Org-babel commands." + (interactive "kOrg-babel key: ") + (if (equal key (kbd "C-g")) (keyboard-quit) + (org-edit-src-save) + (org-src-do-at-code-block + (call-interactively + (lookup-key org-babel-map key))))) + (provide 'org-src) |