Merge branch 'maint'
[org-mode/org-kjn.git] / lisp / ob-keys.el
blobdc1f437bc5570aec06076b6ceeb63680f5f62f1a
1 ;;; ob-keys.el --- key bindings for org-babel
3 ;; Copyright (C) 2009-2014 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-core)
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-j" . org-babel-insert-header-arg)
78 ("j" . org-babel-insert-header-arg)
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)
83 ("\C-I" . org-babel-view-src-block-info)
84 ("I" . org-babel-view-src-block-info)
85 ("\C-z" . org-babel-switch-to-session)
86 ("z" . org-babel-switch-to-session-with-code)
87 ("\C-a" . org-babel-sha1-hash)
88 ("a" . org-babel-sha1-hash)
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 ("k" . org-babel-remove-result-one-or-many)
93 ("\C-\M-h" . org-babel-mark-block))
94 "Alist of key bindings and interactive Babel functions.
95 This list associates interactive Babel functions
96 with keys. Each element of this list will add an entry to the
97 `org-babel-map' using the letter key which is the `car' of the
98 a-list placed behind the generic `org-babel-key-prefix'.")
100 (provide 'ob-keys)
102 ;; Local variables:
103 ;; generated-autoload-file: "org-loaddefs.el"
104 ;; End:
106 ;;; ob-keys.el ends here