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