From 236f209b25f3e59af7786aed91d7a137b98de452 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 17 May 2010 17:08:32 -0600 Subject: [PATCH 1/2] babel: changes to org-babel key bindings --- contrib/babel/lisp/org-babel-keys.el | 43 ++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/contrib/babel/lisp/org-babel-keys.el b/contrib/babel/lisp/org-babel-keys.el index 4003a2822..651ea408f 100644 --- a/contrib/babel/lisp/org-babel-keys.el +++ b/contrib/babel/lisp/org-babel-keys.el @@ -35,30 +35,49 @@ (require 'org-babel) (defvar org-babel-key-prefix "\C-c\C-v" - "Prefix behind which all org-babel interactive key-binding will -be placed. See `org-babel-key-bindings' for the list of -interactive babel functions which are assigned key bindings, and -see `org-babel-map' for the actual babel keymap.") + "The `org-babel-key-prefix' variable holds the key prefix +behind which all org-babel interactive key-binding are placed. +See `org-babel-key-bindings' for the list of interactive babel +functions which are assigned key bindings, and see +`org-babel-map' for the actual babel keymap.") -(defvar org-babel-map (make-sparse-keymap) "The org-babel keymap.") +(defvar org-babel-map (make-sparse-keymap) + "The keymap holding key bindings for interactive org-babel +functions.") (define-key org-mode-map org-babel-key-prefix org-babel-map) +(defun org-babel-describe-bindings () + "Describe all key binding placed behind the +`org-babel-key-prefix' prefix." + (interactive) + (describe-bindings org-babel-key-prefix)) + (defvar org-babel-key-bindings '(("\C-p" . org-babel-expand-src-block) + ("p" . org-babel-expand-src-block) ("\C-g" . org-babel-goto-named-source-block) + ("g" . org-babel-goto-named-source-block) ("\C-b" . org-babel-execute-buffer) + ("b" . org-babel-execute-buffer) ("\C-s" . org-babel-execute-subtree) + ("s" . org-babel-execute-subtree) ("\C-t" . org-babel-tangle) - ("\C-T" . org-babel-tangle-file) + ("t" . org-babel-tangle) + ("\C-f" . org-babel-tangle-file) + ("f" . org-babel-tangle-file) ("\C-l" . org-babel-lob-ingest) + ("l" . org-babel-lob-ingest) ("\C-z" . org-babel-switch-to-session) - ("\C-h" . org-babel-sha1-hash)) - "Org-babel keybindings. This list associates interactive -org-babel functions with keys. Each element of this list will -add an entry to the `org-babel-map' using the letter key which is -the `car' of the a-list placed behind the generic -`org-babel-key-prefix'.") + ("z" . org-babel-switch-to-session) + ("\C-a" . org-babel-sha1-hash) + ("a" . org-babel-sha1-hash) + ("h" . org-babel-describe-bindings)) + "Alist associating key bindings with interactive Org-babel +functions. This list associates interactive org-babel functions +with keys. Each element of this list will add an entry to the +`org-babel-map' using the letter key which is the `car' of the +a-list placed behind the generic `org-babel-key-prefix'.") (mapc (lambda (pair) (define-key org-babel-map (car pair) (cdr pair))) From 2139651c0d5ca9558dfcb2af19af2c6d32e37600 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 17 May 2010 17:13:20 -0600 Subject: [PATCH 2/2] babel: org-babel-clean-text-properties now checks for valid argument thanks to Michael Sperber for pointing this out --- contrib/babel/lisp/org-babel.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el index b765ab4b6..d4313b2f7 100644 --- a/contrib/babel/lisp/org-babel.el +++ b/contrib/babel/lisp/org-babel.el @@ -1235,7 +1235,8 @@ block but are passed literally to the \"example-block\"." (defun org-babel-clean-text-properties (text) "Strip all properties from text return." - (set-text-properties 0 (length text) nil text) text) + (when text + (set-text-properties 0 (length text) nil text) text)) (defun org-babel-strip-protective-commas (body) "Strip protective commas from bodies of source blocks."