瀏覽代碼

a new function for jumping to the head of the current code block

* lisp/ob-keys.el (org-babel-key-bindings): adding key-binding for
  `org-babel-goto-src-block-head'
* lisp/ob.el (org-babel-goto-src-block-head): jump to the head of the
  current code block
Eric Schulte 14 年之前
父節點
當前提交
7dd72699a9
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 2 0
      lisp/ob-keys.el
  2. 8 0
      lisp/ob.el

+ 2 - 0
lisp/ob-keys.el

@@ -58,6 +58,8 @@ functions which are assigned key bindings, and see
     ("\C-o" . org-babel-open-src-block-result)
     ("\C-v" . org-babel-expand-src-block)
     ("v" . org-babel-expand-src-block)
+    ("u" . org-babel-goto-src-block-head)
+    ("\C-u" . org-babel-goto-src-block-head)
     ("g" . org-babel-goto-named-src-block)
     ("r" . org-babel-goto-named-result)
     ("\C-r" . org-babel-goto-named-result)

+ 8 - 0
lisp/ob.el

@@ -1021,6 +1021,14 @@ If the point is not on a source block then return nil."
 	       (looking-at org-babel-src-block-regexp))
         (point))))))
 
+;;;###autoload
+(defun org-babel-goto-src-block-head ()
+  "Go to the beginning of the current code block."
+  (interactive)
+  ((lambda (head)
+     (if head (goto-char head) (error "not currently in a code block")))
+   (org-babel-where-is-src-block-head)))
+
 ;;;###autoload
 (defun org-babel-goto-named-src-block (name)
   "Go to a named source-code block."