summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <davison@stats.ox.ac.uk>2010-10-18 20:15:35 +0100
committerDan Davison <davison@stats.ox.ac.uk>2010-10-19 13:19:33 +0100
commita6d30d3b9beef5d30bf916bbb35cd524b1eac5dc (patch)
treeb406257646b11f05ef5c44329cc77888c45c611f
parentc9bb51e8832e48c054bec7bb6f210fd86ff90796 (diff)
downloadorg-mode-a6d30d3b9beef5d30bf916bbb35cd524b1eac5dc.tar.gz
babel: New function to mark the body of a src block.
* ob.el (org-babel-mark-block): New function to mark the body of a src block in the style of `mark-defun'. * ob-keys.el (org-babel-key-bindings): Bind `org-babel-mark-block' to C-c C-v C-M-h
-rw-r--r--lisp/ob-keys.el3
-rw-r--r--lisp/ob.el12
2 files changed, 14 insertions, 1 deletions
diff --git a/lisp/ob-keys.el b/lisp/ob-keys.el
index c27d7fd..bab110f 100644
--- a/lisp/ob-keys.el
+++ b/lisp/ob-keys.el
@@ -83,7 +83,8 @@ functions which are assigned key bindings, and see
("a" . org-babel-sha1-hash)
("h" . org-babel-describe-bindings)
("\C-x" . org-babel-do-key-sequence-in-edit-buffer)
- ("x" . org-babel-do-key-sequence-in-edit-buffer))
+ ("x" . org-babel-do-key-sequence-in-edit-buffer)
+ ("\C-\M-h" . org-babel-mark-block))
"Alist of key bindings and interactive Babel functions.
This list associates interactive Babel functions
with keys. Each element of this list will add an entry to the
diff --git a/lisp/ob.el b/lisp/ob.el
index 3c81baf..437ee73 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -1114,6 +1114,18 @@ With optional prefix argument ARG, jump backward ARG many source blocks."
(defvar org-babel-load-languages)
;;;###autoload
+(defun org-babel-mark-block ()
+ "Mark current src block"
+ (interactive)
+ ((lambda (head)
+ (when head
+ (save-excursion
+ (goto-char head)
+ (looking-at org-babel-src-block-regexp))
+ (push-mark (match-end 5) nil t)
+ (goto-char (match-beginning 5))))
+ (org-babel-where-is-src-block-head)))
+
(defun org-babel-demarcate-block (&optional arg)
"Wrap or split the code in the region or on the point.
When called from inside of a code block the current block is