forked from mirrors/org-mode
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'
This commit is contained in:
parent
7b188f7da5
commit
0d5791e7b7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue