ob-keys.el 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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: 7.01trans
  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 key prefix for Babel interactive key-bindings.
  27. See `org-babel-key-bindings' for the list of interactive babel
  28. functions which are assigned key bindings, and see
  29. `org-babel-map' for the actual babel keymap.")
  30. (defvar org-babel-map (make-sparse-keymap)
  31. "The keymap for interactive Babel functions.")
  32. ;;;###autoload
  33. (defun org-babel-describe-bindings ()
  34. "Describe all keybindings behind `org-babel-key-prefix'."
  35. (interactive)
  36. (describe-bindings org-babel-key-prefix))
  37. (defvar org-babel-key-bindings
  38. '(("p" . org-babel-previous-src-block)
  39. ("\C-p" . org-babel-previous-src-block)
  40. ("n" . org-babel-next-src-block)
  41. ("\C-n" . org-babel-next-src-block)
  42. ("e" . org-babel-execute-maybe)
  43. ("\C-e" . org-babel-execute-maybe)
  44. ("o" . org-babel-open-src-block-result)
  45. ("\C-o" . org-babel-open-src-block-result)
  46. ("\C-v" . org-babel-expand-src-block)
  47. ("v" . org-babel-expand-src-block)
  48. ("g" . org-babel-goto-named-src-block)
  49. ("r" . org-babel-goto-named-result)
  50. ("\C-r" . org-babel-goto-named-result)
  51. ("\C-b" . org-babel-execute-buffer)
  52. ("b" . org-babel-execute-buffer)
  53. ("\C-s" . org-babel-execute-subtree)
  54. ("s" . org-babel-execute-subtree)
  55. ("\C-t" . org-babel-tangle)
  56. ("t" . org-babel-tangle)
  57. ("\C-f" . org-babel-tangle-file)
  58. ("f" . org-babel-tangle-file)
  59. ("\C-l" . org-babel-load-in-session)
  60. ("l" . org-babel-load-in-session)
  61. ("\C-i" . org-babel-lob-ingest)
  62. ("i" . org-babel-lob-ingest)
  63. ("\C-z" . org-babel-switch-to-session)
  64. ("z" . org-babel-switch-to-session)
  65. ("\C-a" . org-babel-sha1-hash)
  66. ("a" . org-babel-sha1-hash)
  67. ("h" . org-babel-describe-bindings))
  68. "Alist of key bindings and interactive Babel functions.
  69. This list associates interactive Babel functions
  70. with keys. Each element of this list will add an entry to the
  71. `org-babel-map' using the letter key which is the `car' of the
  72. a-list placed behind the generic `org-babel-key-prefix'.")
  73. (provide 'ob-keys)
  74. ;; arch-tag: 01e348ee-4906-46fa-839a-6b7b6f989048
  75. ;;; ob-keys.el ends here