ob-keys.el 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.5
  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. ("u" . org-babel-goto-src-block-head)
  49. ("\C-u" . org-babel-goto-src-block-head)
  50. ("g" . org-babel-goto-named-src-block)
  51. ("r" . org-babel-goto-named-result)
  52. ("\C-r" . org-babel-goto-named-result)
  53. ("\C-b" . org-babel-execute-buffer)
  54. ("b" . org-babel-execute-buffer)
  55. ("\C-s" . org-babel-execute-subtree)
  56. ("s" . org-babel-execute-subtree)
  57. ("\C-d" . org-babel-demarcate-block)
  58. ("d" . org-babel-demarcate-block)
  59. ("\C-t" . org-babel-tangle)
  60. ("t" . org-babel-tangle)
  61. ("\C-f" . org-babel-tangle-file)
  62. ("f" . org-babel-tangle-file)
  63. ("\C-l" . org-babel-load-in-session)
  64. ("l" . org-babel-load-in-session)
  65. ("\C-i" . org-babel-lob-ingest)
  66. ("i" . org-babel-lob-ingest)
  67. ("\C-z" . org-babel-switch-to-session)
  68. ("z" . org-babel-switch-to-session-with-code)
  69. ("\C-a" . org-babel-sha1-hash)
  70. ("a" . org-babel-sha1-hash)
  71. ("h" . org-babel-describe-bindings)
  72. ("\C-x" . org-babel-do-key-sequence-in-edit-buffer)
  73. ("x" . org-babel-do-key-sequence-in-edit-buffer)
  74. ("\C-\M-h" . org-babel-mark-block))
  75. "Alist of key bindings and interactive Babel functions.
  76. This list associates interactive Babel functions
  77. with keys. Each element of this list will add an entry to the
  78. `org-babel-map' using the letter key which is the `car' of the
  79. a-list placed behind the generic `org-babel-key-prefix'.")
  80. (provide 'ob-keys)
  81. ;; arch-tag: 01e348ee-4906-46fa-839a-6b7b6f989048
  82. ;;; ob-keys.el ends here