ob-keys.el 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ;;; ob-keys.el --- key bindings for org-babel
  2. ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  3. ;; Author: Eric Schulte
  4. ;; Keywords: literate programming, reproducible research
  5. ;; Homepage: http://orgmode.org
  6. ;; Version: 0.01
  7. ;; This file is part of GNU Emacs.
  8. ;; GNU Emacs is free software: you can redistribute it and/or modify
  9. ;; it under the terms of the GNU General Public License as published by
  10. ;; the Free Software Foundation, either version 3 of the License, or
  11. ;; (at your option) any later version.
  12. ;; GNU Emacs is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;; GNU General Public License for more details.
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  18. ;;; Commentary:
  19. ;; Add org-babel keybindings to the org-mode keymap for exposing
  20. ;; org-babel functions. These will all share a common prefix. See
  21. ;; the value of `org-babel-key-bindings' for a list of interactive
  22. ;; functions and their associated keys.
  23. ;;; Code:
  24. (require 'ob)
  25. (defvar org-babel-key-prefix "\C-c\C-v"
  26. "The `org-babel-key-prefix' variable holds the key prefix
  27. behind which all org-babel interactive key-binding are placed.
  28. See `org-babel-key-bindings' for the list of interactive babel
  29. functions which are assigned key bindings, and see
  30. `org-babel-map' for the actual babel keymap.")
  31. (defvar org-babel-map (make-sparse-keymap)
  32. "The keymap holding key bindings for interactive org-babel
  33. functions.")
  34. ;;;###autoload
  35. (defun org-babel-describe-bindings ()
  36. "Describe all key binding placed behind the
  37. `org-babel-key-prefix' prefix."
  38. (interactive)
  39. (describe-bindings org-babel-key-prefix))
  40. (defvar org-babel-key-bindings
  41. '(("e" . org-babel-execute-src-block)
  42. ("\C-e" . org-babel-execute-src-block)
  43. ("o" . org-babel-open-src-block-result)
  44. ("\C-o" . org-babel-open-src-block-result)
  45. ("\C-p" . org-babel-expand-src-block)
  46. ("p" . org-babel-expand-src-block)
  47. ("g" . org-babel-goto-named-source-block)
  48. ("\C-b" . org-babel-execute-buffer)
  49. ("b" . org-babel-execute-buffer)
  50. ("\C-s" . org-babel-execute-subtree)
  51. ("s" . org-babel-execute-subtree)
  52. ("\C-t" . org-babel-tangle)
  53. ("t" . org-babel-tangle)
  54. ("\C-f" . org-babel-tangle-file)
  55. ("f" . org-babel-tangle-file)
  56. ("\C-l" . org-babel-lob-ingest)
  57. ("l" . org-babel-lob-ingest)
  58. ("\C-z" . org-babel-switch-to-session)
  59. ("z" . org-babel-switch-to-session)
  60. ("\C-a" . org-babel-sha1-hash)
  61. ("a" . org-babel-sha1-hash)
  62. ("h" . org-babel-describe-bindings))
  63. "Alist associating key bindings with interactive Org-babel
  64. functions. This list associates interactive org-babel functions
  65. with keys. Each element of this list will add an entry to the
  66. `org-babel-map' using the letter key which is the `car' of the
  67. a-list placed behind the generic `org-babel-key-prefix'.")
  68. (provide 'ob-keys)
  69. ;; arch-tag: 01e348ee-4906-46fa-839a-6b7b6f989048
  70. ;;; ob-keys.el ends here