Browse Source

enable speed commands for Babel commands on code blocks

* lisp/org.el (org-speed-command-hook): added org-speed-command-hook
  (org-babel-speed-command-hook): hook for Babel's speed commands
Jambunathan K 9 years ago
parent
commit
e7bf631fdc
1 changed files with 7 additions and 1 deletions
  1. 7 1
      lisp/org.el

+ 7 - 1
lisp/org.el

@@ -16507,7 +16507,13 @@ If not, return to the original position and throw an error."
     (cdr (assoc keys (append org-speed-commands-user
 			     org-speed-commands-default)))))
 
-(defcustom org-speed-command-hook 'org-speed-command-default-hook
+(defun org-babel-speed-command-hook (keys)
+  "Hook for activating single-letter code block commands."
+  (when (and (bolp) (looking-at org-babel-src-block-regexp))
+    (cdr (assoc keys org-babel-key-bindings))))
+
+(defcustom org-speed-command-hook
+  '(org-speed-command-default-hook org-babel-speed-command-hook)
   "Hook for activating speed commands at strategic locations.
 Hook functions are called in sequence until a valid handler is
 found.