isolating dangerous testing examples
[org-mode.git] / lisp / ob-keys.el
blobc8539447248b15238dc0378ce50e8db9edfbbf54
1 ;;; ob-keys.el --- key bindings for org-babel
3 ;; Copyright (C) 2009-2011 Free Software Foundation, Inc.
5 ;; Author: Eric Schulte
6 ;; Keywords: literate programming, reproducible research
7 ;; Homepage: http://orgmode.org
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 ;;; Commentary:
26 ;; Add org-babel keybindings to the org-mode keymap for exposing
27 ;; org-babel functions. These will all share a common prefix. See
28 ;; the value of `org-babel-key-bindings' for a list of interactive
29 ;; functions and their associated keys.
31 ;;; Code:
32 (require 'ob)
34 (defvar org-babel-key-prefix "\C-c\C-v"
35 "The key prefix for Babel interactive key-bindings.
36 See `org-babel-key-bindings' for the list of interactive babel
37 functions which are assigned key bindings, and see
38 `org-babel-map' for the actual babel keymap.")
40 (defvar org-babel-map (make-sparse-keymap)
41 "The keymap for interactive Babel functions.")
43 ;;;###autoload
44 (defun org-babel-describe-bindings ()
45 "Describe all keybindings behind `org-babel-key-prefix'."
46 (interactive)
47 (describe-bindings org-babel-key-prefix))
49 (defvar org-babel-key-bindings
50 '(("p" . org-babel-previous-src-block)
51 ("\C-p" . org-babel-previous-src-block)
52 ("n" . org-babel-next-src-block)
53 ("\C-n" . org-babel-next-src-block)
54 ("e" . org-babel-execute-maybe)
55 ("\C-e" . org-babel-execute-maybe)
56 ("o" . org-babel-open-src-block-result)
57 ("\C-o" . org-babel-open-src-block-result)
58 ("\C-v" . org-babel-expand-src-block)
59 ("v" . org-babel-expand-src-block)
60 ("u" . org-babel-goto-src-block-head)
61 ("\C-u" . org-babel-goto-src-block-head)
62 ("g" . org-babel-goto-named-src-block)
63 ("r" . org-babel-goto-named-result)
64 ("\C-r" . org-babel-goto-named-result)
65 ("\C-b" . org-babel-execute-buffer)
66 ("b" . org-babel-execute-buffer)
67 ("\C-s" . org-babel-execute-subtree)
68 ("s" . org-babel-execute-subtree)
69 ("\C-d" . org-babel-demarcate-block)
70 ("d" . org-babel-demarcate-block)
71 ("\C-t" . org-babel-tangle)
72 ("t" . org-babel-tangle)
73 ("\C-f" . org-babel-tangle-file)
74 ("f" . org-babel-tangle-file)
75 ("\C-c" . org-babel-check-src-block)
76 ("c" . org-babel-check-src-block)
77 ("\C-l" . org-babel-load-in-session)
78 ("l" . org-babel-load-in-session)
79 ("\C-i" . org-babel-lob-ingest)
80 ("i" . org-babel-lob-ingest)
81 ("\C-I" . org-babel-view-src-block-info)
82 ("I" . org-babel-view-src-block-info)
83 ("\C-z" . org-babel-switch-to-session)
84 ("z" . org-babel-switch-to-session-with-code)
85 ("\C-a" . org-babel-sha1-hash)
86 ("a" . org-babel-sha1-hash)
87 ("h" . org-babel-describe-bindings)
88 ("\C-x" . org-babel-do-key-sequence-in-edit-buffer)
89 ("x" . org-babel-do-key-sequence-in-edit-buffer)
90 ("\C-\M-h" . org-babel-mark-block))
91 "Alist of key bindings and interactive Babel functions.
92 This list associates interactive Babel functions
93 with keys. Each element of this list will add an entry to the
94 `org-babel-map' using the letter key which is the `car' of the
95 a-list placed behind the generic `org-babel-key-prefix'.")
97 (provide 'ob-keys)
101 ;;; ob-keys.el ends here