Commit | Line | Data |
---|---|---|
86fbb8ca CD |
1 | ;;; ob-keys.el --- key bindings for org-babel |
2 | ||
ba318903 | 3 | ;; Copyright (C) 2009-2014 Free Software Foundation, Inc. |
86fbb8ca CD |
4 | |
5 | ;; Author: Eric Schulte | |
6 | ;; Keywords: literate programming, reproducible research | |
7 | ;; Homepage: http://orgmode.org | |
86fbb8ca CD |
8 | |
9 | ;; This file is part of GNU Emacs. | |
10 | ||
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. | |
15 | ||
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. | |
20 | ||
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/>. | |
23 | ||
24 | ;;; Commentary: | |
25 | ||
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. | |
30 | ||
31 | ;;; Code: | |
271672fa | 32 | (require 'ob-core) |
86fbb8ca CD |
33 | |
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.") | |
39 | ||
40 | (defvar org-babel-map (make-sparse-keymap) | |
41 | "The keymap for interactive Babel functions.") | |
42 | ||
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)) | |
48 | ||
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) | |
afe98dfa CD |
54 | ("e" . org-babel-execute-maybe) |
55 | ("\C-e" . org-babel-execute-maybe) | |
86fbb8ca CD |
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) | |
afe98dfa CD |
60 | ("u" . org-babel-goto-src-block-head) |
61 | ("\C-u" . org-babel-goto-src-block-head) | |
86fbb8ca CD |
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) | |
afe98dfa CD |
69 | ("\C-d" . org-babel-demarcate-block) |
70 | ("d" . org-babel-demarcate-block) | |
86fbb8ca CD |
71 | ("\C-t" . org-babel-tangle) |
72 | ("t" . org-babel-tangle) | |
73 | ("\C-f" . org-babel-tangle-file) | |
74 | ("f" . org-babel-tangle-file) | |
3ab2c837 BG |
75 | ("\C-c" . org-babel-check-src-block) |
76 | ("c" . org-babel-check-src-block) | |
e66ba1df BG |
77 | ("\C-j" . org-babel-insert-header-arg) |
78 | ("j" . org-babel-insert-header-arg) | |
afe98dfa CD |
79 | ("\C-l" . org-babel-load-in-session) |
80 | ("l" . org-babel-load-in-session) | |
81 | ("\C-i" . org-babel-lob-ingest) | |
82 | ("i" . org-babel-lob-ingest) | |
3ab2c837 BG |
83 | ("\C-I" . org-babel-view-src-block-info) |
84 | ("I" . org-babel-view-src-block-info) | |
86fbb8ca | 85 | ("\C-z" . org-babel-switch-to-session) |
afe98dfa | 86 | ("z" . org-babel-switch-to-session-with-code) |
86fbb8ca CD |
87 | ("\C-a" . org-babel-sha1-hash) |
88 | ("a" . org-babel-sha1-hash) | |
afe98dfa CD |
89 | ("h" . org-babel-describe-bindings) |
90 | ("\C-x" . org-babel-do-key-sequence-in-edit-buffer) | |
91 | ("x" . org-babel-do-key-sequence-in-edit-buffer) | |
92 | ("\C-\M-h" . org-babel-mark-block)) | |
86fbb8ca CD |
93 | "Alist of key bindings and interactive Babel functions. |
94 | This list associates interactive Babel functions | |
95 | with keys. Each element of this list will add an entry to the | |
96 | `org-babel-map' using the letter key which is the `car' of the | |
97 | a-list placed behind the generic `org-babel-key-prefix'.") | |
98 | ||
99 | (provide 'ob-keys) | |
100 | ||
bdebdb64 BG |
101 | ;; Local variables: |
102 | ;; generated-autoload-file: "org-loaddefs.el" | |
103 | ;; End: | |
86fbb8ca CD |
104 | |
105 | ;;; ob-keys.el ends here |