diff options
author | Dan Davison <davison@stats.ox.ac.uk> | 2010-09-02 11:57:03 -0700 |
---|---|---|
committer | Dan Davison <davison@stats.ox.ac.uk> | 2010-09-02 11:57:03 -0700 |
commit | 0d5791e7b7324bfd7b9893f3a752dbe8aedd1aeb (patch) | |
tree | 58050c92e49c24da6226e3ef2e8f206273cf8a6b | |
parent | 7b188f7da5797da7ae225b89239f87adf0135959 (diff) | |
download | org-mode-0d5791e7b7324bfd7b9893f3a752dbe8aedd1aeb.tar.gz |
Allow language-native TAB command in code blocks.
* org-src.el (org-src-tab-indents-natively): New variable controlling
whether language-native TAB action should be performed
(org-src-native-tab-command-maybe): New function to perform
language-native TAB action.
(org-tab-first-hook): Add `org-src-native-tab-command-maybe'
-rw-r--r-- | lisp/org-src.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el index 6c09cbd..d1948cc 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -715,6 +715,19 @@ Org-babel commands." (call-interactively (lookup-key org-babel-map key))))) +(defvar org-src-tab-acts-natively nil + "If non-nil, the effect of TAB in a code block is as if it were +issued in the language major mode buffer.") + +(defun org-src-native-tab-command-maybe () + "Perform language-specific TAB action. +Alter code block according to effect of TAB in the language major +mode." + (and org-src-tab-acts-natively + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))) + +(add-hook 'org-tab-first-hook 'org-src-native-tab-command-maybe) + (defun org-src-font-lock-fontify-block (lang start end) "Fontify code block. This function is called by emacs automatic fontification, as long |